Rust dependencies update #103

Merged
pitmutt merged 99 commits from rav001 into master 2024-12-19 15:23:13 +00:00
3 changed files with 18 additions and 9 deletions
Showing only changes of commit 1938e162f4 - Show all commits

View file

@ -1626,13 +1626,14 @@ pub extern "C" fn rust_wrapper_get_orchard_root(
out_len: &mut usize
){
let tree: CommitmentTree<MerkleHashOrchard, 32> = CommitmentTree::empty();
let root = tree.root_at_depth(level, PathFiller::empty());
let root = tree.root();
let h = Hhex { bytes: root.to_bytes().to_vec() };
marshall_to_haskell_var(&h, out, out_len, RW);
}
#[no_mangle]
pub extern "C" fn rust_wrapper_orchard_add_node(
level: u8,
node: *const u8,
node_len: usize,
out: *mut u8,
@ -1643,10 +1644,17 @@ pub extern "C" fn rust_wrapper_orchard_add_node(
let orchard_note_comm = ExtractedNoteCommitment::from_bytes(&to_array(node_in));
if orchard_note_comm.is_some().into() {
let n = MerkleHashOrchard::from_cmx(&orchard_note_comm.unwrap());
tree.append(n);
let root = tree.root();
match tree.append(n) {
Ok(()) => {
let root = tree.root_at_depth(level, PathFiller::empty());
let h = Hhex { bytes: root.to_bytes().to_vec() };
marshall_to_haskell_var(&h, out, out_len, RW);
},
Err(_) => {
let h0 = Hhex { bytes: vec![0] };
marshall_to_haskell_var(&h0, out, out_len, RW);
}
}
} else {
let h0 = Hhex { bytes: vec![0] };
marshall_to_haskell_var(&h0, out, out_len, RW);

View file

@ -312,7 +312,8 @@ import ZcashHaskell.Types
#}
{# fun unsafe rust_wrapper_orchard_add_node as rustWrapperOrchardAddNodeTest
{ toBorshVar* `BS.ByteString'&
{ `Int8'
, toBorshVar* `BS.ByteString'&
, getVarBuffer `Buffer HexString'&
}
-> `()'

View file

@ -224,9 +224,9 @@ getOrchardRootTest :: Int -> HexString
getOrchardRootTest level =
withPureBorshVarBuffer $ rustWrapperGetOrchardRootTest $ fromIntegral level
addOrchardNodeGetRoot :: BS.ByteString -> HexString
addOrchardNodeGetRoot n =
withPureBorshVarBuffer $ rustWrapperOrchardAddNodeTest n
addOrchardNodeGetRoot :: Int -> BS.ByteString -> HexString
addOrchardNodeGetRoot l n =
withPureBorshVarBuffer $ rustWrapperOrchardAddNodeTest (fromIntegral l) n
-- | Update a Orchard commitment tree
updateOrchardCommitmentTree ::