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 <omerfirmak@users.noreply.github.com>
This commit is contained in:
Ömer Faruk Irmak 2025-02-21 17:07:18 +03:00 committed by GitHub
parent b4f36b2489
commit 684383275b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 3 deletions

View file

@ -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,

View file

@ -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
)

View file

@ -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()