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: Constrain globals on rollup contract #900

Merged
merged 5 commits into from
Jun 23, 2023

Conversation

LHerskind
Copy link
Contributor

Description

Fixes #827 and #831.

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • The branch has been merged or rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.

Copy link
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

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

lgtm

@LHerskind LHerskind linked an issue Jun 23, 2023 that may be closed by this pull request
@LHerskind LHerskind marked this pull request as ready for review June 23, 2023 11:14
@LHerskind LHerskind requested a review from rahul-kothari June 23, 2023 11:14
@@ -72,4 +75,24 @@ contract Rollup is IRollup {

emit L2BlockProcessed(l2BlockNumber);
}

function _constrainGlobals(bytes calldata _l2Block, uint256 _version) internal view {
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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?
Copy link
Contributor

Choose a reason for hiding this comment

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

is this stale or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Season 7 Oops GIF by Workaholics

@@ -21,7 +21,7 @@ describe('e2e_nested_contract', () => {

parentContract = await deployContract(ParentAbi);
childContract = await deployContract(ChildAbi);
}, 60_000);
}, 100_000);
Copy link
Contributor

Choose a reason for hiding this comment

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

damn why

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simple.
Pop Tv Idiot GIF by Big Brother After Dark

@LHerskind LHerskind force-pushed the lh/constrain-chainid-version branch from 0188705 to 339b4cb Compare June 23, 2023 13:14
@LHerskind LHerskind merged commit bcbf54b into master Jun 23, 2023
@LHerskind LHerskind deleted the lh/constrain-chainid-version branch June 23, 2023 14:20
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.

feat: Constrain version on L1 contract feat: Constrain chainid on L1 contract
3 participants