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

Modify the batch poster to support the delay buffer feature #2758

Open
wants to merge 13 commits into
base: bold-review
Choose a base branch
from

Conversation

gligneul
Copy link
Contributor

This PR introduces the delay buffer from the sequencer inbox to the batch poster. The delay buffer is a feature that limits repeated sequencer censorship while maintaining the property that allows the sequencer to recover after an outage.

At the high level, we want to achieve two things. The first is ensuring the batch poster posts batches often enough not to consume blocks from the delay buffer. The second is modifying the batch poster to post delay proofs when a batch contains a delayed message.

An immutable field called isDelayBufferable is in the sequencer inbox to indicate whether the delay buffer is enabled. We use this field to enable or disable the delay buffer feature in the batch poster. When getting this field, if the EVM returns an execution error, the batch poster assumes it is using an old version of the contracts.

When creating a batch, if the delay buffer is enabled, the batch contains a delayed message, and the time since the first delayed message is greater than the threshold, then the batch poster posts the batch immediately. We do this to ensure we are not consuming from the delay buffer.

If the batch contains a delayed message, the batch poster includes a delay proof when submitting it. A delay proof contains the accumulator hash of the last accepted delayed message and the current batch's first delayed message. The batch poster stores the contents of the first delayed message in the batchSegments structure to reference it later. Then, depending on whether the batch contains a delayed message, it calls the corresponding contract method in the encodeAddBatch function.

The delay buffer system tests use the BoLD version of the contracts, so this PR also adds initial support for them in the NodeBuilder. All other tests are left unmodified and use the legacy version of the contracts.

Close NIT-2510

Get the delay message accumulator from the previous message.
* Test batch poster without delay buffer works
* Test delay buffer don't force batch without delayed messages
Rebase the delay buffer PR on top of BoLD's little merge. Then, use the
BoLD version of the contracts when appropriate instead of using the
delay-buffer development branch.
@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Oct 28, 2024
@gligneul
Copy link
Contributor Author

The tests are failing because of the base branch (bold-review). Locally, the delay-buffer tests are passing, so I'm setting this PR as ready to review.

@gligneul gligneul marked this pull request as ready for review October 28, 2024 22:02
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

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

I think this looks like a very good PR.

@@ -0,0 +1,321 @@
package deploy
Copy link
Member

Choose a reason for hiding this comment

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

Missing copyright header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants