mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-08-24 22:29:22 +00:00
add test for empty intersection in circuit
This commit is contained in:
@@ -19,6 +19,10 @@ fn main() {
|
||||
let mut account_post = account_pre.clone();
|
||||
account_post.balance = account_post.balance.saturating_sub(balance_to_burn);
|
||||
|
||||
ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)])
|
||||
.write();
|
||||
ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new(account_post)],
|
||||
)
|
||||
.write();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ fn main() {
|
||||
.checked_add(1)
|
||||
.expect("Balance overflow");
|
||||
|
||||
ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)])
|
||||
.write();
|
||||
ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new(account_post)],
|
||||
)
|
||||
.write();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ fn main() {
|
||||
let mut account_post = account_pre.clone();
|
||||
account_post.nonce.public_account_nonce_increment();
|
||||
|
||||
ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)])
|
||||
.write();
|
||||
ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new(account_post)],
|
||||
)
|
||||
.write();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ fn main() {
|
||||
let mut account_post = account_pre.clone();
|
||||
account_post.program_owner = [0, 1, 2, 3, 4, 5, 6, 7];
|
||||
|
||||
ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)])
|
||||
.write();
|
||||
ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new(account_post)],
|
||||
)
|
||||
.write();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
use nssa_core::program::{
|
||||
AccountPostState, BlockId, ChainedCall, ProgramId, ProgramInput, ProgramOutput,
|
||||
read_nssa_inputs,
|
||||
};
|
||||
use risc0_zkvm::serde::to_vec;
|
||||
|
||||
/// A program that sets a validity window on its output and chains to another program with a
|
||||
/// potentially different validity window.
|
||||
///
|
||||
/// Instruction: (from_id, until_id, chained_program_id, chained_from, chained_until)
|
||||
/// The initial output uses [from_id, until_id) and chains to `chained_program_id` with
|
||||
/// [chained_from, chained_until).
|
||||
type Instruction = (
|
||||
Option<BlockId>,
|
||||
Option<BlockId>,
|
||||
ProgramId,
|
||||
Option<BlockId>,
|
||||
Option<BlockId>,
|
||||
);
|
||||
|
||||
fn main() {
|
||||
let (
|
||||
ProgramInput {
|
||||
pre_states,
|
||||
instruction: (from_id, until_id, chained_program_id, chained_from, chained_until),
|
||||
},
|
||||
instruction_words,
|
||||
) = read_nssa_inputs::<Instruction>();
|
||||
|
||||
let [pre] = <[_; 1]>::try_from(pre_states.clone())
|
||||
.unwrap_or_else(|_| panic!("Expected exactly one pre state"));
|
||||
let post = pre.account.clone();
|
||||
|
||||
let chained_instruction = to_vec(&(chained_from, chained_until)).unwrap();
|
||||
let chained_call = ChainedCall {
|
||||
program_id: chained_program_id,
|
||||
instruction_data: chained_instruction,
|
||||
pre_states,
|
||||
pda_seeds: vec![],
|
||||
};
|
||||
|
||||
ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new(post)],
|
||||
)
|
||||
.valid_from_id(from_id)
|
||||
.unwrap()
|
||||
.valid_until_id(until_id)
|
||||
.unwrap()
|
||||
.with_chained_calls(vec![chained_call])
|
||||
.write();
|
||||
}
|
||||
Reference in New Issue
Block a user