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

feat: enforced batch mode #68

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: enforced batch mode #68

wants to merge 3 commits into from

Conversation

zimpha
Copy link
Member

@zimpha zimpha commented Dec 5, 2024

No description provided.

@zimpha zimpha force-pushed the feat/enforced-batch branch from 8612778 to aee35b9 Compare December 5, 2024 05:31
@Thegaram Thegaram changed the title feat: enforces batch feat: enforced batch mode Dec 5, 2024
@zimpha zimpha force-pushed the feat/enforced-batch branch from aee35b9 to d851e8e Compare December 5, 2024 12:15
@zimpha zimpha marked this pull request as ready for review December 11, 2024 11:34
Copy link

@jonastheis jonastheis left a comment

Choose a reason for hiding this comment

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

LGTM!

with the new batch design this will need to change again but the main mechanism of

  1. track time of latest finalized batch
  2. if too much time elapsed allow anyone to commit batch + proof and disallow sequencer to submit via usual methods
  3. only allow security council to deactivate this enforced/permissionless mode

should stay the same and just the interface of what/how a batch needs to be passed should change.

@@ -46,6 +46,15 @@ library BatchHeaderV3Codec {
}
}

/// @notice Get the blob versioned hash of the batch header.

Choose a reason for hiding this comment

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

wrong comment

@@ -172,6 +197,11 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
_;
}

modifier whenEnforcedBatchNotEnable() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
modifier whenEnforcedBatchNotEnable() {
modifier whenEnforcedBatchNotEnabled() {

}
}
// initialize enforcedBatchParameters
enforcedBatchParameters.maxDelayEnterEnforcedMode = _maxDelayEnterEnforcedMode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any way to update this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I assume it won't be updated when we set it. Sure I can add a method to update it.

* Structs *
***********/

struct EnforcedBatchParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this add +1 SSTORE cost for normal commit batch and finalize bundle txs?

Copy link
Member Author

Choose a reason for hiding this comment

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

my guess is about 4600 gas.

// explicit set enforce batch enable
parameters.enforcedModeEnabled = true;
// reset `lastCommittedBatchIndex`
parameters.lastCommittedBatchIndex = uint64(lastFinalizedBatchIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we've discussed this before but I forgot the conclusion; doesn't this make "fast L2 finality" impossible? @jonastheis

In the future with the infallible chain derivation, we could just have a permissionless fallback for batch commitment and finalization (but not need to revert unfinalized batches).

Copy link
Contributor

Choose a reason for hiding this comment

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

Overall looks good, but this will have a lot of conflicts with other changes planned for this upgrade. Do you want to still submit them as separate PRs and then merge them into a single unified PR that we share with the auditors?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I will create a branch and all related PR will merged into this branch.

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.

3 participants