From e4b122d7c75e3aae0de21bd06e440b301dcc5f67 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:47:46 +0800 Subject: [PATCH] fix: RequiredGas --- core/vm/dasigners.go | 3 +++ core/vm/wrapped_a0gi_base.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/core/vm/dasigners.go b/core/vm/dasigners.go index 4799d4758f..355c3d2512 100644 --- a/core/vm/dasigners.go +++ b/core/vm/dasigners.go @@ -79,6 +79,9 @@ func (d *DASignersPrecompile) Address() common.Address { // RequiredGas implements vm.PrecompiledContract. func (d *DASignersPrecompile) RequiredGas(input []byte) uint64 { + if len(input) < 4 { + return DASignersRequiredGasMax + } method, err := d.abi.MethodById(input[:4]) if err != nil { return DASignersRequiredGasMax diff --git a/core/vm/wrapped_a0gi_base.go b/core/vm/wrapped_a0gi_base.go index af5633618f..77a6515e80 100644 --- a/core/vm/wrapped_a0gi_base.go +++ b/core/vm/wrapped_a0gi_base.go @@ -60,6 +60,9 @@ func (w *WrappedA0giBasePrecompile) Address() common.Address { // RequiredGas implements vm.PrecompiledContract. func (w *WrappedA0giBasePrecompile) RequiredGas(input []byte) uint64 { + if len(input) < 4 { + return WrappedA0GIBaseRequiredGasMax + } method, err := w.abi.MethodById(input[:4]) if err != nil { return WrappedA0GIBaseRequiredGasMax