Support for Zebra 2.1.0 #102

Merged
pitmutt merged 97 commits from rav001 into master 2024-12-14 12:51:07 +00:00
3 changed files with 24 additions and 0 deletions
Showing only changes of commit 00782b80c0 - Show all commits

View file

@ -1602,6 +1602,18 @@ pub extern "C" fn rust_wrapper_combine_sapling_nodes(
}
}
#[no_mangle]
pub extern "C" fn rust_wrapper_get_sapling_root(
level: u8,
out: *mut u8,
out_len: &mut usize
){
let tree: CommitmentTree<Node, 32> = CommitmentTree::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_read_orchard_frontier(
tree: *const u8,

View file

@ -262,6 +262,13 @@ import ZcashHaskell.Types
-> `()'
#}
{# fun unsafe rust_wrapper_get_sapling_root as rustWrapperGetSaplingRootTest
{ `Int8'
, getVarBuffer `Buffer HexString'&
}
-> `()'
#}
{# fun unsafe rust_wrapper_read_orchard_node as rustWrapperReadOrchardNode
{ toBorshVar* `BS.ByteString'&
, getVarBuffer `Buffer HexString'&

View file

@ -20,6 +20,7 @@ module ZcashHaskell.Sapling where
import C.Zcash
( rustWrapperCombineSaplingNodes
, rustWrapperDecodeSaplingAddress
, rustWrapperGetSaplingRootTest
, rustWrapperIsShielded
, rustWrapperReadSaplingCommitmentTree
, rustWrapperReadSaplingFrontier
@ -206,6 +207,10 @@ combineSaplingNodes level n1 n2 =
withPureBorshVarBuffer $
rustWrapperCombineSaplingNodes level (toBytes n1) (toBytes n2)
getSaplingRootTest :: Int8 -> HexString
getSaplingRootTest level =
withPureBorshVarBuffer $ rustWrapperGetSaplingRootTest level
getSaplingFrontier :: SaplingCommitmentTree -> Maybe SaplingFrontier
getSaplingFrontier tree =
if sf_pos updatedTree > 1