Skip to content

Commit 6843832

Browse files
authored
fix: post-euclid block tracing (#1119)
* 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 <[email protected]>
1 parent b4f36b2 commit 6843832

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

core/vm/logger_trace.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ func traceLastNAddressCode(n int) traceFunc {
4747

4848
func traceCodeWithAddress(l *StructLogger, address common.Address) {
4949
code := l.env.StateDB.GetCode(address)
50+
5051
keccakCodeHash := l.env.StateDB.GetKeccakCodeHash(address)
51-
poseidonCodeHash := l.env.StateDB.GetPoseidonCodeHash(address)
52+
codeHash := keccakCodeHash
53+
poseidonCodeHash := common.Hash{}
54+
if !l.env.chainRules.IsEuclid && l.env.chainConfig.Scroll.UseZktrie {
55+
poseidonCodeHash = l.env.StateDB.GetPoseidonCodeHash(address)
56+
codeHash = poseidonCodeHash
57+
}
5258
codeSize := l.env.StateDB.GetCodeSize(address)
53-
l.bytecodes[poseidonCodeHash] = CodeInfo{
59+
l.bytecodes[codeHash] = CodeInfo{
5460
codeSize,
5561
keccakCodeHash,
5662
poseidonCodeHash,

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 = 8 // Minor version component of the current release
27-
VersionPatch = 8 // Patch version component of the current release
27+
VersionPatch = 9 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

rollup/tracing/tracing.go

+8
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext core.ChainCont
182182
}
183183

184184
func (env *TraceEnv) GetBlockTrace(block *types.Block) (*types.BlockTrace, error) {
185+
if !env.chainConfig.Scroll.UseZktrie {
186+
return nil, errors.New("scroll tracing methods are not available on MPT-enabled nodes")
187+
}
188+
189+
if env.chainConfig.IsEuclid(block.Time()) {
190+
return nil, errors.New("cannot trace post euclid blocks with scroll specific RPC methods")
191+
}
192+
185193
// Execute all the transaction contained within the block concurrently
186194
var (
187195
txs = block.Transactions()

0 commit comments

Comments
 (0)