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: Minimal globals in constant rollup data #882

Merged
merged 12 commits into from
Jun 22, 2023
Merged

Conversation

LHerskind
Copy link
Contributor

@LHerskind LHerskind commented Jun 19, 2023

Description

Replaces #861 to address #826. Extends ConstantRollupData with

  • Move chainid from tx_request into tx_context
  • Add version into tx_context
  • Add global_variables (chain_id, version) to constants
  • Force global_variables to match chainid and version to kernels in the base rollup.
  • Add block_number and timestamp to global_variables
  • Add the global_variables to public input hash in the root rollup, include it in L2 block

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.

@LHerskind LHerskind changed the title fix: move chainid into tx_context feat: Minimal globals Jun 19, 2023
@LHerskind LHerskind mentioned this pull request Jun 19, 2023
6 tasks
@LHerskind LHerskind linked an issue Jun 19, 2023 that may be closed by this pull request
@LHerskind LHerskind changed the title feat: Minimal globals feat: Minimal globals in constant rollup data Jun 19, 2023
@LHerskind LHerskind force-pushed the lh/861-minimal-globals branch from bc258c9 to c277d1f Compare June 20, 2023 14:29
@LHerskind LHerskind marked this pull request as ready for review June 20, 2023 14:55
Copy link
Contributor

@rahul-kothari rahul-kothari left a comment

Choose a reason for hiding this comment

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

  1. In solo_block_builder.buildL2Block(), we are now passing timestamp, but we are never setting it anywhere (for example in sequencer.buildBlock() which calls the buildL2Block()?
  2. When we upgrade, it seems like there would be 2 places where we need to update chainID and version now? In sequencer-client.ts which instantiates the soloblock builder and the AztecRPCServer. Can we move these to configs instead? Maybe we don't want to have a default param for these values so that we are sure we are passing these correctly everywhere (will be helpful for upgrades).
  3. The archiver processes L2 block logs and increments expectedNextL2BlockNum. Should there be a check to ensure this matches the l2 block it decoded? @spalladino

using boolean = typename NCT::boolean;

fr chain_id = 0;
fr version = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename version to aztecVersion and chainId to baseChainID to make it more clear what these are. Otherwise, especially for noir devs this will be super super confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically they are both chainIds, so could also be baseChainId and rollupChainId 🤷. Version mainly chosen just to be different to chainId to make it clear it was not the same thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

yea I am fine with baseChainId and rollupChainId!

l1-contracts/src/core/libraries/Decoder.sol Show resolved Hide resolved
@@ -213,7 +213,7 @@ export class AztecRPCServer implements AztecRPCClient {
contractAddressSalt,
portalContract,
);
const txContext = new TxContext(false, false, true, contractDeploymentData);
const txContext = new TxContext(false, false, true, contractDeploymentData, Fr.ZERO, Fr.ZERO);
Copy link
Contributor

@rahul-kothari rahul-kothari Jun 21, 2023

Choose a reason for hiding this comment

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

is this from where the kernel circuit will add these values into its public inputs (I know we add it to base circuit's constants in the solo_block_builder.ts file)? If so, the chainID and version should be read from somewhere (like a config value), rather than us hard-coding no? Otherwise for every upgrade we might have to edit it here?

Copy link
Contributor Author

@LHerskind LHerskind Jun 21, 2023

Choose a reason for hiding this comment

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

See the general comment; #882 (comment).

@LHerskind
Copy link
Contributor Author

  1. In solo_block_builder.buildL2Block(), we are now passing timestamp, but we are never setting it anywhere (for example in sequencer.buildBlock() which calls the buildL2Block()?

Timestamps will be constrained based on L1 contract in #830. As this is expected to break a lot of tests and such, I delayed that task to when we are actually enforcing it, which will be a separte PR.

  1. When we upgrade, it seems like there would be 2 places where we need to update chainID and version now? In sequencer-client.ts which instantiates the soloblock builder and the AztecRPCServer. Can we move these to configs instead? Maybe we don't want to have a default param for these values so that we are sure we are passing these correctly everywhere (will be helpful for upgrades).

Similar to above, planned to address this when the values starting being constrained on L1 with #827 and #831

@LHerskind LHerskind force-pushed the lh/861-minimal-globals branch from c277d1f to 16b52b3 Compare June 21, 2023 19:41
@LHerskind LHerskind merged commit 3f1ed13 into master Jun 22, 2023
@LHerskind LHerskind deleted the lh/861-minimal-globals branch June 22, 2023 08:52
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: Extend ConstantRollupData to include global variables
2 participants