Skip to content

Commit bfa7abc

Browse files
authored
feat: add metric to evm call (#646)
* feat: add metric to evm * feat: bump version
1 parent 989639a commit bfa7abc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/state_transition.go

+6
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@ import (
2020
"fmt"
2121
"math"
2222
"math/big"
23+
"time"
2324

2425
"github.com/scroll-tech/go-ethereum/common"
2526
cmath "github.com/scroll-tech/go-ethereum/common/math"
2627
"github.com/scroll-tech/go-ethereum/core/types"
2728
"github.com/scroll-tech/go-ethereum/core/vm"
2829
"github.com/scroll-tech/go-ethereum/crypto/codehash"
2930
"github.com/scroll-tech/go-ethereum/log"
31+
"github.com/scroll-tech/go-ethereum/metrics"
3032
"github.com/scroll-tech/go-ethereum/params"
3133
)
3234

3335
var emptyKeccakCodeHash = codehash.EmptyKeccakCodeHash
3436

37+
var evmCallExecutionTimer = metrics.NewRegisteredTimer("evm/call/execution", nil)
38+
3539
/*
3640
The State Transitioning Model
3741
@@ -384,7 +388,9 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
384388
} else {
385389
// Increment the nonce for the next transaction
386390
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
391+
evmCallStart := time.Now()
387392
ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value)
393+
evmCallExecutionTimer.Update(time.Since(evmCallStart))
388394
}
389395

390396
// no refunds for l1 messages

params/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 1 // Minor version component of the current release
27-
VersionPatch = 17 // Patch version component of the current release
27+
VersionPatch = 18 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)