chore: regenerate artifacts and the prebuilt sequencer fixture

Every guest moved, not only the ones whose source changed: adding real
dependencies (borsh to two cores, cross_zone_inbox_core to two targets) changes
the build graph, and with it the metadata hash of every crate in the guest build.
Piece A moved only three because it added a dev-dependency, which the guest build
never sees.
This commit is contained in:
moudyellaz
2026-08-10 15:01:26 +02:00
parent f26193eedc
commit 869a130eec
21 changed files with 152 additions and 15 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -304,7 +304,11 @@ fn inbox_dispatch_delivers_payload_to_ping_receiver() {
let message = Message::try_new(
inbox_id,
dispatch_accounts(inbox_id, &msg, vec![record_id]),
dispatch_accounts(
inbox_id,
&msg,
vec![receiver_config_account_id(receiver_id), record_id],
),
vec![],
InboxInstruction::Dispatch(msg),
)
@@ -946,6 +950,94 @@ fn the_outbox_pin_is_written_once_and_replayable() {
);
}
/// A token that authorizes nothing mints for nobody. The state a zone reaches with
/// no peers configured, where the config is still seeded so its PDA cannot be
/// claimed by a first initializer.
#[test]
fn a_mint_is_refused_when_the_token_authorizes_no_source() {
let inbox_id = programs::cross_zone_inbox().id();
let wrapped_token_id = programs::wrapped_token().id();
let self_zone = [1_u8; 32];
let src_zone = [2_u8; 32];
let mut state = base_state();
seed_inbox_config(&mut state, self_zone);
seed_wrapped_config(&mut state, vec![]);
let msg = CrossZoneMessage {
src_zone,
src_block_id: 5,
src_block_hash: SRC_BLOCK_HASH,
src_tx_index: 0,
src_program_id: programs::bridge_lock().id(),
target_program_id: wrapped_token_id,
payload: mint_payload(),
l1_inclusion_witness: None,
};
let message = Message::try_new(
inbox_id,
dispatch_accounts(
inbox_id,
&msg,
vec![
wrapped_token_core::config_account_id(wrapped_token_id),
wrapped_token_core::holding_account_id(wrapped_token_id, &RECIPIENT),
],
),
vec![],
InboxInstruction::Dispatch(msg),
)
.expect("build dispatch message");
let tx = PublicTransaction::new(message, WitnessSet::from_raw_parts(vec![]));
let Err(err) = ValidatedStateDiff::from_public_transaction(&tx, &state, 1, 0) else {
panic!("a token authorizing nothing must not mint");
};
assert!(
format!("{err:?}").contains("peer source this token authorizes"),
"rejected for the wrong reason: {err:?}"
);
}
/// The marker only means something because the caller is pinned to the inbox.
/// Invoked directly, with the caller handing in the marker themselves, the mint
/// must refuse before it ever looks at it.
#[test]
fn a_top_level_mint_is_refused() {
let inbox_id = programs::cross_zone_inbox().id();
let wrapped_token_id = programs::wrapped_token().id();
let src_zone = [2_u8; 32];
let src_program_id = programs::bridge_lock().id();
let mut state = base_state();
seed_wrapped_config(&mut state, vec![(src_zone, src_program_id)]);
let marker_id = inbox_source_marker_account_id(inbox_id, &src_zone, src_program_id);
let message = Message::try_new(
wrapped_token_id,
vec![
marker_id,
wrapped_token_core::config_account_id(wrapped_token_id),
wrapped_token_core::holding_account_id(wrapped_token_id, &RECIPIENT),
],
vec![],
wrapped_token_core::Instruction::Mint {
recipient: RECIPIENT,
amount: LOCK_AMOUNT,
},
)
.expect("build mint message");
let tx = PublicTransaction::new(message, WitnessSet::from_raw_parts(vec![]));
let Err(err) = ValidatedStateDiff::from_public_transaction(&tx, &state, 1, 0) else {
panic!("a directly invoked mint must not execute");
};
assert!(
format!("{err:?}").contains("only callable by the authorized minter"),
"rejected for the wrong reason: {err:?}"
);
}
/// Drives a hand-built `cross_zone_inbox::Dispatch` (as the watcher would inject)
/// and asserts it chains into `wrapped_token::Mint`, crediting the recipient.
#[test]
@@ -1005,9 +1097,12 @@ fn a_mint_from_an_unrouted_emitter_is_rejected() {
.expect("build dispatch message");
let tx = PublicTransaction::new(message, WitnessSet::from_raw_parts(vec![]));
let Err(err) = ValidatedStateDiff::from_public_transaction(&tx, &state, 1, 0) else {
panic!("a delivery from a source the token did not authorize must not mint");
};
assert!(
ValidatedStateDiff::from_public_transaction(&tx, &state, 1, 0).is_err(),
"a delivery from an emitter with no route to wrapped_token must not mint"
format!("{err:?}").contains("peer source this token authorizes"),
"rejected for the wrong reason: {err:?}"
);
}
@@ -1195,7 +1290,11 @@ fn a_delivery_from_a_second_block_at_the_same_id_is_refused() {
let record_id = ping_record_pda(receiver_id);
let message = Message::try_new(
inbox_id,
dispatch_accounts(inbox_id, &msg, vec![record_id]),
dispatch_accounts(
inbox_id,
&msg,
vec![receiver_config_account_id(receiver_id), record_id],
),
vec![],
InboxInstruction::Dispatch(msg),
)
@@ -1228,7 +1327,11 @@ fn a_delivery_from_a_second_block_at_the_same_id_is_refused() {
};
let control_message = Message::try_new(
inbox_id,
dispatch_accounts(inbox_id, &control_msg, vec![record_id]),
dispatch_accounts(
inbox_id,
&control_msg,
vec![receiver_config_account_id(receiver_id), record_id],
),
vec![],
InboxInstruction::Dispatch(control_msg),
)
@@ -260,10 +260,13 @@ pub fn inbox_seen_shard_seed(src_zone: &ZoneId, src_block_id: u64) -> PdaSeed {
/// The account naming who sent a delivery, which the inbox passes at position 0
/// of the chained call so the target can authenticate its own sources.
///
/// It is never written and never claimed, so it stays `Account::default()` for
/// ever and the state machine's uninitialized-account rule skips it. The address
/// is the whole message: only the inbox can derive it, and it commits to the pair
/// the target cares about.
/// Nothing writes or claims it, so the state machine's uninitialized-account rule
/// skips it for being unchanged rather than for being default: anyone may send it
/// balance, and the inbox and the targets all round-trip it untouched.
///
/// The address is derivable by anyone, so it is not a secret and not a
/// capability. What makes it mean something is that a target checks it only after
/// pinning its caller to the inbox, and only the inbox can be that caller.
#[must_use]
pub fn inbox_source_marker_account_id(
inbox_id: ProgramId,
+24 -3
View File
@@ -36,9 +36,7 @@ pub enum ReceiverInstruction {
/// about the record meaning something: without it any program on any configured
/// peer can overwrite the record, and a delivery proves only that some peer sent
/// it.
#[derive(
Clone, Debug, Default, PartialEq, Eq, BorshSerialize, BorshDeserialize, Serialize, Deserialize,
)]
#[derive(Clone, Debug, PartialEq, Eq, BorshSerialize, BorshDeserialize, Serialize, Deserialize)]
pub struct ReceiverConfig {
/// The program allowed to call `Record`: the cross-zone inbox.
pub deliverer: ProgramId,
@@ -161,6 +159,29 @@ mod tests {
assert_eq!(words[0], 0);
}
/// `Record` is serialized by the source zone into the emission payload and
/// decoded by the destination, so its tag word is wire format.
#[test]
fn record_is_the_first_variant() {
let record = ReceiverInstruction::Record { payload: vec![] };
let words = risc0_zkvm::serde::to_vec(&record).expect("Record serializes");
assert_eq!(words[0], 0);
}
#[test]
fn an_empty_receiver_config_does_not_decode() {
assert_eq!(ReceiverConfig::from_bytes(&[]), None);
}
#[test]
fn receiver_config_round_trips() {
let config = ReceiverConfig {
deliverer: [1; 8],
sources: vec![([7; 32], [9; 8])],
};
assert_eq!(ReceiverConfig::from_bytes(&config.to_bytes()), Some(config));
}
#[test]
fn outbox_id_round_trips() {
let outbox: ProgramId = [9; 8];
+13 -3
View File
@@ -47,9 +47,7 @@ pub enum Instruction {
/// The source list is what makes this token authorize its own inbound value
/// rather than trusting a central route table to have done it. Borsh because the
/// list is variable length.
#[derive(
Clone, Debug, Default, PartialEq, Eq, BorshSerialize, BorshDeserialize, Serialize, Deserialize,
)]
#[derive(Clone, Debug, PartialEq, Eq, BorshSerialize, BorshDeserialize, Serialize, Deserialize)]
pub struct WrappedTokenConfig {
/// The program allowed to call `Mint`: the cross-zone inbox.
pub minter: ProgramId,
@@ -139,6 +137,18 @@ mod tests {
assert_eq!(WrappedTokenConfig::from_bytes(&[]), None);
}
/// The peer's `bridge_lock` serializes `Mint` into the emission payload, so
/// its tag word is wire format.
#[test]
fn mint_is_the_first_variant() {
let mint = Instruction::Mint {
recipient: [3; 32],
amount: 1,
};
let words = risc0_zkvm::serde::to_vec(&mint).expect("Mint serializes");
assert_eq!(words[0], 0);
}
#[test]
fn balance_round_trips() {
assert_eq!(read_balance(&balance_bytes(42)), 42);
Binary file not shown.