Skip to content
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

Merged
merged 3 commits into from
Feb 6, 2024

Conversation

gballet
Copy link
Owner

@gballet gballet commented Feb 5, 2024

This is a rewrite of eip 2935 after it was suggested to simply insert all block hash values at fork time, instead of reading the 256th ancestor and using a complex fallback mechanism.

@@ -184,6 +184,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
misc.ApplyDAOHardFork(statedb)
}
if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) {
// XXX figure out what to do for older hashes?
Copy link
Owner Author

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.

@@ -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()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't say if !... ?

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())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't say: ancestor = chain.GetHeader(ancestor.ParentHash, ancestor.Number.Uint64()-1)?

Or also ancestor = chain.GetHeader(ancestor.ParentHash, i-1)

@gballet gballet marked this pull request as ready for review February 6, 2024 08:48
@gballet gballet merged commit 0b110bd into kaustinen-with-shapella Feb 6, 2024
2 of 3 checks passed
gballet added a commit that referenced this pull request May 7, 2024
* eip2935 redesign: only read target block hash

* review fixes

* fix: t8n tool
gballet added a commit that referenced this pull request May 8, 2024
* eip2935 redesign: only read target block hash

* review fixes

* fix: t8n tool
gballet added a commit that referenced this pull request May 8, 2024
* eip2935 redesign: only read target block hash

* review fixes

* fix: t8n tool
gballet added a commit that referenced this pull request May 8, 2024
* eip2935 redesign: only read target block hash

* review fixes

* fix: t8n tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants