-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc7769f
commit 31b0b61
Showing
14 changed files
with
56 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
crates/committer/src/patricia_merkle_tree/filled_tree/node_serde.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod inner_node; | ||
pub mod leaf; |
3 changes: 2 additions & 1 deletion
3
crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
crates/committer/src/patricia_merkle_tree/node_data/leaf.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::patricia_merkle_tree::filled_tree::node::{ClassHash, Nonce}; | ||
use crate::types::Felt; | ||
|
||
pub(crate) trait LeafDataTrait { | ||
/// Returns true if leaf is empty. | ||
fn is_empty(&self) -> bool; | ||
} | ||
|
||
#[allow(dead_code)] | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub(crate) enum LeafData { | ||
StorageValue(Felt), | ||
CompiledClassHash(ClassHash), | ||
StateTreeTuple { | ||
class_hash: ClassHash, | ||
contract_state_root_hash: Felt, | ||
nonce: Nonce, | ||
}, | ||
} | ||
|
||
impl LeafDataTrait for LeafData { | ||
fn is_empty(&self) -> bool { | ||
match self { | ||
LeafData::StorageValue(value) => *value == Felt::ZERO, | ||
LeafData::CompiledClassHash(class_hash) => class_hash.0 == Felt::ZERO, | ||
LeafData::StateTreeTuple { | ||
class_hash, | ||
contract_state_root_hash, | ||
nonce, | ||
} => { | ||
nonce.0 == Felt::ZERO | ||
&& class_hash.0 == Felt::ZERO | ||
&& *contract_state_root_hash == Felt::ZERO | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
crates/committer/src/patricia_merkle_tree/original_skeleton_tree/node.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/committer/src/patricia_merkle_tree/original_skeleton_tree/original_skeleton_calc.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/node.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters