-
Notifications
You must be signed in to change notification settings - Fork 13
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
eip2935 redesign: insert all 256 ancestors upon transition #362
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,12 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg | |
signer = types.MakeSigner(p.config, header.Number, header.Time) | ||
) | ||
if p.config.IsPrague(block.Number(), block.Time()) { | ||
ProcessParentBlockHash(statedb, block.NumberU64()-1, block.ParentHash()) | ||
parent := p.bc.GetBlockByHash(block.ParentHash()) | ||
if p.config.IsPrague(parent.Number(), parent.Time()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't say |
||
InsertBlockHashHistoryAtEip2935Fork(statedb, block.NumberU64()-1, block.ParentHash(), p.bc) | ||
} else { | ||
ProcessParentBlockHash(statedb, block.NumberU64()-1, block.ParentHash()) | ||
} | ||
} | ||
// Iterate over and process the individual transactions | ||
for i, tx := range block.Transactions() { | ||
|
@@ -364,6 +369,14 @@ func (kvm *keyValueMigrator) migrateCollectedKeyValues(tree *trie.VerkleTrie) er | |
return nil | ||
} | ||
|
||
func InsertBlockHashHistoryAtEip2935Fork(statedb *state.StateDB, prevNumber uint64, prevHash common.Hash, chain consensus.ChainHeaderReader) { | ||
ancestor := chain.GetHeader(prevHash, prevNumber) | ||
for i := prevNumber; i > 0 && i >= prevNumber-256; i-- { | ||
ProcessParentBlockHash(statedb, i, ancestor.Hash()) | ||
ancestor = chain.GetHeader(ancestor.ParentHash, ancestor.Number.Uint64()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't say: Or also |
||
} | ||
} | ||
|
||
func ProcessParentBlockHash(statedb *state.StateDB, prevNumber uint64, prevHash common.Hash) { | ||
var key common.Hash | ||
binary.BigEndian.PutUint64(key[24:], prevNumber) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: figure out what to do in this case.