-
Notifications
You must be signed in to change notification settings - Fork 270
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: Remove proof from L1 Rollup process #7347
Changes from all commits
6f72f49
f335a1e
d21d8c0
c2a7115
3772971
e160151
2ed3cad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,14 +101,8 @@ contract Rollup is IRollup { | |
* @notice Process an incoming L2 block and progress the state | ||
* @param _header - The L2 block header | ||
* @param _archive - A root of the archive tree after the L2 block is applied | ||
* @param _proof - The proof of correct execution | ||
*/ | ||
function process( | ||
bytes calldata _header, | ||
bytes32 _archive, | ||
bytes calldata _aggregationObject, | ||
bytes calldata _proof | ||
) external override(IRollup) { | ||
function process(bytes calldata _header, bytes32 _archive) external override(IRollup) { | ||
// Decode and validate header | ||
HeaderLib.Header memory header = HeaderLib.decode(_header); | ||
HeaderLib.validate(header, VERSION, lastBlockTs, archive); | ||
|
@@ -124,6 +118,38 @@ contract Rollup is IRollup { | |
revert Errors.Rollup__InvalidSequencer(msg.sender); | ||
} | ||
|
||
archive = _archive; | ||
lastBlockTs = block.timestamp; | ||
|
||
bytes32 inHash = INBOX.consume(); | ||
if (header.contentCommitment.inHash != inHash) { | ||
revert Errors.Rollup__InvalidInHash(inHash, header.contentCommitment.inHash); | ||
} | ||
|
||
// TODO(#7218): Revert to fixed height tree for outbox, currently just providing min as interim | ||
// Min size = smallest path of the rollup tree + 1 | ||
(uint256 min,) = MerkleLib.computeMinMaxPathLength(header.contentCommitment.numTxs); | ||
uint256 l2ToL1TreeMinHeight = min + 1; | ||
OUTBOX.insert( | ||
header.globalVariables.blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight | ||
); | ||
|
||
// pay the coinbase 1 gas token if it is not empty and header.totalFees is not zero | ||
if (header.globalVariables.coinbase != address(0) && header.totalFees > 0) { | ||
GAS_TOKEN.transfer(address(header.globalVariables.coinbase), header.totalFees); | ||
} | ||
|
||
emit L2BlockProcessed(header.globalVariables.blockNumber); | ||
} | ||
|
||
function submitProof( | ||
bytes calldata _header, | ||
bytes32 _archive, | ||
bytes calldata _aggregationObject, | ||
bytes calldata _proof | ||
) external override(IRollup) { | ||
HeaderLib.Header memory header = HeaderLib.decode(_header); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, |
||
|
||
bytes32[] memory publicInputs = | ||
new bytes32[](3 + Constants.HEADER_LENGTH + Constants.AGGREGATION_OBJECT_LENGTH); | ||
// the archive tree root | ||
|
@@ -156,28 +182,7 @@ contract Rollup is IRollup { | |
revert Errors.Rollup__InvalidProof(); | ||
} | ||
|
||
archive = _archive; | ||
lastBlockTs = block.timestamp; | ||
|
||
bytes32 inHash = INBOX.consume(); | ||
if (header.contentCommitment.inHash != inHash) { | ||
revert Errors.Rollup__InvalidInHash(inHash, header.contentCommitment.inHash); | ||
} | ||
|
||
// TODO(#7218): Revert to fixed height tree for outbox, currently just providing min as interim | ||
// Min size = smallest path of the rollup tree + 1 | ||
(uint256 min,) = MerkleLib.computeMinMaxPathLength(header.contentCommitment.numTxs); | ||
uint256 l2ToL1TreeMinHeight = min + 1; | ||
OUTBOX.insert( | ||
header.globalVariables.blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight | ||
); | ||
|
||
// pay the coinbase 1 gas token if it is not empty and header.totalFees is not zero | ||
if (header.globalVariables.coinbase != address(0) && header.totalFees > 0) { | ||
GAS_TOKEN.transfer(address(header.globalVariables.coinbase), header.totalFees); | ||
} | ||
|
||
emit L2BlockProcessed(header.globalVariables.blockNumber); | ||
emit L2ProofVerified(header.globalVariables.blockNumber); | ||
} | ||
|
||
function _computePublicInputHash(bytes calldata _header, bytes32 _archive) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, shouldn't this go out only after the block is proven (to avoid the block being reverted due to missing proof)? If that's the case, I'd add a note/todo about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's one of the items I got on the design doc, yep. Fee payment will have to change quite a lot.