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: single tx block root rollup #11096

Merged
merged 9 commits into from
Jan 9, 2025
Merged

Conversation

LeilaWang
Copy link
Collaborator

@LeilaWang LeilaWang commented Jan 7, 2025

  • Remove PrivateKernelEmpty and EmptyNested.
  • Introduce a new SingleTxBlockRootRollup circuit.
  • Allow submitting a block without txs using EmptyBlockRootRollup.
    • Which allows updating the l1_to_l2_message_tree.

@LeilaWang LeilaWang added the e2e-all CI: Enables this CI job. label Jan 7, 2025
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Changes to circuit sizes

Generated at commit: 62275b2a5d520772ecab3e2f398d1b7b8ff6b71e, compared to commit: 90cd9d22b5da29ef0c989fb9a41f91b9401cc294

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_block_root_empty +1,068 ❌ +107.88% +875,971 ❌ +19431.48%
rollup_block_merge 0 ➖ 0.00% +4 ❌ +0.00%
rollup_root 0 ➖ 0.00% +2 ❌ +0.00%
rollup_block_root -1 ✅ -0.00% -2 ✅ -0.00%
private_kernel_reset_0_0_0_64_0_0_0_0_0 -1 ✅ -0.00% -1 ✅ -0.00%
private_kernel_reset_0_64_0_0_0_0_0_0_0 -1 ✅ -0.00% -1 ✅ -0.00%
rollup_base_private -11 ✅ -0.00% -9 ✅ -0.00%
private_kernel_reset_0_0_0_0_64_0_0_0_0 -1 ✅ -0.01% -1 ✅ -0.00%
private_kernel_inner -1 ✅ -0.00% -1 ✅ -0.00%
private_kernel_reset_0_0_0_0_0_64_0_0_0 -1 ✅ -0.00% -1 ✅ -0.00%
private_kernel_tail_to_public -1 ✅ -0.01% -1 ✅ -0.00%
private_kernel_reset_0_0_64_0_0_0_0_0_0 -1 ✅ -0.01% -1 ✅ -0.00%
private_kernel_reset_64_0_0_0_0_0_0_0_0 -1 ✅ -0.01% -1 ✅ -0.00%
private_kernel_tail -2 ✅ -0.04% -2 ✅ -0.01%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_block_root_empty 2,058 (+1,068) +107.88% 880,479 (+875,971) +19431.48%
rollup_block_merge 38,484 (0) 0.00% 1,962,784 (+4) +0.00%
rollup_root 38,468 (0) 0.00% 14,601,783 (+2) +0.00%
rollup_block_root 719,213 (-1) -0.00% 4,379,529 (-2) -0.00%
private_kernel_reset_0_0_0_64_0_0_0_0_0 31,355 (-1) -0.00% 274,495 (-1) -0.00%
private_kernel_reset_0_64_0_0_0_0_0_0_0 30,009 (-1) -0.00% 262,749 (-1) -0.00%
rollup_base_private 557,082 (-11) -0.00% 2,222,732 (-9) -0.00%
private_kernel_reset_0_0_0_0_64_0_0_0_0 15,343 (-1) -0.01% 97,089 (-1) -0.00%
private_kernel_inner 46,278 (-1) -0.00% 89,087 (-1) -0.00%
private_kernel_reset_0_0_0_0_0_64_0_0_0 29,820 (-1) -0.00% 59,893 (-1) -0.00%
private_kernel_tail_to_public 16,334 (-1) -0.01% 42,933 (-1) -0.00%
private_kernel_reset_0_0_64_0_0_0_0_0_0 13,113 (-1) -0.01% 36,895 (-1) -0.00%
private_kernel_reset_64_0_0_0_0_0_0_0_0 13,113 (-1) -0.01% 36,895 (-1) -0.00%
private_kernel_tail 5,121 (-2) -0.04% 27,274 (-2) -0.01%

