diff --git a/risc0-selective-privacy-poc/examples/happy_path.rs b/risc0-selective-privacy-poc/examples/happy_path.rs index 107c24d..3280f2a 100644 --- a/risc0-selective-privacy-poc/examples/happy_path.rs +++ b/risc0-selective-privacy-poc/examples/happy_path.rs @@ -31,7 +31,7 @@ fn main() { // A shielded execution of the Transfer Program let private_account_2 = - MockedClient::transfer_shielded(&addresses[1], &addresses[2], 15, &mut sequencer); + MockedClient::transfer_shielded(&addresses[1], &addresses[2], 15, &mut sequencer).unwrap(); println!("Balances after shielded execution"); sequencer.print(); @@ -42,7 +42,8 @@ fn main() { &addresses[3], 8, &mut sequencer, - ); + ) + .unwrap(); println!("🚀 Balances after shielded execution"); sequencer.print(); @@ -53,7 +54,8 @@ fn main() { &addresses[0], 1, &mut sequencer, - ); + ) + .unwrap(); println!("🚀 Balances after deshielded execution"); sequencer.print(); diff --git a/risc0-selective-privacy-poc/examples/mocked_components/client/mod.rs b/risc0-selective-privacy-poc/examples/mocked_components/client/mod.rs index 9121c20..d03447c 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/client/mod.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/client/mod.rs @@ -22,7 +22,7 @@ impl MockedClient { visibilities: &[InputVisibiility], commitment_tree_root: [u32; 8], sequencer: &mut MockedSequencer, - ) -> Vec { + ) -> Result, ()> { let (receipt, private_outputs) = nssa::invoke_privacy_execution::

( input_accounts, instruction_data, @@ -31,9 +31,9 @@ impl MockedClient { ) .unwrap(); // Send to te sequencer - sequencer.process_privacy_execution(receipt).unwrap(); + sequencer.process_privacy_execution(receipt)?; - private_outputs + Ok(private_outputs) } pub fn fresh_account_for_mint(address: Address) -> Account { diff --git a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs index e47b861..8a8e104 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs @@ -13,7 +13,7 @@ impl MockedClient { to_address: &Address, balance_to_move: u128, sequencer: &mut MockedSequencer, - ) -> Account { + ) -> Result { // All of this is executed locally by the sender let sender_account = sequencer.get_account(&from_address).unwrap(); let commitment_tree_root = sequencer.get_commitment_tree_root(); @@ -27,9 +27,8 @@ impl MockedClient { &visibilities, commitment_tree_root, sequencer, - ); + )?; let [receiver_private_account] = private_outputs.try_into().unwrap(); - receiver_private_account + Ok(receiver_private_account) } - } diff --git a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_private.rs b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_private.rs index c84d68a..19abd23 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_private.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_private.rs @@ -14,7 +14,7 @@ impl MockedClient { to_address: &Address, balance_to_move: u128, sequencer: &mut MockedSequencer, - ) -> [Account; 2] { + ) -> Result<[Account; 2], ()> { // All of this is executed locally by the sender let commitment_tree_root = sequencer.get_commitment_tree_root(); let receiver_addr = to_address; @@ -32,8 +32,8 @@ impl MockedClient { &visibilities, commitment_tree_root, sequencer, - ); + )?; - private_outputs.try_into().unwrap() + Ok(private_outputs.try_into().unwrap()) } } diff --git a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_public.rs b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_public.rs index e69de29..2d58c22 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_public.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_public.rs @@ -0,0 +1,11 @@ +use core::types::Address; + +use crate::mocked_components::client::MockedClient; + + + +impl MockedClient { + fn transfer_public(receiver_address: &Address, amount_to_transfer: u128) -> Result<(), ()> { + todo!() + } +} diff --git a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_shielded.rs b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_shielded.rs index 69f9193..2fb4bdf 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_shielded.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_shielded.rs @@ -13,7 +13,7 @@ impl MockedClient { to_address: &Address, balance_to_move: u128, sequencer: &mut MockedSequencer, - ) { + ) -> Result<(), ()> { // All of this is executed locally by the sender let commitment_tree_root = sequencer.get_commitment_tree_root(); let receiver_addr = to_address; @@ -30,6 +30,7 @@ impl MockedClient { &visibilities, commitment_tree_root, sequencer, - ); + )?; + Ok(()) } }