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

save overlay conversion iterator pointers at each block #298

Closed

Conversation

gballet
Copy link
Owner

@gballet gballet commented Oct 26, 2023

This is in preparation for the shadow fork. It appeared, while performing the overlay transition with Kaustinen rebased on shapella, that the conversion at a slot after genesis got broken. Bugs happened because the transition was executed multiple times at the same block height, but the iterator pointers were not rewound.

This PR introduces per-block iterator pointers. More exactly, iterator pointers are related to the state root hash of the parent of the block that uses these iterators. If a block is reexecuted multiple times, then the pointers that are used will be initialized with how they were when that parent block was sealed.

The choice of linking the iterator pointers to the parent root hash instead of e.g. the slot number, comes from the fact that it's simpler to code. We might (probably will, in fact) change that after some refactoring, e.g. a rebase of the kaustinen branch on top of PBSS. Right now, this should be good enough for a reorg-less shadowfork.

@@ -64,37 +64,37 @@ type Database interface {
// TrieDB retrieves the low level trie database used for data storage.
TrieDB() *trie.Database

StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, cancunTime *uint64)
StartVerkleTransition(originalRoot common.Hash, chainConfig *params.ChainConfig, cancunTime *uint64, root common.Hash)
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: see if originalRoot and root can be merged into a single value. It should be possible as the verkle transition is only started at a given block height, which is the one at the fork.

CurrentAccountAddress: map[common.Hash]*common.Address{},
CurrentSlotHash: map[common.Hash]common.Hash{},
CurrentPreimageOffset: map[common.Hash]int64{}, started: map[common.Hash]bool{},
ended: map[common.Hash]bool{},
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO check that the proper value will be set when transitioning at genesis

CurrentSlotHash: map[common.Hash]common.Hash{},
CurrentPreimageOffset: map[common.Hash]int64{},
started: map[common.Hash]bool{},
ended: map[common.Hash]bool{},
Copy link
Owner Author

Choose a reason for hiding this comment

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

same here

@gballet gballet marked this pull request as draft October 26, 2023 16:16
@gballet
Copy link
Owner Author

gballet commented Jan 27, 2024

superseded by #304, closing

@gballet gballet closed this Jan 27, 2024
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.

1 participant