@@ -47,7 +47,6 @@ contract Outbox is IOutbox {
override(IOutbox)
{
require(msg.sender == address(ROLLUP), Errors.Outbox__Unauthorized());
require(_root != bytes32(0), Errors.Outbox__InsertingInvalidRoot());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing this check as we allow submitting an empty block, which will have 0 out hash.

if !dep::std::runtime::is_unconstrained() {
self.previous_rollup_data[0].verify();
self.previous_rollup_data[0].validate_in_vk_tree(ALLOWED_PREVIOUS_CIRCUITS);
let validator = BlockRootRollupInputsValidator::new(
Copy link
Collaborator Author

@LeilaWang LeilaWang Jan 8, 2025

Choose a reason for hiding this comment

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

Breaking up the content into BlockRootRollupInputsValidator and BlockRootRollupOutputComposer so that the logic can be easily reused by all 3 types of block root rollups.

};
use types::constants::AZTEC_MAX_EPOCH_DURATION;

pub global EMPTY_BLOBS_HASH: Field =
Copy link
Collaborator Author

@LeilaWang LeilaWang Jan 8, 2025

Choose a reason for hiding this comment

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

These hard-coded values are copied over from block_building_helper.test.ts and compared in one of the tests below.

Copy link
Collaborator Author

@LeilaWang LeilaWang Jan 8, 2025

Choose a reason for hiding this comment

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

Deleting this file because it used to test base rollup with empty private kernel. But now the empty private kernel is gone, and it's a pain to generate a valid tube proof here. And there's no point testing an empty base rollup specifically, which is also part of bb_prover_full_rollup.test.ts.

* The L1 calculation instead computes the tree from right to left (slightly cheaper gas).
* TODO: A more thorough investigation of which method is cheaper, then use that method everywhere.
*/
export function computeUnbalancedMerkleRoot(leaves: Buffer[], emptyLeaf?: Buffer, hasher = sha256Trunc): Buffer {
Copy link
Collaborator Author

@LeilaWang LeilaWang Jan 8, 2025

Choose a reason for hiding this comment

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

This function is copied from the deleted file unbalanced_merkle_root.ts.

location: TreeNodeLocation;
}

export class UnbalancedTreeStore<T> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Creating this class to store and trace proving outputs in block-proving-state.ts and epoch-proving-state.ts.

pub fn finish_empty(
self,
constants: ConstantRollupData,
previous_partial_state: PartialStateReference,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This currently can be anything, just like the start state for the first base rollup. Will fix it in a separate pr!

const blobFields = txEffects.flatMap(tx => tx.toBlobFields());
const blobs = Blob.getBlobs(blobFields);
const blobCommitments = blobs.map(b => b.commitmentToFields());
const blobsHash = sha256ToField(blobs.map(b => b.getEthVersionedBlobHash()));
Copy link
Contributor

Choose a reason for hiding this comment

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

For the blobsHash, we could use getBlobsHashFromBlobs or remove that method and just use sha256ToField - I'm just thinking doing it a single way is cleaner!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh I just copied it from orchestrator. Didn't know we had a function for that! Thanks 😃

Copy link
Contributor

@MirandaWood MirandaWood left a comment

Choose a reason for hiding this comment

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

LGTM! Just one nit that's not important. So nice to not need padding txs, and to have a proper unbalanced tree!

Copy link
Collaborator

@sirasistant sirasistant left a comment

Choose a reason for hiding this comment

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

Very nice! Hope that removing tx effect padding in append only trees doesn't mess with world state assumptions 🤞

@LeilaWang LeilaWang merged commit bcc0168 into master Jan 9, 2025
77 checks passed
@LeilaWang LeilaWang deleted the lw/single_tx_block_root_rollup branch January 9, 2025 17:28
@spalladino
Copy link
Collaborator

Just found this by chance. Awesome!!

TomAFrench added a commit that referenced this pull request Jan 9, 2025
* master: (287 commits)
  feat: Sync from noir (#11051)
  chore(docs): Update tx concepts page (#10947)
  chore(docs): Edit Aztec.nr Guide section (#10866)
  chore: test:e2e defaults to no-docker (#10966)
  chore(avm): improve column stats (#11135)
  chore: Sanity checking of proving job IDs (#11134)
  feat: permutation argument optimizations  (#10960)
  feat: single tx block root rollup (#11096)
  refactor: prover db config (#11126)
  feat: monitor event loop lag (#11127)
  chore: Greater stability at 1TPS (#10981)
  chore: Jest reporters for CI (#11125)
  fix: Sequencer times out L1 tx at end of L2 slot (#11112)
  feat: browser chunking (#11102)
  fix: Added start/stop guards to running promise and serial queue (#11120)
  fix: Don't retransmit txs upon node restart (#11123)
  fix: Prover node aborts execution at epoch end (#11111)
  feat: blob sink in sandbox without extra process (#11032)
  chore: log number of instructions executed for call in AVM. Misc fix. (#11110)
  git subrepo push --branch=master noir-projects/aztec-nr
  ...
TomAFrench added a commit that referenced this pull request Jan 10, 2025
…sync (#11141)

#11096 broke Noir CI
as the `Prover.toml` files weren't updated to take into account the new
circuits. This PR executes the protocol circuits with these inputs to
check they're valid.

---------

Co-authored-by: Miranda Wood <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-all CI: Enables this CI job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants