From 684383275b2e0a00c6d3e4f67c6764c88c44bebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20Irmak?= Date: Fri, 21 Feb 2025 17:07:18 +0300 Subject: [PATCH] fix: post-euclid block tracing (#1119) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: post euclid debugs tracers * fix: disallow tracing post-euclid blocks with scroll specific RPC methods * fix panic when tracing pre-euclid blocks on mpt nodes * fix: scroll tracing on mpt nodes * chore: auto version bump [bot] --------- Co-authored-by: omerfirmak --- core/vm/logger_trace.go | 10 ++++++++-- params/version.go | 2 +- rollup/tracing/tracing.go | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/core/vm/logger_trace.go b/core/vm/logger_trace.go index 39f89286c0..72b893222d 100644 --- a/core/vm/logger_trace.go +++ b/core/vm/logger_trace.go @@ -47,10 +47,16 @@ func traceLastNAddressCode(n int) traceFunc { func traceCodeWithAddress(l *StructLogger, address common.Address) { code := l.env.StateDB.GetCode(address) + keccakCodeHash := l.env.StateDB.GetKeccakCodeHash(address) - poseidonCodeHash := l.env.StateDB.GetPoseidonCodeHash(address) + codeHash := keccakCodeHash + poseidonCodeHash := common.Hash{} + if !l.env.chainRules.IsEuclid && l.env.chainConfig.Scroll.UseZktrie { + poseidonCodeHash = l.env.StateDB.GetPoseidonCodeHash(address) + codeHash = poseidonCodeHash + } codeSize := l.env.StateDB.GetCodeSize(address) - l.bytecodes[poseidonCodeHash] = CodeInfo{ + l.bytecodes[codeHash] = CodeInfo{ codeSize, keccakCodeHash, poseidonCodeHash, diff --git a/params/version.go b/params/version.go index 8f45867a88..b85c4244ad 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 = 8 // Minor version component of the current release - VersionPatch = 8 // Patch version component of the current release + VersionPatch = 9 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string ) diff --git a/rollup/tracing/tracing.go b/rollup/tracing/tracing.go index 3cd7814924..0658bdb36b 100644 --- a/rollup/tracing/tracing.go +++ b/rollup/tracing/tracing.go @@ -182,6 +182,14 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext core.ChainCont } func (env *TraceEnv) GetBlockTrace(block *types.Block) (*types.BlockTrace, error) { + if !env.chainConfig.Scroll.UseZktrie { + return nil, errors.New("scroll tracing methods are not available on MPT-enabled nodes") + } + + if env.chainConfig.IsEuclid(block.Time()) { + return nil, errors.New("cannot trace post euclid blocks with scroll specific RPC methods") + } + // Execute all the transaction contained within the block concurrently var ( txs = block.Transactions()