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(protocol): no longer delete commit records #13152

Merged
merged 3 commits into from
Feb 15, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ library LibProposing {

if (state.commits[msg.sender][commitSlot] == hash)
revert L1_COMMITTED();

state.commits[msg.sender][commitSlot] = hash;

emit BlockCommitted({
Expand Down Expand Up @@ -236,9 +237,14 @@ library LibProposing {
})
) revert L1_NOT_COMMITTED();

if (meta.commitSlot == 0) {
// Special handling of slot 0 for refund; non-zero slots
// are supposed to managed by node software for reuse.
if (meta.commitSlot % 2 == 0) {
dantaik marked this conversation as resolved.
Show resolved Hide resolved
// Using an even number as the commit slot will
// make the corresponding block proposal cheaper
// as the commit record will be deleted when the
// block is proposed;
// Using an odd number will allow new commits to
// reuse a previous commit's storage thus new
// commits are cheaper.
delete state.commits[msg.sender][meta.commitSlot];
}
}
Expand Down