Skip to content

Commit 57b7d5b

Browse files
committed
tasm-object: Add more tests of size-verification snippet
More tests added by declaring more types used in neptune-core.
1 parent 38ecd04 commit 57b7d5b

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

tasm-lib/src/neptune/neptune_like_types_for_tests.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,42 @@ pub(crate) struct UpdateWitnessLookalike {
164164
outputs_hash: Digest,
165165
public_announcements_hash: Digest,
166166
}
167+
168+
#[derive(Debug, Clone, BFieldCodec, TasmObject, Arbitrary)]
169+
pub(crate) struct LockScriptAndWitnessLookalike {
170+
nd_memory: Vec<(BFieldElement, BFieldElement)>,
171+
nd_tokens: Vec<BFieldElement>,
172+
nd_digests: Vec<Digest>,
173+
}
174+
175+
#[derive(Debug, Clone, BFieldCodec, TasmObject, Arbitrary)]
176+
struct TypeScriptAndWitnessLookalike {
177+
nd_tokens: Vec<BFieldElement>,
178+
nd_memory: Vec<(BFieldElement, BFieldElement)>,
179+
nd_digests: Vec<Digest>,
180+
}
181+
182+
#[derive(Debug, Clone, BFieldCodec, TasmObject, Arbitrary)]
183+
struct ActiveWindowLookalike {
184+
sbf: Vec<u32>,
185+
}
186+
187+
#[derive(Debug, Clone, BFieldCodec, TasmObject, Arbitrary)]
188+
pub(crate) struct MutatorSetAccumulatorLookalike {
189+
aocl: MmrAccumulator,
190+
swbf_inactive: MmrAccumulator,
191+
swbf_active: ActiveWindowLookalike,
192+
}
193+
194+
#[derive(Debug, Clone, BFieldCodec, TasmObject, Arbitrary)]
195+
pub(crate) struct PrimitiveWitnessLookalike {
196+
input_utxos: SaltedUtxosLookalike,
197+
input_membership_proofs: Vec<MsMembershipProofLookalike>,
198+
lock_scripts_and_witnesses: Vec<LockScriptAndWitnessLookalike>,
199+
type_scripts_and_witnesses: Vec<TypeScriptAndWitnessLookalike>,
200+
output_utxos: SaltedUtxosLookalike,
201+
output_sender_randomnesses: Vec<Digest>,
202+
output_receiver_digests: Vec<Digest>,
203+
mutator_set_accumulator: MutatorSetAccumulatorLookalike,
204+
kernel: TransactionKernelLookalike,
205+
}

tasm-lib/src/structure/verify_nd_si_integrity.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,30 @@ mod tests {
359359
ShadowedAccessor::new(snippet).test();
360360
}
361361

362+
#[test]
363+
fn test_lock_script_and_witness_lookalike() {
364+
let snippet: VerifyNdSiIntegrity<LockScriptAndWitnessLookalike> = VerifyNdSiIntegrity {
365+
_phantom_data: PhantomData,
366+
};
367+
ShadowedAccessor::new(snippet).test();
368+
}
369+
370+
#[test]
371+
fn test_mutator_set_accumulator_lookalike() {
372+
let snippet: VerifyNdSiIntegrity<MutatorSetAccumulatorLookalike> = VerifyNdSiIntegrity {
373+
_phantom_data: PhantomData,
374+
};
375+
ShadowedAccessor::new(snippet).test();
376+
}
377+
378+
#[test]
379+
fn test_primitive_witness_lookalike() {
380+
let snippet: VerifyNdSiIntegrity<PrimitiveWitnessLookalike> = VerifyNdSiIntegrity {
381+
_phantom_data: PhantomData,
382+
};
383+
ShadowedAccessor::new(snippet).test();
384+
}
385+
362386
#[test]
363387
fn test_mmr_successor_proof_auto_derived_code() {
364388
// TODO:

0 commit comments

Comments
 (0)