diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3adc2a853c..66dba3f52e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.56 + version: v1.63 working-directory: . args: --timeout 3m skip-pkg-cache: true diff --git a/.golangci.yml b/.golangci.yml index c6c8d5748a..ace8a22dad 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,11 +3,6 @@ run: timeout: 10m tests: true - # default is true. Enables skipping of directories: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: true - # Include non-test files tagged as test-only. - # Context: https://github.com/ava-labs/avalanchego/pull/3173 linters: disable-all: true @@ -18,8 +13,19 @@ linters: - ineffassign - misspell - unconvert + - typecheck - unused + # - staticcheck + - bidichk + - durationcheck + - copyloopvar - whitespace + # - revive # only certain checks enabled + - durationcheck + - gocheckcompilerdirectives + - reassign + - mirror + - tenv linters-settings: gofmt: diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index 1e30d27f19..ee46105203 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -1210,7 +1210,6 @@ func TestUnpackRevert(t *testing.T) { {"4e487b7100000000000000000000000000000000000000000000000000000000000000ff", "unknown panic code: 0xff", nil}, } for index, c := range cases { - index, c := index, c t.Run(fmt.Sprintf("case %d", index), func(t *testing.T) { t.Parallel() got, err := UnpackRevert(common.Hex2Bytes(c.input)) diff --git a/accounts/abi/bind/bind.go b/accounts/abi/bind/bind.go index e6a22121d4..4347ba8169 100644 --- a/accounts/abi/bind/bind.go +++ b/accounts/abi/bind/bind.go @@ -262,7 +262,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string] } // Parse library references. for pattern, name := range libs { - matched, err := regexp.Match("__\\$"+pattern+"\\$__", []byte(contracts[types[i]].InputBin)) + matched, err := regexp.MatchString("__\\$"+pattern+"\\$__", contracts[types[i]].InputBin) if err != nil { log.Error("Could not search for pattern", "pattern", pattern, "contract", contracts[types[i]], "err", err) } diff --git a/accounts/abi/event_test.go b/accounts/abi/event_test.go index 1da8c9dae1..63f9fb2ffe 100644 --- a/accounts/abi/event_test.go +++ b/accounts/abi/event_test.go @@ -341,7 +341,6 @@ func TestEventTupleUnpack(t *testing.T) { for _, tc := range testCases { assert := assert.New(t) - tc := tc t.Run(tc.name, func(t *testing.T) { err := unpackTestEventData(tc.dest, tc.data, tc.jsonLog, assert) if tc.error == "" { diff --git a/accounts/abi/pack_test.go b/accounts/abi/pack_test.go index 99bf47200e..c76866c369 100644 --- a/accounts/abi/pack_test.go +++ b/accounts/abi/pack_test.go @@ -44,7 +44,6 @@ import ( func TestPack(t *testing.T) { t.Parallel() for i, test := range packUnpackTests { - i, test := i, test t.Run(strconv.Itoa(i), func(t *testing.T) { t.Parallel() encb, err := hex.DecodeString(test.packed) diff --git a/accounts/abi/reflect_test.go b/accounts/abi/reflect_test.go index 5d90cdb763..624032968d 100644 --- a/accounts/abi/reflect_test.go +++ b/accounts/abi/reflect_test.go @@ -182,7 +182,6 @@ var reflectTests = []reflectTest{ func TestReflectNameToStruct(t *testing.T) { t.Parallel() for _, test := range reflectTests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() m, err := mapArgNamesToStructFields(test.args, reflect.ValueOf(test.struc)) diff --git a/accounts/abi/topics_test.go b/accounts/abi/topics_test.go index 691c2c09dc..cf9ca32b4f 100644 --- a/accounts/abi/topics_test.go +++ b/accounts/abi/topics_test.go @@ -147,7 +147,6 @@ func TestMakeTopics(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got, err := MakeTopics(tt.args.query...) @@ -383,7 +382,6 @@ func TestParseTopics(t *testing.T) { tests := setupTopicsTests() for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() createObj := tt.args.createObj() @@ -403,7 +401,6 @@ func TestParseTopicsIntoMap(t *testing.T) { tests := setupTopicsTests() for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() outMap := make(map[string]interface{}) diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index 2454bde1fb..ae55cf3250 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -399,7 +399,6 @@ func TestMethodMultiReturn(t *testing.T) { "Can not unpack into a slice with wrong types", }} for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { require := require.New(t) err := abi.UnpackIntoInterface(tc.dest, "multi", data) @@ -957,7 +956,7 @@ func TestOOMMaliciousInput(t *testing.T) { } encb, err := hex.DecodeString(test.enc) if err != nil { - t.Fatalf("invalid hex: %s" + test.enc) + t.Fatalf("invalid hex: %s", test.enc) } _, err = abi.Methods["method"].Outputs.UnpackValues(encb) if err == nil { diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 95e703c5ad..63fb388c4b 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -291,7 +291,6 @@ func TestBlockChainOfflinePruningUngracefulShutdown(t *testing.T) { return createBlockChain(db, pruningConfig, gspec, lastAcceptedHash) } for _, tt := range tests { - tt := tt t.Run(tt.Name, func(t *testing.T) { t.Parallel() tt.testFunc(t, create) diff --git a/core/predicate_check_test.go b/core/predicate_check_test.go index 949253ece4..de942c1a70 100644 --- a/core/predicate_check_test.go +++ b/core/predicate_check_test.go @@ -293,7 +293,6 @@ func TestCheckPredicate(t *testing.T) { expectedErr: ErrIntrinsicGas, }, } { - test := test t.Run(name, func(t *testing.T) { require := require.New(t) // Create the rules from TestChainConfig and update the predicates based on the test params diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index 0a99d5dfda..3ec409066e 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -291,10 +291,10 @@ func TestBlockReceiptStorage(t *testing.T) { // Insert the receipt slice into the database and check presence WriteReceipts(db, hash, 0, receipts) if rs := ReadReceipts(db, hash, 0, 0, params.TestChainConfig); len(rs) == 0 { - t.Fatalf("no receipts returned") + t.Fatal("no receipts returned") } else { if err := checkReceiptsRLP(rs, receipts); err != nil { - t.Fatalf(err.Error()) + t.Fatal(err) } } // Delete the body and ensure that the receipts are no longer returned (metadata can't be recomputed) @@ -308,7 +308,7 @@ func TestBlockReceiptStorage(t *testing.T) { } // Ensure that receipts without metadata can be returned without the block body too if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil { - t.Fatalf(err.Error()) + t.Fatal(err) } // Sanity check that body and header alone without the receipt is a full purge WriteHeader(db, header) diff --git a/core/types/header_ext.go b/core/types/header_ext.go new file mode 100644 index 0000000000..e680ee7798 --- /dev/null +++ b/core/types/header_ext.go @@ -0,0 +1,36 @@ +// (c) 2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package types + +import ( + "io" + + ethtypes "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" +) + +// HeaderExtra is a struct that contains extra fields used by Avalanche +// in the block header. +type HeaderExtra struct { +} + +func (h *HeaderExtra) EncodeRLP(eth *ethtypes.Header, writer io.Writer) error { + panic("not implemented") +} + +func (h *HeaderExtra) DecodeRLP(eth *ethtypes.Header, stream *rlp.Stream) error { + panic("not implemented") +} + +func (h *HeaderExtra) EncodeJSON(eth *ethtypes.Header) ([]byte, error) { + panic("not implemented") +} + +func (h *HeaderExtra) DecodeJSON(eth *ethtypes.Header, input []byte) error { + panic("not implemented") +} + +func (h *HeaderExtra) PostCopy(dst *ethtypes.Header) { + panic("not implemented") +} diff --git a/core/types/state_account.go b/core/types/state_account.go index 9af3d4ce15..8fe2edf2ff 100644 --- a/core/types/state_account.go +++ b/core/types/state_account.go @@ -46,8 +46,15 @@ var ( type isMultiCoin bool -var IsMultiCoinPayloads = ethtypes.RegisterExtras[isMultiCoin]() +var ( + extras = ethtypes.RegisterExtras[ + ethtypes.NOOPHeaderHooks, *ethtypes.NOOPHeaderHooks, + ethtypes.NOOPBlockBodyHooks, *ethtypes.NOOPBlockBodyHooks, + isMultiCoin, + ]() + IsMultiCoinPayloads = extras.StateAccount +) -func IsMultiCoin(a ethtypes.ExtraPayloadCarrier) bool { - return bool(IsMultiCoinPayloads.FromPayloadCarrier(a)) +func IsMultiCoin(s ethtypes.StateOrSlimAccount) bool { + return bool(IsMultiCoinPayloads.Get(s)) } diff --git a/eth/filters/api.go b/eth/filters/api.go index 6e79f0ddca..1ed17ec6db 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -350,7 +350,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc select { case logs := <-matchedLogs: for _, log := range logs { - log := log notifier.Notify(rpcSub.ID, &log) } case <-rpcSub.Err(): // client send an unsubscribe request diff --git a/go.mod b/go.mod index 7b23e789b0..e498b18a3e 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,13 @@ module github.com/ava-labs/coreth -go 1.22.8 +go 1.23 + +toolchain go1.23.6 require ( github.com/VictoriaMetrics/fastcache v1.12.1 github.com/ava-labs/avalanchego v1.12.1-0.20250107220127-32f58b4fa9c8 - github.com/ava-labs/libevm v1.13.14-0.1.0.rc-2 + github.com/ava-labs/libevm v1.13.14-0.2.0.rc.3 github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 github.com/davecgh/go-spew v1.1.1 github.com/deckarep/golang-set/v2 v2.1.0 diff --git a/go.sum b/go.sum index 2c5b99975c..ee1a057217 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/ava-labs/avalanchego v1.12.1-0.20250107220127-32f58b4fa9c8 h1:qN3MOBHB//Ynhgt5Vys3iVe42Sr0EWSeN18VL3ecXzE= github.com/ava-labs/avalanchego v1.12.1-0.20250107220127-32f58b4fa9c8/go.mod h1:2B7+E5neLvkOr2zursGhebjU26d4AfB7RazPxBs8hHg= -github.com/ava-labs/libevm v1.13.14-0.1.0.rc-2 h1:CVbn0hSsPCl6gCkTCnqwuN4vtJgdVbkCqLXzYAE7qF8= -github.com/ava-labs/libevm v1.13.14-0.1.0.rc-2/go.mod h1:yBctIV/wnxXTF38h95943jvpuk4aj07TrjbpoGor6LQ= +github.com/ava-labs/libevm v1.13.14-0.2.0.rc.3 h1:1CWGo2icnX9dRqGQl7CFywYGIZWxe+ucy0w8NAsVTWE= +github.com/ava-labs/libevm v1.13.14-0.2.0.rc.3/go.mod h1:+Iol+sVQ1KyoBsHf3veyrBmHCXr3xXRWq6ZXkgVfNLU= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/metrics/json_test.go b/metrics/json_test.go index f91fe8cfa5..811bc29f11 100644 --- a/metrics/json_test.go +++ b/metrics/json_test.go @@ -13,7 +13,7 @@ func TestRegistryMarshallJSON(t *testing.T) { r.Register("counter", NewCounter()) enc.Encode(r) if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" { - t.Fatalf(s) + t.Fatal(s) } } diff --git a/nativeasset/contract.go b/nativeasset/contract.go index e08e0d652e..ae14618605 100644 --- a/nativeasset/contract.go +++ b/nativeasset/contract.go @@ -105,35 +105,45 @@ func UnpackNativeAssetCallInput(input []byte) (common.Address, common.Hash, *big // Run implements StatefulPrecompiledContract func (c *NativeAssetCall) Run(accessibleState contract.AccessibleState, caller common.Address, addr common.Address, input []byte, suppliedGas uint64, readOnly bool) (ret []byte, remainingGas uint64, err error) { - if suppliedGas < c.GasCost { + env := accessibleState.GetPrecompileEnv() + if !env.UseGas(c.GasCost) { return nil, 0, vmerrs.ErrOutOfGas } - remainingGas = suppliedGas - c.GasCost + ret, err = c.run(env, accessibleState.GetStateDB(), caller, addr, input, readOnly) + // This precompile will be wrapped in a libevm `legacy` wrapper, which + // allows for the deprecated pattern of returning remaining gas by calling + // env.UseGas() on the difference between gas in and gas out. Since we call + // UseGas() ourselves, we therefore return `suppliedGas` unchanged to stop + // the legacy wrapper from double-counting spends. + return ret, suppliedGas, err +} +// run implements the contract logic, using `env.Gas()` and `env.UseGas()` in +// place of `suppliedGas` and returning `remainingGas`, respectively. This +// avoids mixing gas-accounting patterns when using env.Call(). +func (c *NativeAssetCall) run(env vm.PrecompileEnvironment, stateDB contract.StateDB, caller common.Address, addr common.Address, input []byte, readOnly bool) (ret []byte, err error) { if readOnly { - return nil, remainingGas, vmerrs.ErrExecutionReverted + return nil, vmerrs.ErrExecutionReverted } to, assetID, assetAmount, callData, err := UnpackNativeAssetCallInput(input) if err != nil { log.Debug("unpacking native asset call input failed", "err", err) - return nil, remainingGas, vmerrs.ErrExecutionReverted + return nil, vmerrs.ErrExecutionReverted } - stateDB := accessibleState.GetStateDB() // Note: it is not possible for a negative assetAmount to be passed in here due to the fact that decoding a // byte slice into a *big.Int type will always return a positive value, as documented on [big.Int.SetBytes]. if assetAmount.Sign() != 0 && stateDB.GetBalanceMultiCoin(caller, assetID).Cmp(assetAmount) < 0 { - return nil, remainingGas, vmerrs.ErrInsufficientBalance + return nil, vmerrs.ErrInsufficientBalance } snapshot := stateDB.Snapshot() if !stateDB.Exist(to) { - if remainingGas < c.CallNewAccountGas { - return nil, 0, vmerrs.ErrOutOfGas + if !env.UseGas(c.CallNewAccountGas) { + return nil, vmerrs.ErrOutOfGas } - remainingGas -= c.CallNewAccountGas stateDB.CreateAccount(to) } @@ -141,7 +151,7 @@ func (c *NativeAssetCall) Run(accessibleState contract.AccessibleState, caller c stateDB.SubBalanceMultiCoin(caller, assetID, assetAmount) stateDB.AddBalanceMultiCoin(to, assetID, assetAmount) - ret, remainingGas, err = accessibleState.Call(to, callData, remainingGas, new(uint256.Int), vm.WithUNSAFECallerAddressProxying()) + ret, err = env.Call(to, callData, env.Gas(), new(uint256.Int), vm.WithUNSAFECallerAddressProxying()) // When an error was returned by the EVM or when setting the creation code // above we revert to the snapshot and consume any gas remaining. Additionally @@ -149,13 +159,13 @@ func (c *NativeAssetCall) Run(accessibleState contract.AccessibleState, caller c if err != nil { stateDB.RevertToSnapshot(snapshot) if err != vmerrs.ErrExecutionReverted { - remainingGas = 0 + env.UseGas(env.Gas()) } // TODO: consider clearing up unused snapshots: //} else { // evm.StateDB.DiscardSnapshot(snapshot) } - return ret, remainingGas, err + return ret, err } type DeprecatedContract struct{} diff --git a/nativeasset/contract_test.go b/nativeasset/contract_test.go index 06e0636687..6fffff880d 100644 --- a/nativeasset/contract_test.go +++ b/nativeasset/contract_test.go @@ -239,8 +239,8 @@ func TestStatefulPrecompile(t *testing.T) { precompileAddr: NativeAssetCallAddr, input: PackNativeAssetCallInput(userAddr2, assetID, big.NewInt(50), nil), value: big0, - gasInput: params.AssetCallApricot + params.CallNewAccountGas, - expectedGasRemaining: 0, + gasInput: params.AssetCallApricot + params.CallNewAccountGas + 123, + expectedGasRemaining: 123, expectedErr: nil, expectedResult: nil, name: "native asset call: multicoin transfer", @@ -459,7 +459,7 @@ func TestStatefulPrecompile(t *testing.T) { evm := vm.NewEVM(vmCtx, vm.TxContext{}, stateDB, params.TestApricotPhase5Config, vm.Config{}) // Use ApricotPhase5Config because these precompiles are deprecated in ApricotPhase6. ret, gasRemaining, err := evm.Call(vm.AccountRef(test.from), test.precompileAddr, test.input, test.gasInput, test.value) // Place gas remaining check before error check, so that it is not skipped when there is an error - assert.Equal(t, test.expectedGasRemaining, gasRemaining, "unexpected gas remaining") + assert.Equalf(t, test.expectedGasRemaining, gasRemaining, "unexpected gas remaining (%d of %d)", gasRemaining, test.gasInput) if test.expectedErr != nil { assert.Equal(t, test.expectedErr, err, "expected error to match") diff --git a/params/config_extra.go b/params/config_extra.go index a9e5b0bdd9..17cee401e0 100644 --- a/params/config_extra.go +++ b/params/config_extra.go @@ -59,10 +59,10 @@ func SetEthUpgrades(c *ChainConfig) { } func GetExtra(c *ChainConfig) *extras.ChainConfig { - ex := payloads.FromChainConfig(c) + ex := payloads.ChainConfig.Get(c) if ex == nil { ex = &extras.ChainConfig{} - payloads.SetOnChainConfig(c, ex) + payloads.ChainConfig.Set(c, ex) } return ex } @@ -75,7 +75,7 @@ func Copy(c *ChainConfig) ChainConfig { // WithExtra sets the extra payload on `c` and returns the modified argument. func WithExtra(c *ChainConfig, extra *extras.ChainConfig) *ChainConfig { - payloads.SetOnChainConfig(c, extra) + payloads.ChainConfig.Set(c, extra) return c } diff --git a/params/hooks_libevm.go b/params/hooks_libevm.go index b26a7a36b3..8df5c9c5d0 100644 --- a/params/hooks_libevm.go +++ b/params/hooks_libevm.go @@ -16,14 +16,14 @@ import ( "github.com/ava-labs/libevm/common" "github.com/ava-labs/libevm/core/vm" "github.com/ava-labs/libevm/libevm" - "github.com/holiman/uint256" + "github.com/ava-labs/libevm/libevm/legacy" "golang.org/x/exp/maps" ) type RulesExtra extras.Rules func GetRulesExtra(r Rules) *extras.Rules { - rules := payloads.PointerFromRules(&r) + rules := payloads.Rules.GetPointer(&r) return (*extras.Rules)(rules) } @@ -125,7 +125,7 @@ func makePrecompile(contract contract.StatefulPrecompiledContract) libevm.Precom } return contract.Run(accessableState, env.Addresses().Caller, env.Addresses().Self, input, suppliedGas, env.ReadOnly()) } - return vm.NewStatefulPrecompile(run) + return vm.NewStatefulPrecompile(legacy.PrecompiledStatefulContract(run).Upgrade()) } func (r RulesExtra) PrecompileOverride(addr common.Address) (libevm.PrecompiledContract, bool) { @@ -171,8 +171,8 @@ func (a accessableState) GetSnowContext() *snow.Context { return GetExtra(a.env.ChainConfig()).SnowCtx } -func (a accessableState) Call(addr common.Address, input []byte, gas uint64, value *uint256.Int, opts ...vm.CallOption) (ret []byte, gasRemaining uint64, _ error) { - return a.env.Call(addr, input, gas, value, opts...) +func (a accessableState) GetPrecompileEnv() vm.PrecompileEnvironment { + return a.env } type precompileBlockContext struct { diff --git a/plugin/evm/prestate_tracer_test.go b/plugin/evm/prestate_tracer_test.go index 029abac932..8de9762efa 100644 --- a/plugin/evm/prestate_tracer_test.go +++ b/plugin/evm/prestate_tracer_test.go @@ -38,7 +38,6 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) { if !strings.HasSuffix(file.Name(), ".json") { continue } - file := file // capture range variable t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) { t.Parallel() diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index b1acd489b6..5f56e69c87 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -1137,7 +1137,6 @@ func TestConflictingImportTxsAcrossBlocks(t *testing.T) { "apricotPhase4": genesisJSONApricotPhase4, "apricotPhase5": genesisJSONApricotPhase5, } { - genesis := genesis t.Run(name, func(t *testing.T) { testConflictingImportTxs(t, genesis) }) diff --git a/precompile/contract/interfaces.go b/precompile/contract/interfaces.go index 7de1423a02..db3da9f184 100644 --- a/precompile/contract/interfaces.go +++ b/precompile/contract/interfaces.go @@ -61,7 +61,7 @@ type AccessibleState interface { GetBlockContext() BlockContext GetSnowContext() *snow.Context GetChainConfig() precompileconfig.ChainConfig - Call(addr common.Address, input []byte, gas uint64, value *uint256.Int, opts ...vm.CallOption) (ret []byte, gasRemaining uint64, _ error) + GetPrecompileEnv() vm.PrecompileEnvironment } // ConfigurationBlockContext defines the interface required to configure a precompile. diff --git a/precompile/contract/mocks.go b/precompile/contract/mocks.go index 6a83011623..812dc2d23f 100644 --- a/precompile/contract/mocks.go +++ b/precompile/contract/mocks.go @@ -305,27 +305,6 @@ func (m *MockAccessibleState) EXPECT() *MockAccessibleStateMockRecorder { return m.recorder } -// Call mocks base method. -func (m *MockAccessibleState) Call(addr common.Address, input []byte, gas uint64, value *uint256.Int, opts ...vm.CallOption) ([]byte, uint64, error) { - m.ctrl.T.Helper() - varargs := []any{addr, input, gas, value} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Call", varargs...) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(uint64) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// Call indicates an expected call of Call. -func (mr *MockAccessibleStateMockRecorder) Call(addr, input, gas, value any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{addr, input, gas, value}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Call", reflect.TypeOf((*MockAccessibleState)(nil).Call), varargs...) -} - // GetBlockContext mocks base method. func (m *MockAccessibleState) GetBlockContext() BlockContext { m.ctrl.T.Helper() @@ -354,6 +333,20 @@ func (mr *MockAccessibleStateMockRecorder) GetChainConfig() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChainConfig", reflect.TypeOf((*MockAccessibleState)(nil).GetChainConfig)) } +// GetPrecompileEnv mocks base method. +func (m *MockAccessibleState) GetPrecompileEnv() vm.PrecompileEnvironment { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPrecompileEnv") + ret0, _ := ret[0].(vm.PrecompileEnvironment) + return ret0 +} + +// GetPrecompileEnv indicates an expected call of GetPrecompileEnv. +func (mr *MockAccessibleStateMockRecorder) GetPrecompileEnv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPrecompileEnv", reflect.TypeOf((*MockAccessibleState)(nil).GetPrecompileEnv)) +} + // GetSnowContext mocks base method. func (m *MockAccessibleState) GetSnowContext() *snow.Context { m.ctrl.T.Helper() diff --git a/rpc/client_test.go b/rpc/client_test.go index 6a13e487da..826d1eed48 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -723,7 +723,6 @@ func TestClientHTTP(t *testing.T) { ) defer client.Close() for i := range results { - i := i go func() { errc <- client.Call(&results[i], "test_echo", wantResult.String, wantResult.Int, wantResult.Args) }() diff --git a/rpc/types_test.go b/rpc/types_test.go index 824c1c8155..d37632d62e 100644 --- a/rpc/types_test.go +++ b/rpc/types_test.go @@ -145,7 +145,6 @@ func TestBlockNumberOrHash_WithNumber_MarshalAndUnmarshal(t *testing.T) { {"earliest", int64(EarliestBlockNumber)}, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { bnh := BlockNumberOrHashWithNumber(BlockNumber(test.number)) marshalled, err := json.Marshal(bnh) diff --git a/scripts/eth-allowed-packages.txt b/scripts/eth-allowed-packages.txt index 6f69e52bcd..0f200f77f5 100644 --- a/scripts/eth-allowed-packages.txt +++ b/scripts/eth-allowed-packages.txt @@ -25,6 +25,7 @@ "github.com/ava-labs/libevm/ethdb/pebble" "github.com/ava-labs/libevm/event" "github.com/ava-labs/libevm/libevm" +"github.com/ava-labs/libevm/libevm/legacy" "github.com/ava-labs/libevm/libevm/stateconf" "github.com/ava-labs/libevm/log" "github.com/ava-labs/libevm/params"