-
Notifications
You must be signed in to change notification settings - Fork 21.5k
all: implement EIP-6110, execution layer triggered deposits #29431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,14 +121,17 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { | |
|
|
||
| // ValidateState validates the various changes that happen after a state transition, | ||
| // such as amount of used gas, the receipt roots and the state root itself. | ||
| func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, receipts types.Receipts, usedGas uint64, stateless bool) error { | ||
| func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, res *ProcessResult, stateless bool) error { | ||
| if res == nil { | ||
| return fmt.Errorf("nil ProcessResult value") | ||
| } | ||
| header := block.Header() | ||
| if block.GasUsed() != usedGas { | ||
| return fmt.Errorf("invalid gas used (remote: %d local: %d)", block.GasUsed(), usedGas) | ||
| if block.GasUsed() != res.GasUsed { | ||
| return fmt.Errorf("invalid gas used (remote: %d local: %d)", block.GasUsed(), res.GasUsed) | ||
| } | ||
| // Validate the received block's bloom with the one derived from the generated receipts. | ||
| // For valid blocks this should always validate to true. | ||
| rbloom := types.CreateBloom(receipts) | ||
| rbloom := types.CreateBloom(res.Receipts) | ||
| if rbloom != header.Bloom { | ||
| return fmt.Errorf("invalid bloom (remote: %x local: %x)", header.Bloom, rbloom) | ||
| } | ||
|
|
@@ -138,10 +141,17 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD | |
| return nil | ||
| } | ||
| // The receipt Trie's root (R = (Tr [[H1, R1], ... [Hn, Rn]])) | ||
| receiptSha := types.DeriveSha(receipts, trie.NewStackTrie(nil)) | ||
| receiptSha := types.DeriveSha(res.Receipts, trie.NewStackTrie(nil)) | ||
| if receiptSha != header.ReceiptHash { | ||
| return fmt.Errorf("invalid receipt root hash (remote: %x local: %x)", header.ReceiptHash, receiptSha) | ||
| } | ||
| // Validate the parsed requests match the expected header value. | ||
| if header.RequestsHash != nil { | ||
| depositSha := types.DeriveSha(res.Requests, trie.NewStackTrie(nil)) | ||
| if depositSha != *header.RequestsHash { | ||
| return fmt.Errorf("invalid deposit root hash (remote: %x local: %x)", *header.RequestsHash, depositSha) | ||
|
||
| } | ||
| } | ||
| // Validate the state root against the received state root and throw | ||
| // an error if they don't match. | ||
| if root := statedb.IntermediateRoot(v.config.IsEIP158(header.Number)); header.Root != root { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.