-
Notifications
You must be signed in to change notification settings - Fork 283
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
refactor(blocks tree): remove historic roots trees #1355
Changes from 6 commits
8553fa0
4580093
1991a57
e0808b8
98692dd
2942f95
e8f9fbc
376e71a
9403830
7520217
3c9422c
de68edd
520b9a6
55fbd5f
f1d9fc7
3ae5a4d
011a150
830721f
035c41f
5340a79
d9bda7b
455058a
515bb60
03cc42e
3670fac
e0129f8
acd2413
2bc675f
1b8be8c
c464ec2
1357179
2167ae9
727fec6
9ee98d5
2885d55
ce67250
0195792
3a268e2
9f66593
468bac0
99adca0
77ec737
e769526
acf17be
f072420
956bfdd
96ba6de
4f124e3
8edb2d9
85b6b01
751d6df
ce5a6be
b3fcccc
f065629
8034c95
f8ce11e
50ff634
cb3f80c
a681273
ae967ae
4a0f15a
862a553
c0c5526
1f102a5
02d4e85
8468b2e
deefe17
9210bf9
5882121
2cfa1eb
f4f22e3
81dd1f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ use crate::constants_gen::{ | |
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, | ||
MAX_PUBLIC_DATA_READS_PER_CALL, | ||
GENERATOR_INDEX__FUNCTION_ARGS, | ||
BLOCK_HASH_DATA_LENGTH, | ||
BLOCK_DATA_LENGTH, | ||
CONTRACT_DEPLOYMENT_DATA_LENGTH, | ||
CALL_CONTEXT_LENGTH, | ||
PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH, | ||
|
@@ -84,7 +84,7 @@ impl ContractDeploymentData { | |
// PrivateContextInputs are expected to be provided to each private function | ||
struct PrivateContextInputs { | ||
call_context : CallContext, | ||
block_hash_data: BlockHashData, | ||
block_data: ConstantBlockData, | ||
|
||
contract_deployment_data: ContractDeploymentData, | ||
|
||
|
@@ -94,7 +94,7 @@ struct PrivateContextInputs { | |
// PublicContextInputs are expected to be provided to each public function | ||
struct PublicContextInputs { | ||
call_context: CallContext, | ||
block_hash_data: BlockHashData, | ||
block_data: ConstantBlockData, | ||
|
||
public_global_variables: PublicGlobalVariables, | ||
} | ||
|
@@ -126,7 +126,7 @@ impl CallContext { | |
} | ||
} | ||
|
||
struct BlockHashData { | ||
struct ConstantBlockData { | ||
private_data_tree_root : Field, | ||
nullifier_tree_root : Field, | ||
contract_tree_root : Field, | ||
|
@@ -136,9 +136,9 @@ struct BlockHashData { | |
public_data_tree_root: Field, | ||
} | ||
|
||
impl BlockHashData { | ||
impl ConstantBlockData { | ||
// NOTE: this order must match the order in `private_circuit_public_inputs.hpp` | ||
fn serialize(self) -> [Field; BLOCK_HASH_DATA_LENGTH] { | ||
fn serialize(self) -> [Field; BLOCK_DATA_LENGTH] { | ||
[ | ||
self.private_data_tree_root, | ||
self.nullifier_tree_root, | ||
|
@@ -151,8 +151,8 @@ impl BlockHashData { | |
} | ||
} | ||
|
||
fn empty_block_hash_data() -> BlockHashData { | ||
BlockHashData{ private_data_tree_root: 0, nullifier_tree_root: 0, contract_tree_root: 0, l1_to_l2_messages_tree_root: 0, blocks_tree_root: 0, prev_global_variables_hash: 0, public_data_tree_root: 0 } | ||
fn empty_block_data() -> ConstantBlockData { | ||
ConstantBlockData{ private_data_tree_root: 0, nullifier_tree_root: 0, contract_tree_root: 0, l1_to_l2_messages_tree_root: 0, blocks_tree_root: 0, prev_global_variables_hash: 0, public_data_tree_root: 0 } | ||
} | ||
|
||
struct FunctionData { | ||
|
@@ -190,7 +190,7 @@ struct PrivateCircuitPublicInputs { | |
unencrypted_logs_hash: [Field; NUM_FIELDS_PER_SHA256], | ||
encrypted_log_preimages_length: Field, | ||
unencrypted_log_preimages_length: Field, | ||
block_hash_data: BlockHashData, | ||
block_data: ConstantBlockData, | ||
contract_deployment_data: ContractDeploymentData, | ||
chain_id: Field, | ||
version: Field, | ||
|
@@ -213,7 +213,7 @@ impl PrivateCircuitPublicInputs { | |
fields.push_array(self.unencrypted_logs_hash); | ||
fields.push(self.encrypted_log_preimages_length); | ||
fields.push(self.unencrypted_log_preimages_length); | ||
fields.push_array(self.block_hash_data.serialize()); | ||
fields.push_array(self.block_data.serialize()); | ||
fields.push(self.contract_deployment_data.hash()); | ||
fields.push(self.chain_id); | ||
fields.push(self.version); | ||
|
@@ -236,7 +236,7 @@ impl PrivateCircuitPublicInputs { | |
fields.push_array(self.unencrypted_logs_hash); | ||
fields.push(self.encrypted_log_preimages_length); | ||
fields.push(self.unencrypted_log_preimages_length); | ||
fields.push_array(self.block_hash_data.serialize()); | ||
fields.push_array(self.block_data.serialize()); | ||
fields.push_array(self.contract_deployment_data.serialize()); | ||
fields.push(self.chain_id); | ||
fields.push(self.version); | ||
|
@@ -296,7 +296,7 @@ struct PublicCircuitPublicInputs { | |
new_l2_to_l1_msgs: [Field; crate::abi::MAX_NEW_L2_TO_L1_MSGS_PER_CALL], | ||
unencrypted_logs_hash: [Field; NUM_FIELDS_PER_SHA256], | ||
unencrypted_log_preimages_length: Field, | ||
block_hash_data: BlockHashData, // TODO: This is not present in cpp or ts, do we need to include it? | ||
block_data: ConstantBlockData, // TODO: This is not present in cpp or ts, do we need to include it? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this still a todo? If so can you add issue for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer a todo, however i will change the name to match exactly |
||
historic_public_data_tree_root: Field, | ||
prover_address: Field, | ||
} | ||
|
@@ -319,8 +319,8 @@ impl PublicCircuitPublicInputs { | |
inputs.push_array(self.new_nullifiers); | ||
inputs.push_array(self.new_l2_to_l1_msgs); | ||
|
||
// We do not include block_hash_data since it's not in the cpp hash | ||
// inputs.push(self.block_hash_data.hash()); | ||
// We do not include block_data since it's not in the cpp hash | ||
// inputs.push(self.block_data.hash()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add an issue for this, should be handled instead of just living as comment in here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
inputs.push_array(self.unencrypted_logs_hash); | ||
inputs.push(self.unencrypted_log_preimages_length); | ||
|
@@ -347,7 +347,7 @@ impl PublicCircuitPublicInputs { | |
fields.push_array(self.new_l2_to_l1_msgs); | ||
fields.push_array(self.unencrypted_logs_hash); | ||
fields.push(self.unencrypted_log_preimages_length); | ||
fields.push_array(self.block_hash_data.serialize()); | ||
fields.push_array(self.block_data.serialize()); | ||
fields.push(self.historic_public_data_tree_root); | ||
fields.push(self.prover_address); | ||
fields.storage | ||
|
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.
can you write a comment here so that if people add any more trees to the block tree, they can easily find this and remember to update it?