Skip to content

Refactor accumulator flow#692

Merged
PlasmaPower merged 50 commits intoredo-devnet-reinit-1from
refactor-accumulator-flow
Jun 22, 2022
Merged

Refactor accumulator flow#692
PlasmaPower merged 50 commits intoredo-devnet-reinit-1from
refactor-accumulator-flow

Conversation

@fredlacs
Copy link
Contributor

@fredlacs fredlacs commented Jun 15, 2022

This refactors the flow of the contracts and where message accumulators are stored.
This makes it so the Sequencer Inbox behaves more similarly to the Delayed Inbox.
Accumulators for both are stored in the Bridge contract.

This also include a couple other PRs merged into it:

@cla-bot cla-bot bot added the cla-signed label Jun 15, 2022

acc = keccak256(abi.encodePacked(beforeAcc, dataHash, delayedAcc));
inboxAccs.push(acc);
if (afterDelayedMessagesRead > delayedBridge.delayedMessageCount()) revert DelayedTooFar();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this check could be in Bridge.enqueueSequencerMessage(...)

Comment on lines 289 to 295
function inboxAccs(uint256 index) external view returns (bytes32) {
return delayedBridge.sequencerInboxAccs(index);
}

function batchCount() external view override returns (uint256) {
return inboxAccs.length;
return delayedBridge.sequencerMessageCount();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

kept these for backwards compatibility, but we can remove it

);

return
addMessageToDelayedAccumulator(
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to emit the message data in an inbox-like event somehow. Maybe it'd be better for the sequencer inbox to still submit the batch spending report?

Copy link
Contributor Author

@fredlacs fredlacs Jun 15, 2022

Choose a reason for hiding this comment

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

pushed a change for the sequencer inbox to do so

Copy link
Contributor Author

@fredlacs fredlacs Jun 15, 2022

Choose a reason for hiding this comment

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

chose to add a different entrypoint instead of allowing the sequencer inbox to call enqueueDelayedMessage to avoid gas overhead of an extra sload in either every delayed inbox or every sequencer inbox call

frame.rollupEventInbox.initialize(address(frame.bridge), rollup);
frame.outbox.initialize(rollup, IBridge(frame.bridge));

frame.delayedBridge.setInbox(address(frame.inbox), true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is now done inside the rollup admin's init

        connectedContracts.bridge.setDelayedInbox(address(connectedContracts.inbox), true);

@fredlacs fredlacs requested a review from PlasmaPower June 15, 2022 21:49
@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #692 (52e0614) into redo-devnet-reinit-1 (28681aa) will decrease coverage by 0.01%.
The diff coverage is 49.30%.

@@                   Coverage Diff                    @@
##           redo-devnet-reinit-1     #692      +/-   ##
========================================================
- Coverage                 51.98%   51.97%   -0.02%     
========================================================
  Files                       224      224              
  Lines                     26433    26467      +34     
  Branches                    489      489              
========================================================
+ Hits                      13741    13755      +14     
- Misses                    11244    11264      +20     
  Partials                   1448     1448              

Base automatically changed from automatic-l1-gas-pricing to redo-devnet-reinit-1 June 18, 2022 01:42
Copy link
Contributor

@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.

Mostly LGTM, just a couple recommended changes

Copy link
Contributor

@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 1503847 into redo-devnet-reinit-1 Jun 22, 2022
@PlasmaPower PlasmaPower deleted the refactor-accumulator-flow branch June 22, 2022 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants