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§
const SHIELDED_PROTOCOL: ShieldedPool
Required Associated Types§
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>>
Sourcefn 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 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.
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>
Available on crate feature
pczt only.fn apply_signatures_to_pczt( signer: &mut Signer, usk: &UnifiedSpendingKey, ) -> Result<(), Error>
Available on crate feature
pczt only.Provided Methods§
fn random_fvk(rng: impl Rng) -> Self::Fvk
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.
impl ShieldedPoolTester for OrchardPoolTester
Available on crate feature
orchard only.