diff --git a/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin b/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin index 51fb43327..1c3737138 100644 Binary files a/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin and b/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin differ diff --git a/artifacts/lez/programs/amm.bin b/artifacts/lez/programs/amm.bin index 8ce7aebb7..193af8006 100644 Binary files a/artifacts/lez/programs/amm.bin and b/artifacts/lez/programs/amm.bin differ diff --git a/artifacts/lez/programs/associated_token_account.bin b/artifacts/lez/programs/associated_token_account.bin index 23d32cb41..1a25fc960 100644 Binary files a/artifacts/lez/programs/associated_token_account.bin and b/artifacts/lez/programs/associated_token_account.bin differ diff --git a/artifacts/lez/programs/authenticated_transfer.bin b/artifacts/lez/programs/authenticated_transfer.bin index 6a4f0248b..669cb8fe0 100644 Binary files a/artifacts/lez/programs/authenticated_transfer.bin and b/artifacts/lez/programs/authenticated_transfer.bin differ diff --git a/artifacts/lez/programs/bridge.bin b/artifacts/lez/programs/bridge.bin index 2ebbb5f90..c8d3d31ea 100644 Binary files a/artifacts/lez/programs/bridge.bin and b/artifacts/lez/programs/bridge.bin differ diff --git a/artifacts/lez/programs/bridge_lock.bin b/artifacts/lez/programs/bridge_lock.bin index 60d3478b6..0723276d9 100644 Binary files a/artifacts/lez/programs/bridge_lock.bin and b/artifacts/lez/programs/bridge_lock.bin differ diff --git a/artifacts/lez/programs/clock.bin b/artifacts/lez/programs/clock.bin index 641f030f8..e60ad792f 100644 Binary files a/artifacts/lez/programs/clock.bin and b/artifacts/lez/programs/clock.bin differ diff --git a/artifacts/lez/programs/cross_zone_inbox.bin b/artifacts/lez/programs/cross_zone_inbox.bin index 173ae9e80..c178fac25 100644 Binary files a/artifacts/lez/programs/cross_zone_inbox.bin and b/artifacts/lez/programs/cross_zone_inbox.bin differ diff --git a/artifacts/lez/programs/cross_zone_outbox.bin b/artifacts/lez/programs/cross_zone_outbox.bin index e628758cb..05ce3e517 100644 Binary files a/artifacts/lez/programs/cross_zone_outbox.bin and b/artifacts/lez/programs/cross_zone_outbox.bin differ diff --git a/artifacts/lez/programs/faucet.bin b/artifacts/lez/programs/faucet.bin index 29bf8c2f6..311d685c9 100644 Binary files a/artifacts/lez/programs/faucet.bin and b/artifacts/lez/programs/faucet.bin differ diff --git a/artifacts/lez/programs/pinata.bin b/artifacts/lez/programs/pinata.bin index f581d9871..a783b7429 100644 Binary files a/artifacts/lez/programs/pinata.bin and b/artifacts/lez/programs/pinata.bin differ diff --git a/artifacts/lez/programs/pinata_token.bin b/artifacts/lez/programs/pinata_token.bin index a9a9c9b54..911fac32c 100644 Binary files a/artifacts/lez/programs/pinata_token.bin and b/artifacts/lez/programs/pinata_token.bin differ diff --git a/artifacts/lez/programs/ping_receiver.bin b/artifacts/lez/programs/ping_receiver.bin index 34ad831c5..544739003 100644 Binary files a/artifacts/lez/programs/ping_receiver.bin and b/artifacts/lez/programs/ping_receiver.bin differ diff --git a/artifacts/lez/programs/ping_sender.bin b/artifacts/lez/programs/ping_sender.bin index 0c004680c..cb58a82b8 100644 Binary files a/artifacts/lez/programs/ping_sender.bin and b/artifacts/lez/programs/ping_sender.bin differ diff --git a/artifacts/lez/programs/sequencer_stake.bin b/artifacts/lez/programs/sequencer_stake.bin index d83567f65..29f985fcf 100644 Binary files a/artifacts/lez/programs/sequencer_stake.bin and b/artifacts/lez/programs/sequencer_stake.bin differ diff --git a/artifacts/lez/programs/token.bin b/artifacts/lez/programs/token.bin index dfb026c2a..036d57cfc 100644 Binary files a/artifacts/lez/programs/token.bin and b/artifacts/lez/programs/token.bin differ diff --git a/artifacts/lez/programs/vault.bin b/artifacts/lez/programs/vault.bin index 92b7d5171..a50185fde 100644 Binary files a/artifacts/lez/programs/vault.bin and b/artifacts/lez/programs/vault.bin differ diff --git a/artifacts/lez/programs/wrapped_token.bin b/artifacts/lez/programs/wrapped_token.bin index f602f83e4..62a57cbf2 100644 Binary files a/artifacts/lez/programs/wrapped_token.bin and b/artifacts/lez/programs/wrapped_token.bin differ diff --git a/lee/privacy_preserving_circuit/src/execution_state.rs b/lee/privacy_preserving_circuit/src/execution_state.rs index dfaa739d4..56a58032c 100644 --- a/lee/privacy_preserving_circuit/src/execution_state.rs +++ b/lee/privacy_preserving_circuit/src/execution_state.rs @@ -170,15 +170,11 @@ impl ExecutionState { ); // Check that `program_output` is consistent with the execution of the corresponding - // program and that the program is well behaved. The System Program has no guest ELF, - // so its clear skips both recursive-proof verification and `validate_execution`: the - // clear intentionally violates `validate_execution` (owner → the declared new owner, - // data zeroed, default-owner-with-data: rules 4, 6, 7) and is instead structurally - // validated here against the accounts the caller declared, which fully pins the - // prover-supplied post states. Every other program is verified - // against its proof and then checked by `validate_execution`. + // program and that the program is well behaved. // See the # Programs section for the definition of the `validate_execution` method. + if chained_call.program_id == DEFAULT_PROGRAM_ID { + // For the default system-program, do logic by hand. assert_eq!( chained_call.pre_states, program_output.pre_states, "System Program clear must apply to the accounts the caller declared" @@ -191,6 +187,7 @@ impl ExecutionState { borsh::from_slice(&program_output.instruction_data) .expect("System Program instruction must deserialize"); match instruction { + // A protocol-wide `Clear` instruction wipes data and reassigns owner. SystemInstruction::Clear { new_owner } => { assert_eq!( program_output.pre_states.len(), diff --git a/lee/state_machine/core/src/program/mod.rs b/lee/state_machine/core/src/program/mod.rs index ced27f820..5ec3d8efb 100644 --- a/lee/state_machine/core/src/program/mod.rs +++ b/lee/state_machine/core/src/program/mod.rs @@ -313,8 +313,10 @@ pub enum Claim { Pda(PdaSeed), } +/// An enum encoding the system-wide instruction to be passed to the verifier. #[derive(BorshSerialize, BorshDeserialize)] pub enum SystemInstruction { + /// Clears account data assigning new owner. Clear { new_owner: Option }, } @@ -841,6 +843,9 @@ pub fn validate_execution( Ok(()) } +/// Logic of system-wide `Clear` instriction. +/// +/// Checks authorization, clearing data and assigning a new owner. pub fn validate_clear( pre: &AccountWithMetadata, new_owner: Option, diff --git a/test_fixtures/fixtures/prebuilt_sequencer_db.dump b/test_fixtures/fixtures/prebuilt_sequencer_db.dump index 0bf205d93..278e66b9d 100644 Binary files a/test_fixtures/fixtures/prebuilt_sequencer_db.dump and b/test_fixtures/fixtures/prebuilt_sequencer_db.dump differ