From bfa7abcc50c1eef411042e578f41bf37686cd667 Mon Sep 17 00:00:00 2001 From: georgehao Date: Wed, 28 Feb 2024 09:45:38 +0800 Subject: [PATCH] feat: add metric to evm call (#646) * feat: add metric to evm * feat: bump version --- core/state_transition.go | 6 ++++++ params/version.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/state_transition.go b/core/state_transition.go index 4fefc89d4324..7e7f0d8af592 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -20,6 +20,7 @@ import ( "fmt" "math" "math/big" + "time" "github.com/scroll-tech/go-ethereum/common" cmath "github.com/scroll-tech/go-ethereum/common/math" @@ -27,11 +28,14 @@ import ( "github.com/scroll-tech/go-ethereum/core/vm" "github.com/scroll-tech/go-ethereum/crypto/codehash" "github.com/scroll-tech/go-ethereum/log" + "github.com/scroll-tech/go-ethereum/metrics" "github.com/scroll-tech/go-ethereum/params" ) var emptyKeccakCodeHash = codehash.EmptyKeccakCodeHash +var evmCallExecutionTimer = metrics.NewRegisteredTimer("evm/call/execution", nil) + /* The State Transitioning Model @@ -384,7 +388,9 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } else { // Increment the nonce for the next transaction st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1) + evmCallStart := time.Now() ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value) + evmCallExecutionTimer.Update(time.Since(evmCallStart)) } // no refunds for l1 messages diff --git a/params/version.go b/params/version.go index 5d87647cdee3..04cfba1a6912 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 1 // Minor version component of the current release - VersionPatch = 17 // Patch version component of the current release + VersionPatch = 18 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )