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: removing historical roots from circuits #3544

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions yarn-project/circuits.js/src/structs/rollup/root_rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,6 @@ export class RootRollupPublicInputs {
*/
public endPublicDataTreeRoot: Fr,

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Love to see it.

* Snapshot of the historical note hash tree roots tree at the start of the rollup.
*/
public startTreeOfHistoricalNoteHashTreeRootsSnapshot: AppendOnlyTreeSnapshot,
/**
* Snapshot of the historical note hash tree roots tree at the end of the rollup.
*/
public endTreeOfHistoricalNoteHashTreeRootsSnapshot: AppendOnlyTreeSnapshot,

/**
* Snapshot of the historical contract tree roots tree at the start of the rollup.
*/
public startTreeOfHistoricalContractTreeRootsSnapshot: AppendOnlyTreeSnapshot,
/**
* Snapshot of the historical contract tree roots tree at the end of the rollup.
*/
public endTreeOfHistoricalContractTreeRootsSnapshot: AppendOnlyTreeSnapshot,

/**
* Snapshot of the L1 to L2 message tree at the start of the rollup.
*/
Expand All @@ -146,15 +128,6 @@ export class RootRollupPublicInputs {
*/
public endL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot,

/**
* Snapshot of the historical L1 to L2 message tree roots tree at the start of the rollup.
*/
public startTreeOfHistoricalL1ToL2MessagesTreeRootsSnapshot: AppendOnlyTreeSnapshot,
/**
* Snapshot of the historical L1 to L2 message tree roots tree at the end of the rollup.
*/
public endTreeOfHistoricalL1ToL2MessagesTreeRootsSnapshot: AppendOnlyTreeSnapshot,

/**
* Snapshot of the blocks tree roots tree at the start of the rollup.
*/
Expand Down Expand Up @@ -186,14 +159,8 @@ export class RootRollupPublicInputs {
fields.endContractTreeSnapshot,
fields.startPublicDataTreeRoot,
fields.endPublicDataTreeRoot,
fields.startTreeOfHistoricalNoteHashTreeRootsSnapshot,
fields.endTreeOfHistoricalNoteHashTreeRootsSnapshot,
fields.startTreeOfHistoricalContractTreeRootsSnapshot,
fields.endTreeOfHistoricalContractTreeRootsSnapshot,
fields.startL1ToL2MessagesTreeSnapshot,
fields.endL1ToL2MessagesTreeSnapshot,
fields.startTreeOfHistoricalL1ToL2MessagesTreeRootsSnapshot,
fields.endTreeOfHistoricalL1ToL2MessagesTreeRootsSnapshot,
fields.startBlocksTreeSnapshot,
fields.endBlocksTreeSnapshot,
fields.calldataHash,
Expand Down Expand Up @@ -248,12 +215,6 @@ export class RootRollupPublicInputs {
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
reader.readObject(AppendOnlyTreeSnapshot),
[Fr.fromBuffer(reader), Fr.fromBuffer(reader)],
[Fr.fromBuffer(reader), Fr.fromBuffer(reader)],
);
Expand Down
6 changes: 0 additions & 6 deletions yarn-project/circuits.js/src/tests/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,14 +866,8 @@ export function makeRootRollupPublicInputs(
endContractTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
startPublicDataTreeRoot: fr((seed += 0x100)),
endPublicDataTreeRoot: fr((seed += 0x100)),
startTreeOfHistoricalNoteHashTreeRootsSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
endTreeOfHistoricalNoteHashTreeRootsSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
startTreeOfHistoricalContractTreeRootsSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
endTreeOfHistoricalContractTreeRootsSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
startL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
endL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
startTreeOfHistoricalL1ToL2MessagesTreeRootsSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
endTreeOfHistoricalL1ToL2MessagesTreeRootsSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
startBlocksTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
endBlocksTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)),
calldataHash: [new Fr(1n), new Fr(2n)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,6 @@ impl RootRollupInputs {
end_blocks_tree_snapshot : end_blocks_tree_snapshot,
calldata_hash : components::compute_calldata_hash(self.previous_rollup_data),
l1_to_l2_messages_hash : compute_messages_hash(self.new_l1_to_l2_messages),

// The cpp code was just not initializing these, so they would be zeroed out
// TODO(Lasse/Jean): add explanation for this.
end_tree_of_historical_contract_tree_roots_snapshot : zeroed_out_snapshot,
end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot : zeroed_out_snapshot,
end_tree_of_historical_note_hash_tree_roots_snapshot : zeroed_out_snapshot,
start_tree_of_historical_contract_tree_roots_snapshot : zeroed_out_snapshot,
start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot : zeroed_out_snapshot,
start_tree_of_historical_note_hash_tree_roots_snapshot : zeroed_out_snapshot,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@ struct RootRollupPublicInputs {
start_public_data_tree_root : Field,
end_public_data_tree_root : Field,

start_tree_of_historical_note_hash_tree_roots_snapshot : AppendOnlyTreeSnapshot,
end_tree_of_historical_note_hash_tree_roots_snapshot : AppendOnlyTreeSnapshot,

start_tree_of_historical_contract_tree_roots_snapshot : AppendOnlyTreeSnapshot,
end_tree_of_historical_contract_tree_roots_snapshot : AppendOnlyTreeSnapshot,

start_l1_to_l2_messages_tree_snapshot : AppendOnlyTreeSnapshot,
end_l1_to_l2_messages_tree_snapshot : AppendOnlyTreeSnapshot,

start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot : AppendOnlyTreeSnapshot,
end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot : AppendOnlyTreeSnapshot,

start_blocks_tree_snapshot : AppendOnlyTreeSnapshot,
end_blocks_tree_snapshot : AppendOnlyTreeSnapshot,

Expand Down
10 changes: 0 additions & 10 deletions yarn-project/noir-protocol-circuits/src/type_conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,18 +1264,8 @@ export function mapRootRollupPublicInputsFromNoir(
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_contract_tree_snapshot),
mapFieldFromNoir(rootRollupPublicInputs.start_public_data_tree_root),
mapFieldFromNoir(rootRollupPublicInputs.end_public_data_tree_root),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_tree_of_historical_note_hash_tree_roots_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_tree_of_historical_note_hash_tree_roots_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_tree_of_historical_contract_tree_roots_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_tree_of_historical_contract_tree_roots_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_l1_to_l2_messages_tree_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_l1_to_l2_messages_tree_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(
rootRollupPublicInputs.start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot,
),
mapAppendOnlyTreeSnapshotFromNoir(
rootRollupPublicInputs.end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot,
),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_blocks_tree_snapshot),
mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_blocks_tree_snapshot),
mapTupleFromNoir(rootRollupPublicInputs.calldata_hash, 2, mapFieldFromNoir),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,8 @@ export interface RootRollupPublicInputs {
end_contract_tree_snapshot: AppendOnlyTreeSnapshot;
start_public_data_tree_root: Field;
end_public_data_tree_root: Field;
start_tree_of_historical_note_hash_tree_roots_snapshot: AppendOnlyTreeSnapshot;
end_tree_of_historical_note_hash_tree_roots_snapshot: AppendOnlyTreeSnapshot;
start_tree_of_historical_contract_tree_roots_snapshot: AppendOnlyTreeSnapshot;
end_tree_of_historical_contract_tree_roots_snapshot: AppendOnlyTreeSnapshot;
start_l1_to_l2_messages_tree_snapshot: AppendOnlyTreeSnapshot;
end_l1_to_l2_messages_tree_snapshot: AppendOnlyTreeSnapshot;
start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot: AppendOnlyTreeSnapshot;
end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot: AppendOnlyTreeSnapshot;
start_blocks_tree_snapshot: AppendOnlyTreeSnapshot;
end_blocks_tree_snapshot: AppendOnlyTreeSnapshot;
calldata_hash: FixedLengthArray<Field, 2>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,6 @@ export class SoloBlockBuilder implements BlockBuilder {
]);
}

// Helper for validating a roots tree against a circuit simulation output
protected async validateRootTree(
rootOutput: RootRollupPublicInputs,
treeId: MerkleTreeId,
name: 'Contract' | 'NoteHash' | 'L1ToL2Messages',
) {
const localTree = await this.getTreeSnapshot(treeId);
const simulatedTree = rootOutput[`endTreeOfHistorical${name}TreeRootsSnapshot`];
this.validateSimulatedTree(localTree, simulatedTree, name, `Roots ${name}`);
}

/**
* Validates that the root of the public data tree matches the output of the circuit simulation.
* @param output - The output of the circuit simulation.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/types/src/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './state_provider.js';
export * from './state_info_provider.js';
export * from './hasher.js';
export * from './aztec-node.js';
export * from './pxe.js';
Expand Down