Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Upgrade to borsh 1.3.0

* Fix formatting
  • Loading branch information
citizen-stig authored Mar 23, 2024
1 parent 877fd78 commit 0411140
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ migration = []

[dependencies]
anyhow = "1.0.38"
borsh = "0.10.0"
borsh = { version = "1.3.0" , features = ["derive", "de_strict_order"]}
digest = "0.10"
hashbrown = "0.13.2"
itertools = { version = "0.10.0", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions src/node_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ impl From<LeafNode> for SparseMerkleLeafNode {

#[repr(u8)]
#[derive(FromPrimitive, ToPrimitive, BorshDeserialize, BorshSerialize)]
#[borsh(use_discriminant = false)]
enum NodeTag {
Null = 0,
Leaf = 1,
Expand Down
8 changes: 4 additions & 4 deletions src/types/proof/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,9 @@ mod serialization_tests {

#[test]
fn test_sparse_merkle_proof_roundtrip_borsh() {
use borsh::{BorshDeserialize, BorshSerialize};
use borsh::BorshDeserialize;
let proof = get_test_proof();
let serialized_proof = proof.try_to_vec().expect("serialization is infallible");
let serialized_proof = borsh::to_vec(&proof).expect("serialization is infallible");
let deserialized =
SparseMerkleProof::<Sha256>::deserialize(&mut serialized_proof.as_slice())
.expect("serialized proof is valid");
Expand All @@ -763,9 +763,9 @@ mod serialization_tests {

#[test]
fn test_sparse_merkle_range_proof_roundtrip_borsh() {
use borsh::{BorshDeserialize, BorshSerialize};
use borsh::BorshDeserialize;
let proof = get_test_range_proof();
let serialized_proof = proof.try_to_vec().expect("serialization is infallible");
let serialized_proof = borsh::to_vec(&proof).expect("serialization is infallible");
let deserialized =
SparseMerkleRangeProof::<Sha256>::deserialize(&mut serialized_proof.as_slice())
.expect("serialized proof is valid");
Expand Down

0 comments on commit 0411140

Please sign in to comment.