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

Merged
merged 27 commits into from
Dec 12, 2024

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
eljobe
eljobe previously approved these changes Nov 18, 2024
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.

deploy/legacy.go Outdated Show resolved Hide resolved
Base automatically changed from bold-review to master December 6, 2024 20:04
@PlasmaPower PlasmaPower dismissed eljobe’s stale review December 6, 2024 20:04

The base branch was changed.

eljobe
eljobe previously approved these changes Dec 9, 2024
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.

LGTM

@eljobe eljobe requested a review from PlasmaPower December 9, 2024 02:44
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

I have a couple comments but this generally LGTM

arbnode/batch_poster.go Outdated Show resolved Hide resolved
arbnode/batch_poster.go Outdated Show resolved Hide resolved
This ensures the delay buffer won't be slowly consumed if the threshold
is constantly being reached.
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower PlasmaPower merged commit 918aaf4 into master Dec 12, 2024
15 of 16 checks passed
@PlasmaPower PlasmaPower deleted the gligneul/delay-buffer-bold branch December 12, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved 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.

3 participants