feat: add sapling tree root test
This commit is contained in:
parent
93622f4456
commit
00782b80c0
3 changed files with 24 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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'&
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue