-
Notifications
You must be signed in to change notification settings - Fork 234
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
Conversation
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.
Minor stuff, mainly around a typo in a name and to create issues for some todos. Otherwise good to me.
using fr = typename NCT::fr; | ||
using boolean = typename NCT::boolean; | ||
|
||
// Private data | ||
fr private_data_tree_root = 0; | ||
fr nullifier_tree_root = 0; | ||
fr contract_tree_root = 0; | ||
fr l1_to_l2_messages_tree_root = 0; | ||
fr blocks_tree_root = 0; | ||
fr private_kernel_vk_tree_root = 0; // TODO: future enhancement |
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.
@dbanks12 or @iAmMichaelConnor I guess the todo here is one of yours? Can one of you create an issue for it?
privateKernelVkTreeRoot: Fr.ZERO, | ||
// TODO: work out how to get the previous globals hash in here |
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.
Is there an issue for this?
import { computeGlobalsHash } from '@aztec/circuits.js/abis'; | ||
import { MerkleTreeOperations } from '@aztec/world-state'; | ||
|
||
/** | ||
* Fetches the private, nullifier, contract tree and l1 to l2 messages tree roots from a given db and assembles a CombinedHistoricTreeRoots object. | ||
*/ | ||
export async function getConstantBlockHashData( | ||
export async function getconstantHistoricBlockData( |
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.
Should probably be getConstantHistoricBlockData
@@ -86,7 +86,7 @@ export class PublicProcessor { | |||
protected publicProver: PublicProver, | |||
protected contractDataSource: ContractDataSource, | |||
protected globalVariables: GlobalVariables, | |||
protected blockHashData: ConstantBlockHashData, | |||
protected blockHashData: ConstantHistoricBlockData, |
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.
Maybe better to rename to not refer to hash in some names but not others?
privateKernelVkTreeRoot: Fr.ZERO, | ||
|
||
// TODO: work out how to get the previous globals hash in here | ||
prevGlobalVariablesHash: Fr.ZERO, |
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.
As earlier, should this have an issue?
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.
turns out im both cases we no longer needed this method as i had injected it in higher up. Have delet
@@ -223,7 +220,7 @@ constexpr size_t MAX_NOTES_PER_PAGE = 10; | |||
constexpr size_t VIEW_NOTE_ORACLE_RETURN_LENGTH = MAX_NOTES_PER_PAGE * (MAX_NOTE_FIELDS_LENGTH + 1) + 2; | |||
|
|||
constexpr size_t CALL_CONTEXT_LENGTH = 6; | |||
constexpr size_t COMMITMENT_TREES_ROOTS_LENGTH = 5; | |||
constexpr size_t BLOCK_DATA_LENGTH = 7; |
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?
@@ -166,7 +165,7 @@ export class AcirSimulator { | |||
abi, | |||
AztecAddress.ZERO, | |||
EthAddress.ZERO, | |||
PrivateHistoricTreeRoots.empty(), | |||
ConstantHistoricBlockData.empty(), |
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.
Why is this a better name that something like HistoricBlockDataTreeRoots
(like its predecessor)?
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.
It's no longer just roots, as the global variables are included within it. Finding the right name for it has been difficult, Ive flipped it around a few times. But im open to changing it again as its important to get right.
@iAmMichaelConnor do you have any suggestions?
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.
Hmm, I suppose this can be thought of as a block header cant it?
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.
If you add the issues as pointed out, looks good to me.
@@ -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 comment
The 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 comment
The 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
// 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Description
closes: #1163
Now the blocks tree baseline is added, we can remove the old historic blocks trees
This Pr: