fix: avoid using snapshots when generating witness (#1116)

This commit is contained in:
Ömer Faruk Irmak 2025-02-13 09:56:07 +03:00 committed by GitHub
parent b56dd9f31b
commit 127845d3d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -334,7 +334,11 @@ func (api *PublicDebugAPI) ExecutionWitness(ctx context.Context, blockNrOrHash r
} }
witness, err := generateWitness(api.eth.blockchain, block) witness, err := generateWitness(api.eth.blockchain, block)
return ToExecutionWitness(witness), err if err != nil {
return nil, fmt.Errorf("failed to generate witness: %w", err)
}
return ToExecutionWitness(witness), nil
} }
func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateless.Witness, error) { func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateless.Witness, error) {
@ -344,7 +348,8 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles
} }
parentHeader := witness.Headers[0] parentHeader := witness.Headers[0]
statedb, err := blockchain.StateAt(parentHeader.Root) // Avoid using snapshots to properly collect the witness data for all reads
statedb, err := state.New(parentHeader.Root, blockchain.StateCache(), nil)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to retrieve parent state: %w", err) return nil, fmt.Errorf("failed to retrieve parent state: %w", err)
} }

View file

@ -24,7 +24,7 @@ import (
const ( const (
VersionMajor = 5 // Major version component of the current release VersionMajor = 5 // Major version component of the current release
VersionMinor = 8 // Minor version component of the current release VersionMinor = 8 // Minor version component of the current release
VersionPatch = 5 // Patch version component of the current release VersionPatch = 6 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string VersionMeta = "mainnet" // Version metadata to append to the version string
) )