mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-31 20:18:37 +00:00
nits
This commit is contained in:
parent
33f77c4d7c
commit
e2ef91d106
1 changed files with 13 additions and 10 deletions
|
|
@ -46,6 +46,7 @@ func ExecuteStateless(ctx context.Context, config *params.ChainConfig, vmconfig
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a blockchain that is idle, but can be used to access headers through
|
// Create a blockchain that is idle, but can be used to access headers through
|
||||||
engine := beacon.New(ethash.NewFaker())
|
engine := beacon.New(ethash.NewFaker())
|
||||||
chain := &HeaderChain{
|
chain := &HeaderChain{
|
||||||
|
|
@ -54,24 +55,26 @@ func ExecuteStateless(ctx context.Context, config *params.ChainConfig, vmconfig
|
||||||
headerCache: lru.NewCache[common.Hash, *types.Header](256),
|
headerCache: lru.NewCache[common.Hash, *types.Header](256),
|
||||||
engine: engine,
|
engine: engine,
|
||||||
}
|
}
|
||||||
// Verify the block header against the parent header from the witness
|
|
||||||
if err := engine.VerifyHeader(chain, block.Header()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
processor := NewStateProcessor(chain)
|
processor := NewStateProcessor(chain)
|
||||||
validator := NewBlockValidator(config)
|
validator := NewBlockValidator(config)
|
||||||
|
|
||||||
// Verify the block body (transactions, withdrawals, blob gas) against the header
|
// Pre-execution: Verify the block header against the parent header
|
||||||
|
if err := engine.VerifyHeader(chain, block.Header()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pre-execution: Verify the block body against the header
|
||||||
if err := validator.ValidateBody(block); err != nil {
|
if err := validator.ValidateBody(block); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Run the stateless block processing and self-validate all fields
|
|
||||||
|
// Process the block by executing all transactions
|
||||||
res, err := processor.Process(ctx, block, db, vmconfig)
|
res, err := processor.Process(ctx, block, db, vmconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err = validator.ValidateState(block, db, res); err != nil {
|
|
||||||
return err
|
// Post-execution: Validate gas, bloom, receipts, state root and
|
||||||
}
|
// other post execution artifacts
|
||||||
return nil
|
return validator.ValidateState(block, db, res)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue