-
Notifications
You must be signed in to change notification settings - Fork 310
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: Constrain globals on rollup contract #900
Conversation
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.
lgtm
l1-contracts/src/core/Rollup.sol
Outdated
@@ -72,4 +75,24 @@ contract Rollup is IRollup { | |||
|
|||
emit L2BlockProcessed(l2BlockNumber); | |||
} | |||
|
|||
function _constrainGlobals(bytes calldata _l2Block, uint256 _version) internal view { |
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.
why do we pass _version
as a param if it will always be the constant?
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.
Originally I had it in a lib, forgot to update after 😬
|
||
bytes32 public rollupStateHash; | ||
|
||
constructor(IRegistry _registry) { | ||
VERIFIER = new MockVerifier(); | ||
REGISTRY = _registry; | ||
VERSION = 1; |
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.
should this be in the constructor so it is easier to not miss updating this var when upgrading?
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.
Would depend on the upgrade mechanism, and since we are not sure about that yet, have just put it like this.
if (!authedTxRequest.functionData.isPrivate) { | ||
throw new Error(`Public entrypoints are not allowed`); | ||
} | ||
|
||
// Is simulating it messing it up? |
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.
is this stale or?
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.
@@ -21,7 +21,7 @@ describe('e2e_nested_contract', () => { | |||
|
|||
parentContract = await deployContract(ParentAbi); | |||
childContract = await deployContract(ChildAbi); | |||
}, 60_000); | |||
}, 100_000); |
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.
damn why
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.
Possibly as simulations now were copyign non-zero values around, but could also have been pressure on mainframe 🤷
@@ -241,7 +244,7 @@ describe('sequencer/solo_block_builder', () => { | |||
describe('mock simulator', () => { | |||
beforeEach(() => { | |||
// Create instance to test | |||
builder = new SoloBlockBuilder(builderDb, vks, simulator, prover); | |||
builder = new SoloBlockBuilder(builderDb, vks, simulator, prover, Fr.ZERO, Fr.ZERO); |
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.
is there a reason for not using the constants you defined earlier: chainId, version
?
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.
0188705
to
339b4cb
Compare
Description
Fixes #827 and #831.
Checklist: