From b64b3fdd84a504448745f839bbfe78b2f73aec5a Mon Sep 17 00:00:00 2001 From: evgeniy-scherbina Date: Wed, 29 May 2024 14:37:17 -0400 Subject: [PATCH] CR's fixes --- go.mod | 2 +- x/evm/keeper/msg_server.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 977da70281..3005578e0c 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/holiman/uint256 v1.2.1 github.com/improbable-eng/grpc-web v0.15.0 github.com/onsi/ginkgo/v2 v2.9.1 github.com/onsi/gomega v1.27.4 @@ -142,6 +141,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect + github.com/holiman/uint256 v1.2.1 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/huin/goupnp v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index afc42dc55f..7c8746d4bf 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -192,23 +192,23 @@ func (k *Keeper) updatePrecompiles(ctx sdk.Context, newEnabledPrecompiles []stri continue } - // Set the nonce of the precompile's address (as is done when a contract is created) to ensure - // that it is marked as non-empty and will not be cleaned up when the statedb is finalized. err := k.SetAccount(ctx, addr, statedb.Account{ + // Set the nonce of the precompile's address (as is done when a contract is created) to ensure + // that it is marked as non-empty and will not be cleaned up when the statedb is finalized. Nonce: PrecompileNonce, Balance: big.NewInt(0), + // Set the code of the precompile's address to a non-zero length byte slice to ensure that the precompile + // can be called from within Solidity contracts. Solidity adds a check before invoking a contract to ensure + // that it does not attempt to invoke a non-existent contract. CodeHash: PrecompileCodeHash[:], }) if err != nil { return err } - - // Set the code of the precompile's address to a non-zero length byte slice to ensure that the precompile - // can be called from within Solidity contracts. Solidity adds a check before invoking a contract to ensure - // that it does not attempt to invoke a non-existent contract. - k.SetCode(ctx, PrecompileCodeHash[:], PrecompileCode) } + k.SetCode(ctx, PrecompileCodeHash[:], PrecompileCode) + // uninitialize disabled precompiles for _, hexAddr := range oldEnabledPrecompiles { addr := common.HexToAddress(hexAddr)