Skip to content
Open
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
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ keywords = ["ethereum"]
categories = ["cryptography::cryptocurrencies"]

[dependencies]
tree_hash = "0.6.0"
ethereum_ssz = "0.5.0"
tree_hash = { git = "https://github.com/macladson/tree_hash", branch = "stable-container" }
ethereum_ssz = { git = "https://github.com/macladson/ethereum_ssz", branch = "stable-container" }
ethereum_serde_utils = "0.5.0"
serde = "1.0.0"
serde_derive = "1.0.0"
Expand All @@ -24,4 +24,4 @@ itertools = "0.10.0"

[dev-dependencies]
serde_json = "1.0.0"
tree_hash_derive = "0.6.0"
tree_hash_derive = { git = "https://github.com/macladson/tree_hash", branch = "stable-container" }
14 changes: 14 additions & 0 deletions src/bitfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,20 @@ impl<N: Unsigned + Clone> Bitfield<Fixed<N>> {
}
}

impl<N: Unsigned + Clone> std::fmt::Display for Bitfield<Fixed<N>> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut field: String = "".to_string();
for i in self.iter() {
if i {
field.push('1')
} else {
field.push('0')
}
}
write!(f, "{field}")
}
}

impl<N: Unsigned + Clone> Default for Bitfield<Fixed<N>> {
fn default() -> Self {
Self::new()
Expand Down
1 change: 1 addition & 0 deletions src/fixed_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ mod test {
}

#[derive(Clone, Copy, TreeHash, Default)]
#[tree_hash(struct_behaviour = "container")]
struct A {
a: u32,
b: u32,
Expand Down
5 changes: 4 additions & 1 deletion src/tree_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ where
.finish()
.expect("ssz_types variable vec should not have a remaining buffer")
}
TreeHashType::Container | TreeHashType::List | TreeHashType::Vector => {
TreeHashType::Container
| TreeHashType::StableContainer
| TreeHashType::List
| TreeHashType::Vector => {
let mut hasher = MerkleHasher::with_leaves(N::to_usize());

for item in vec {
Expand Down
1 change: 1 addition & 0 deletions src/variable_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ mod test {
}

#[derive(Clone, Copy, TreeHash, Default)]
#[tree_hash(struct_behaviour = "container")]
struct A {
a: u32,
b: u32,
Expand Down