-
Notifications
You must be signed in to change notification settings - Fork 34
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
[GWYNETH] reorg support #48
base: gwyneth
Are you sure you want to change the base?
Conversation
crates/gwyneth/src/exex.rs
Outdated
if let Some(block_hash) = l2_block_hash { | ||
self.engine_api.update_forkchoice(block_hash, block_hash).await?; | ||
} else { | ||
return Err(eyre::eyre!("No suitable L2 block found for revert")); |
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.
No need to error out because simply no L2 block proposed in the reorg range?
@@ -71,6 +81,7 @@ pub struct Rollup<Node: reth_node_api::FullNodeComponents> { | |||
ctx: ExExContext<Node>, | |||
node: GwynethFullNode, | |||
engine_api: EngineApiContext<GwynethEngineTypes>, | |||
l1_l2_ring_buffer: VecDeque<L1L2Mapping>, |
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.
Maybe can also just use an array/vec of constant RING_BUFFER_SIZE
size, and then index into this array as l1_block_number % RING_BUFFER_SIZE
. Might be easier, don't know.
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.
I'd use VecDeque rather, cause it works well for ring buffers. Using pop_front() & push_back()
, so the placement of blocks for caching is contagious.
With %, you need to deal with edge cases. (E.g.: you are in the "bucket" of 127, and you need to reorg. But in the last 127 blocks there were no L2 block, so then you need to go till the 128, so basically traverse backwards and found the proper L2 info. With VecDequeue you just need to go backwards till the L1_saved < L1 reorged).
No description provided.