mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
fix: avoid using snapshots when generating witness (#1116)
This commit is contained in:
parent
b56dd9f31b
commit
127845d3d0
2 changed files with 8 additions and 3 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue