Skip to main content

ShieldedPoolTester

Trait ShieldedPoolTester 

Source
pub trait ShieldedPoolTester {
    type Sk;
    type Fvk: TestFvk;
    type MerkleTreeHash;
    type Note;

    const SHIELDED_PROTOCOL: ShieldedPool;
Show 23 methods // Required methods fn test_account_fvk<Cache, DbT: WalletTest, P: Parameters>( st: &TestState<Cache, DbT, P>, ) -> Self::Fvk; fn usk_to_sk(usk: &UnifiedSpendingKey) -> &Self::Sk; fn sk(seed: &[u8]) -> Self::Sk; fn sk_to_fvk(sk: &Self::Sk) -> Self::Fvk; fn sk_default_address(sk: &Self::Sk) -> Address; fn fvk_default_address(fvk: &Self::Fvk) -> Address; fn fvks_equal(a: &Self::Fvk, b: &Self::Fvk) -> bool; fn empty_tree_leaf() -> Self::MerkleTreeHash; fn empty_tree_root(level: Level) -> Self::MerkleTreeHash; fn put_subtree_roots<Cache, DbT: WalletTest + WalletCommitmentTrees, P>( st: &mut TestState<Cache, DbT, P>, start_index: u64, roots: &[CommitmentTreeRoot<Self::MerkleTreeHash>], ) -> Result<(), ShardTreeError<<DbT as WalletCommitmentTrees>::Error>>; fn shard_root<Cache, DbT: WalletTest + WalletCommitmentTrees, P>( st: &mut TestState<Cache, DbT, P>, shard_index: u64, ) -> Result<Self::MerkleTreeHash, ShardTreeError<<DbT as WalletCommitmentTrees>::Error>>; fn next_subtree_index<A: Hash + Eq>(s: &WalletSummary<A>) -> u64; fn note_value(note: &Self::Note) -> Zatoshis; fn select_spendable_notes<Cache, DbT: InputSource + WalletTest, P>( st: &TestState<Cache, DbT, P>, account: <DbT as InputSource>::AccountId, target_value: TargetValue, target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, exclude: &[DbT::NoteRef], ) -> Result<Vec<ReceivedNote<DbT::NoteRef, Self::Note>>, <DbT as InputSource>::Error>; fn select_unspent_notes<Cache, DbT: InputSource + WalletTest, P>( st: &TestState<Cache, DbT, P>, account: <DbT as InputSource>::AccountId, target_height: TargetHeight, exclude: &[DbT::NoteRef], ) -> Result<Vec<ReceivedNote<DbT::NoteRef, Self::Note>>, <DbT as InputSource>::Error>; fn decrypted_pool_outputs_count<A>( d_tx: &DecryptedTransaction<'_, Transaction, A>, ) -> usize; fn with_decrypted_pool_memos<A>( d_tx: &DecryptedTransaction<'_, Transaction, A>, f: impl FnMut(&MemoBytes), ); fn try_output_recovery<P: Parameters>( params: &P, height: BlockHeight, tx: &Transaction, fvk: &Self::Fvk, ) -> Option<(Note, Address, MemoBytes)>; fn received_note_count(summary: &ScanSummary) -> usize; fn add_proof_generation_keys( pczt: Pczt, usk: &UnifiedSpendingKey, ) -> Result<Pczt, SaplingError>; fn apply_signatures_to_pczt( signer: &mut Signer, usk: &UnifiedSpendingKey, ) -> Result<(), Error>; // Provided methods fn random_fvk(rng: impl Rng) -> Self::Fvk { ... } fn random_address(rng: impl Rng) -> Address { ... }
}
Available on crate features test-dependencies only.
Expand description

Trait that exposes the pool-specific types and operations necessary to run the single-shielded-pool tests on a given pool.

You should not need to implement this yourself; instead use SaplingPoolTester or OrchardPoolTester as appropriate.

Required Associated Constants§

Source

const SHIELDED_PROTOCOL: ShieldedPool

Required Associated Types§

Required Methods§

Source

fn test_account_fvk<Cache, DbT: WalletTest, P: Parameters>( st: &TestState<Cache, DbT, P>, ) -> Self::Fvk

Source

fn usk_to_sk(usk: &UnifiedSpendingKey) -> &Self::Sk

