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 7 additions and 8 deletions
Showing only changes of commit 96cfe3a52a - Show all commits

View file

@ -1445,9 +1445,10 @@ pub extern "C" fn rust_wrapper_read_sapling_witness(
out: *mut u8,
out_len: &mut usize
){
let tree_in: Vec<u8> = marshall_from_haskell_var(tree, tree_len, RW);
let tree_reader = Cursor::new(tree_in);
let ct: CommitmentTree<Node, SAPLING_DEPTH> = read_commitment_tree(tree_reader).unwrap();
let tree_in: Hfrontier = marshall_from_haskell_var(tree, tree_len, RW);
let leaf = Node::from_bytes(to_array(tree_in.leaf.bytes)).unwrap();
let frontier: Frontier<Node, SAPLING_DEPTH> = Frontier::from_parts(Position::from(tree_in.position), leaf, tree_in.ommers.iter().map(|x| Node::from_bytes(to_array(x.clone())).unwrap() ).collect()).unwrap();
let ct: CommitmentTree<Node, SAPLING_DEPTH> = CommitmentTree::from_frontier(&frontier);
let inc_wit = IncrementalWitness::from_tree(ct);
let mut out_bytes: Vec<u8> = Vec::new();
let result = write_incremental_witness(&inc_wit, &mut out_bytes);

View file

@ -212,7 +212,7 @@ import ZcashHaskell.Types
#}
{# fun unsafe rust_wrapper_read_sapling_witness as rustWrapperReadSaplingWitness
{ toBorshVar* `BS.ByteString'&
{ toBorshVar* `SaplingFrontier'&
, getVarBuffer `Buffer HexString'&
}
-> `()'

View file

@ -210,15 +210,13 @@ updateSaplingCommitmentTree tree cmu =
rustWrapperReadSaplingCommitmentTree tree (hexBytes cmu)
-- | Get the Sapling incremental witness from a commitment tree
getSaplingWitness :: SaplingCommitmentTree -> Maybe SaplingWitness
getSaplingWitness :: SaplingFrontier -> Maybe SaplingWitness
getSaplingWitness tree =
if BS.length (hexBytes wit) > 1
then Just $ SaplingWitness wit
else Nothing
where
wit =
withPureBorshVarBuffer $
rustWrapperReadSaplingWitness (hexBytes $ sapTree tree)
wit = withPureBorshVarBuffer $ rustWrapperReadSaplingWitness tree
-- | Get the Sapling note position from a witness
getSaplingNotePosition :: SaplingWitness -> Integer