Source

fn sk(seed: &[u8]) -> Self::Sk

Source

fn sk_to_fvk(sk: &Self::Sk) -> Self::Fvk

Source

fn sk_default_address(sk: &Self::Sk) -> Address

Source

fn fvk_default_address(fvk: &Self::Fvk) -> Address

Source

fn fvks_equal(a: &Self::Fvk, b: &Self::Fvk) -> bool

Source

fn empty_tree_leaf() -> Self::MerkleTreeHash

Source

fn empty_tree_root(level: Level) -> Self::MerkleTreeHash

Source

fn put_subtree_roots<Cache, DbT: WalletTest + WalletCommitmentTrees, P>( st: &mut TestState<Cache, DbT, P>, start_index: u64, roots: &[CommitmentTreeRoot<Self::MerkleTreeHash>], ) -> Result<(), ShardTreeError<<DbT as WalletCommitmentTrees>::Error>>

Source

fn shard_root<Cache, DbT: WalletTest + WalletCommitmentTrees, P>( st: &mut TestState<Cache, DbT, P>, shard_index: u64, ) -> Result<Self::MerkleTreeHash, ShardTreeError<<DbT as WalletCommitmentTrees>::Error>>

Computes the actual root of the shard_index-th shard from the wallet’s local shardtree state, reading whatever leaves and cached annotations are currently stored. Used by tests that need to call Self::put_subtree_roots with a root that matches the shard’s actual computed root — for example, when declaring a shard complete after filling its last position via scan_cached_blocks.

Source

fn next_subtree_index<A: Hash + Eq>(s: &WalletSummary<A>) -> u64

Source

fn note_value(note: &Self::Note) -> Zatoshis

Source

fn select_spendable_notes<Cache, DbT: InputSource + WalletTest, P>( st: &TestState<Cache, DbT, P>, account: <DbT as InputSource>::AccountId, target_value: TargetValue, target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, exclude: &[DbT::NoteRef], ) -> Result<Vec<ReceivedNote<DbT::NoteRef, Self::Note>>, <DbT as InputSource>::Error>

Source

fn select_unspent_notes<Cache, DbT: InputSource + WalletTest, P>( st: &TestState<Cache, DbT, P>, account: <DbT as InputSource>::AccountId, target_height: TargetHeight, exclude: &[DbT::NoteRef], ) -> Result<Vec<ReceivedNote<DbT::NoteRef, Self::Note>>, <DbT as InputSource>::Error>

Source

fn decrypted_pool_outputs_count<A>( d_tx: &DecryptedTransaction<'_, Transaction, A>, ) -> usize

Source

fn with_decrypted_pool_memos<A>( d_tx: &DecryptedTransaction<'_, Transaction, A>, f: impl FnMut(&MemoBytes), )

Source

fn try_output_recovery<P: Parameters>( params: &P, height: BlockHeight, tx: &Transaction, fvk: &Self::Fvk, ) -> Option<(Note, Address, MemoBytes)>

Source

fn received_note_count(summary: &ScanSummary) -> usize

Source

fn add_proof_generation_keys( pczt: Pczt, usk: &UnifiedSpendingKey, ) -> Result<Pczt, SaplingError>

Available on crate feature pczt only.
Source

fn apply_signatures_to_pczt( signer: &mut Signer, usk: &UnifiedSpendingKey, ) -> Result<(), Error>

Available on crate feature pczt only.

Provided Methods§

Source

fn random_fvk(rng: impl Rng) -> Self::Fvk

Source

fn random_address(rng: impl Rng) -> Address

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ShieldedPoolTester for OrchardPoolTester

Available on crate feature orchard only.
Source§

const SHIELDED_PROTOCOL: ShieldedPool = ShieldedPool::Orchard

Source§

type Sk = SpendingKey

Source§

type Fvk = FullViewingKey

Source§

type MerkleTreeHash = MerkleHashOrchard

Source§

type Note = Note

Source§

impl ShieldedPoolTester for SaplingPoolTester

Source§

const SHIELDED_PROTOCOL: ShieldedPool = ShieldedPool::Sapling

Source§

type Sk = ExtendedSpendingKey

Source§

type Fvk = DiversifiableFullViewingKey

Source§

type MerkleTreeHash = Node

Source§

type Note = Note