diff --git a/.circleci/config.yml b/.circleci/config.yml index c78cf5f13b..2402f7faa9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -480,6 +480,16 @@ jobs: workspace_member: ledger cache_key: snarkvm-ledger-cache + ledger-with-rocksdb: + docker: + - image: cimg/rust:1.71.1 + resource_class: 2xlarge + steps: + - run_serial: + flags: --features=rocks + workspace_member: ledger + cache_key: snarkvm-ledger-with-rocksdb-cache + ledger-authority: docker: - image: cimg/rust:1.71.1 @@ -854,6 +864,8 @@ workflows: - curves - fields - ledger +# TODO (howardwu) - Implement `open_testing` on all storage, update to `CurrentConsensusStore::open_testing`, then re-enable. +# - ledger-with-rocksdb - ledger-authority - ledger-block - ledger-coinbase diff --git a/ledger/src/lib.rs b/ledger/src/lib.rs index 568d501ac2..0e5511b798 100644 --- a/ledger/src/lib.rs +++ b/ledger/src/lib.rs @@ -392,11 +392,23 @@ pub(crate) mod test_helpers { prelude::*, }; use ledger_block::Block; - use ledger_store::{helpers::memory::ConsensusMemory, ConsensusStore}; + use ledger_store::ConsensusStore; use synthesizer::vm::VM; pub(crate) type CurrentNetwork = Testnet3; - pub(crate) type CurrentLedger = Ledger>; + + #[cfg(not(feature = "rocks"))] + pub(crate) type CurrentLedger = + Ledger>; + #[cfg(feature = "rocks")] + pub(crate) type CurrentLedger = Ledger>; + + #[cfg(not(feature = "rocks"))] + pub(crate) type CurrentConsensusStore = + ConsensusStore>; + #[cfg(feature = "rocks")] + pub(crate) type CurrentConsensusStore = + ConsensusStore>; #[allow(dead_code)] pub(crate) struct TestEnv { @@ -426,7 +438,7 @@ pub(crate) mod test_helpers { rng: &mut (impl Rng + CryptoRng), ) -> CurrentLedger { // Initialize the store. - let store = ConsensusStore::<_, ConsensusMemory<_>>::open(None).unwrap(); + let store = CurrentConsensusStore::open(None).unwrap(); // Create a genesis block. let genesis = VM::from(store).unwrap().genesis_beacon(&private_key, rng).unwrap(); // Initialize the ledger with the genesis block. diff --git a/ledger/src/tests.rs b/ledger/src/tests.rs index d033edef82..af95102191 100644 --- a/ledger/src/tests.rs +++ b/ledger/src/tests.rs @@ -81,7 +81,7 @@ fn test_state_path() { } #[test] -fn test_insufficient_fees() { +fn test_insufficient_private_fees() { let rng = &mut TestRng::default(); // Initialize the test environment. @@ -190,6 +190,56 @@ finalize foo: } } +#[test] +fn test_insufficient_public_fees() { + let rng = &mut TestRng::default(); + + // Initialize the test environment. + let crate::test_helpers::TestEnv { ledger, private_key, .. } = crate::test_helpers::sample_test_env(rng); + + // Sample recipient. + let recipient_private_key = PrivateKey::new(rng).unwrap(); + let recipient_address = Address::try_from(&recipient_private_key).unwrap(); + + // Fund the recipient with 1 million credits. + { + let inputs = + [Value::from_str(&format!("{recipient_address}")).unwrap(), Value::from_str("1000000000000u64").unwrap()]; + let transaction = ledger + .vm + .execute(&private_key, ("credits.aleo", "transfer_public"), inputs.into_iter(), None, 0, None, rng) + .unwrap(); + + let block = + ledger.prepare_advance_to_next_beacon_block(&private_key, vec![], vec![], vec![transaction], rng).unwrap(); + + // Check that the next block is valid. + ledger.check_next_block(&block).unwrap(); + // Add the deployment block to the ledger. + ledger.advance_to_next_block(&block).unwrap(); + } + + println!("-----------"); + + // Attempt to bond the node with insufficient public fees. + { + let inputs = + [Value::from_str(&format!("{recipient_address}")).unwrap(), Value::from_str("1000000000000u64").unwrap()]; + let transaction = ledger + .vm + .execute(&recipient_private_key, ("credits.aleo", "bond_public"), inputs.into_iter(), None, 0, None, rng) + .unwrap(); + + let block = + ledger.prepare_advance_to_next_beacon_block(&private_key, vec![], vec![], vec![transaction], rng).unwrap(); + + // Check that the next block is valid. + ledger.check_next_block(&block).unwrap(); + // Add the deployment block to the ledger. + ledger.advance_to_next_block(&block).unwrap(); + } +} + #[test] fn test_insufficient_finalize_fees() { let rng = &mut TestRng::default(); diff --git a/ledger/store/src/helpers/rocksdb/internal/id.rs b/ledger/store/src/helpers/rocksdb/internal/id.rs index 3091895661..0d47eecd83 100644 --- a/ledger/store/src/helpers/rocksdb/internal/id.rs +++ b/ledger/store/src/helpers/rocksdb/internal/id.rs @@ -195,6 +195,7 @@ pub enum TestMap { Test2 = DataID::Test2 as u16, Test3 = DataID::Test3 as u16, Test4 = DataID::Test4 as u16, + Test5 = DataID::Test5 as u16, } /// The RocksDB map prefix. @@ -282,4 +283,6 @@ enum DataID { Test3, #[cfg(test)] Test4, + #[cfg(test)] + Test5, } diff --git a/ledger/store/src/helpers/rocksdb/internal/nested_map.rs b/ledger/store/src/helpers/rocksdb/internal/nested_map.rs index 73bf49bee0..b168b3591a 100644 --- a/ledger/store/src/helpers/rocksdb/internal/nested_map.rs +++ b/ledger/store/src/helpers/rocksdb/internal/nested_map.rs @@ -16,7 +16,7 @@ use super::*; use crate::helpers::{NestedMap, NestedMapRead}; -use console::prelude::FromBytes; +use console::prelude::{anyhow, FromBytes}; use core::{fmt, fmt::Debug, hash::Hash, mem}; use std::{borrow::Cow, sync::atomic::Ordering}; @@ -80,10 +80,20 @@ impl Result<(&[u8], &[u8])> { - let map_len = u32::from_bytes_le(&map_key[PREFIX_LEN..][..4])? as usize; - let map = &map_key[PREFIX_LEN + 4..][..map_len]; - let key = &map_key[PREFIX_LEN + 4 + map_len..]; + // Retrieve the map length. + let map_len = u32::from_bytes_le( + map_key.get(PREFIX_LEN..PREFIX_LEN + 4).ok_or_else(|| anyhow!("NestedMap map_len index out of range"))?, + )? as usize; + // Retrieve the map bytes. + let map = map_key + .get(PREFIX_LEN + 4..PREFIX_LEN + 4 + map_len) + .ok_or_else(|| anyhow!("NestedMap map index out of range"))?; + + // Retrieve the key bytes. + let key = map_key.get(PREFIX_LEN + 4 + map_len..).ok_or_else(|| anyhow!("NestedMap key index out of range"))?; + + // Return the map and key bytes. Ok((map, key)) } @@ -140,7 +150,9 @@ impl< let (map_key, _) = entry?; // Extract the bytes belonging to the map and the key. - let (entry_map, _) = get_map_and_key(&map_key)?; + let Ok((entry_map, _)) = get_map_and_key(&map_key) else { + break; + }; // If the 'entry_map' matches 'serialized_map', delete the key. if entry_map == serialized_map { @@ -282,7 +294,9 @@ impl< let (map_key, _) = entry?; // Extract the bytes belonging to the map and the key. - let (entry_map, _) = get_map_and_key(&map_key)?; + let Ok((entry_map, _)) = get_map_and_key(&map_key) else { + break; + }; // If the 'entry_map' matches 'serialized_map', delete the key. if entry_map == serialized_map { @@ -397,7 +411,9 @@ impl< let (map_key, value) = entry?; // Extract the bytes belonging to the map and the key. - let (entry_map, entry_key) = get_map_and_key(&map_key)?; + let Ok((entry_map, entry_key)) = get_map_and_key(&map_key) else { + break; + }; // If the 'entry_map' matches 'serialized_map', deserialize the key and value. if entry_map == serialized_map { @@ -708,7 +724,10 @@ mod tests { use crate::{ atomic_batch_scope, atomic_finalize, - helpers::rocksdb::{internal::tests::temp_dir, MapID, TestMap}, + helpers::{ + rocksdb::{internal::tests::temp_dir, MapID, TestMap}, + traits::Map, + }, FinalizeMode, }; use console::{ @@ -748,6 +767,28 @@ mod tests { } } + fn open_non_nested_map_testing_from_db< + K: Serialize + DeserializeOwned, + V: Serialize + DeserializeOwned, + T: Into, + >( + database: RocksDB, + map_id: T, + ) -> DataMap { + // Combine contexts to create a new scope. + let mut context = database.network_id.to_le_bytes().to_vec(); + context.extend_from_slice(&(map_id.into()).to_le_bytes()); + + // Return the DataMap. + DataMap(Arc::new(InnerDataMap { + database, + context, + atomic_batch: Default::default(), + batch_in_progress: Default::default(), + checkpoints: Default::default(), + })) + } + struct TestStorage { own_map: NestedDataMap, extra_maps: TestStorage2, @@ -798,7 +839,7 @@ mod tests { self.own_map.is_atomic_in_progress() && self.extra_maps.own_map1.is_atomic_in_progress() && self.extra_maps.own_map1.is_atomic_in_progress() - && self.extra_maps.extra_maps.own_map.is_atomic_in_progress() + && self.extra_maps.extra_maps.own_nested_map.is_atomic_in_progress() } } @@ -855,35 +896,44 @@ mod tests { } struct TestStorage3 { - own_map: NestedDataMap, + own_nested_map: NestedDataMap, + own_map: DataMap, } impl TestStorage3 { fn open(database: RocksDB) -> Self { - Self { own_map: open_map_testing_from_db(database, MapID::Test(TestMap::Test4)) } + Self { + own_nested_map: open_map_testing_from_db(database.clone(), MapID::Test(TestMap::Test4)), + own_map: open_non_nested_map_testing_from_db(database, MapID::Test(TestMap::Test5)), + } } fn start_atomic(&self) { + self.own_nested_map.start_atomic(); self.own_map.start_atomic(); } fn is_atomic_in_progress(&self) -> bool { - self.own_map.is_atomic_in_progress() + self.own_nested_map.is_atomic_in_progress() || self.own_map.is_atomic_in_progress() } fn atomic_checkpoint(&self) { + self.own_nested_map.atomic_checkpoint(); self.own_map.atomic_checkpoint(); } fn clear_latest_checkpoint(&self) { + self.own_nested_map.clear_latest_checkpoint(); self.own_map.clear_latest_checkpoint(); } fn atomic_rewind(&self) { + self.own_nested_map.atomic_rewind(); self.own_map.atomic_rewind(); } fn finish_atomic(&self) -> Result<()> { + self.own_nested_map.finish_atomic()?; self.own_map.finish_atomic() } } @@ -966,6 +1016,29 @@ mod tests { crate::helpers::test_helpers::nested_map::check_iterators_match(map); } + #[test] + #[serial] + #[traced_test] + fn test_iter_from_nested_to_non_nested() { + // Open a storage with a DataMap right after a NestedDataMap. + let database = RocksDB::open_testing(temp_dir(), None).expect("Failed to open a test database"); + let test_storage = TestStorage3::open(database); + + // Insert 5 (confirmed) records into a nested map 77. + for i in 0..5 { + test_storage.own_nested_map.insert(77, i, i.to_string()).expect("Failed to insert"); + } + + // Insert 5 (confirmed) records into the neighboring data map; the keys are large on purpose. + for i in 0..5 { + test_storage.own_map.insert(usize::MAX - i, (usize::MAX - i).to_string()).expect("Failed to insert"); + } + + // We should be able to collect the 5 records from the nested data map. + let confirmed = test_storage.own_nested_map.get_map_confirmed(&77).unwrap(); + assert_eq!(confirmed.len(), 5); + } + #[test] #[serial] #[traced_test] @@ -1574,7 +1647,7 @@ mod tests { assert!(test_storage.own_map.iter_confirmed().next().is_none()); assert!(test_storage.extra_maps.own_map1.iter_confirmed().next().is_none()); assert!(test_storage.extra_maps.own_map2.iter_confirmed().next().is_none()); - assert!(test_storage.extra_maps.extra_maps.own_map.iter_confirmed().next().is_none()); + assert!(test_storage.extra_maps.extra_maps.own_nested_map.iter_confirmed().next().is_none()); assert_eq!(test_storage.own_map.checkpoints.lock().last(), None); @@ -1603,11 +1676,11 @@ mod tests { test_storage.extra_maps.own_map2.insert(2, 2, 2.to_string()).unwrap(); // Start another atomic write batch. - atomic_batch_scope!(test_storage.extra_maps.extra_maps.own_map, { - assert!(test_storage.extra_maps.extra_maps.own_map.is_atomic_in_progress()); + atomic_batch_scope!(test_storage.extra_maps.extra_maps.own_nested_map, { + assert!(test_storage.extra_maps.extra_maps.own_nested_map.is_atomic_in_progress()); // Write an item into the fourth map. - test_storage.extra_maps.extra_maps.own_map.insert(3, 3, 3.to_string()).unwrap(); + test_storage.extra_maps.extra_maps.own_nested_map.insert(3, 3, 3.to_string()).unwrap(); Ok(()) })?; @@ -1628,7 +1701,7 @@ mod tests { assert_eq!(test_storage.own_map.iter_confirmed().count(), 1); assert_eq!(test_storage.extra_maps.own_map1.iter_confirmed().count(), 1); assert_eq!(test_storage.extra_maps.own_map2.iter_confirmed().count(), 1); - assert_eq!(test_storage.extra_maps.extra_maps.own_map.iter_confirmed().count(), 1); + assert_eq!(test_storage.extra_maps.extra_maps.own_nested_map.iter_confirmed().count(), 1); // The atomic_write_batch macro uses ?, so the test returns a Result for simplicity. Ok(()) @@ -1659,11 +1732,11 @@ mod tests { test_storage.extra_maps.own_map2.insert(2, 2, 2.to_string()).unwrap(); // Start another atomic write batch. - let result: Result<()> = atomic_batch_scope!(test_storage.extra_maps.extra_maps.own_map, { + let result: Result<()> = atomic_batch_scope!(test_storage.extra_maps.extra_maps.own_nested_map, { assert!(test_storage.is_atomic_in_progress_everywhere()); // Write an item into the fourth map. - test_storage.extra_maps.extra_maps.own_map.insert(3, 3, 3.to_string()).unwrap(); + test_storage.extra_maps.extra_maps.own_nested_map.insert(3, 3, 3.to_string()).unwrap(); // Rewind the atomic batch via a simulated error. bail!("An error that will trigger a single rewind."); @@ -1690,7 +1763,7 @@ mod tests { assert!(test_storage.own_map.iter_confirmed().next().is_none()); assert!(test_storage.extra_maps.own_map1.iter_confirmed().next().is_none()); assert!(test_storage.extra_maps.own_map2.iter_confirmed().next().is_none()); - assert!(test_storage.extra_maps.extra_maps.own_map.iter_confirmed().next().is_none()); + assert!(test_storage.extra_maps.extra_maps.own_nested_map.iter_confirmed().next().is_none()); // Note: all the checks going through .database can be performed on any one // of the objects, as all of them share the same instance of the database. @@ -1706,6 +1779,6 @@ mod tests { assert_eq!(test_storage.own_map.iter_confirmed().count(), 1); assert_eq!(test_storage.extra_maps.own_map1.iter_confirmed().count(), 1); assert_eq!(test_storage.extra_maps.own_map2.iter_confirmed().count(), 1); - assert_eq!(test_storage.extra_maps.extra_maps.own_map.iter_confirmed().count(), 0); + assert_eq!(test_storage.extra_maps.extra_maps.own_nested_map.iter_confirmed().count(), 0); } } diff --git a/ledger/store/src/program/committee.rs b/ledger/store/src/program/committee.rs index 71c764d51a..62cd6e0bbb 100644 --- a/ledger/store/src/program/committee.rs +++ b/ledger/store/src/program/committee.rs @@ -114,7 +114,10 @@ pub trait CommitteeStorage: 'static + Clone + Send + Sync { // If the current round is 0, ensure the next round is 0. Err(..) => ensure!(next_round == 0, "Next round must be block round 0"), // Otherwise, ensure the next round sequentially follows the current round. - Ok(current_round) => ensure!(next_round > current_round, "Next round must be greater than current round"), + Ok(current_round) => ensure!( + next_round > current_round, + "Next round {next_round} must be greater than current round {current_round}" + ), } // Check the next height. diff --git a/synthesizer/src/vm/mod.rs b/synthesizer/src/vm/mod.rs index bfcc0b6d5e..baa491b906 100644 --- a/synthesizer/src/vm/mod.rs +++ b/synthesizer/src/vm/mod.rs @@ -187,18 +187,26 @@ impl> VM { impl> VM { /// Returns a new genesis block for a beacon chain. pub fn genesis_beacon(&self, private_key: &PrivateKey, rng: &mut R) -> Result> { + let private_keys = [*private_key, PrivateKey::new(rng)?, PrivateKey::new(rng)?, PrivateKey::new(rng)?]; + // Construct the committee members. let members = indexmap::indexmap! { - Address::try_from(private_key)? => (ledger_committee::MIN_VALIDATOR_STAKE, true), - Address::try_from(PrivateKey::new(rng)?)? => (ledger_committee::MIN_VALIDATOR_STAKE, true), - Address::try_from(PrivateKey::new(rng)?)? => (ledger_committee::MIN_VALIDATOR_STAKE, true), - Address::try_from(PrivateKey::new(rng)?)? => (ledger_committee::MIN_VALIDATOR_STAKE, true), + Address::try_from(private_keys[0])? => (ledger_committee::MIN_VALIDATOR_STAKE, true), + Address::try_from(private_keys[1])? => (ledger_committee::MIN_VALIDATOR_STAKE, true), + Address::try_from(private_keys[2])? => (ledger_committee::MIN_VALIDATOR_STAKE, true), + Address::try_from(private_keys[3])? => (ledger_committee::MIN_VALIDATOR_STAKE, true), }; // Construct the committee. let committee = Committee::::new_genesis(members)?; + + // Compute the remaining supply. + let remaining_supply = N::STARTING_SUPPLY - (ledger_committee::MIN_VALIDATOR_STAKE * 4); // Construct the public balances. let public_balances = indexmap::indexmap! { - Address::try_from(private_key)? => N::STARTING_SUPPLY - (ledger_committee::MIN_VALIDATOR_STAKE * 4), + Address::try_from(private_keys[0])? => remaining_supply / 4, + Address::try_from(private_keys[1])? => remaining_supply / 4, + Address::try_from(private_keys[2])? => remaining_supply / 4, + Address::try_from(private_keys[3])? => remaining_supply / 4, }; // Return the genesis block. self.genesis_quorum(private_key, committee, public_balances, rng) diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/child_and_parent.out b/synthesizer/tests/expectations/vm/execute_and_finalize/child_and_parent.out index 919b9291a5..6aab0a972c 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/child_and_parent.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/child_and_parent.out @@ -26,8 +26,8 @@ additional: - child_outputs: child.aleo/foo: outputs: - - '{"type":"public","id":"2459501703788162014390032218062615187041680109741533589876416940768900522799field","value":"aleo16w8t56s7v6ud7vu33fr388ph0dq0c7yhp597cyjt88rr3nultcyqcyk9yy"}' - - '{"type":"public","id":"4059102611680484817772932189626681723346184344473090391520905329315796272971field","value":"aleo1qr2ha4pfs5l28aze88yn6fhleeythklkczrule2v838uwj65n5gqxt9djx"}' + - '{"type":"public","id":"5712527802009221538913597905008159571083800168555613323828114175105395494302field","value":"aleo16w8t56s7v6ud7vu33fr388ph0dq0c7yhp597cyjt88rr3nultcyqcyk9yy"}' + - '{"type":"public","id":"2170761061395221552321793888804720334493316122331828231173520748015857657389field","value":"aleo1qr2ha4pfs5l28aze88yn6fhleeythklkczrule2v838uwj65n5gqxt9djx"}' credits.aleo/fee_public: outputs: - '{"type":"future","id":"6934683053495529076879804638371439764251999038469408002617655045734104381794field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1qr2ha4pfs5l28aze88yn6fhleeythklkczrule2v838uwj65n5gqxt9djx,\n 2123u64\n ]\n}"}' diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/complex_finalization.out b/synthesizer/tests/expectations/vm/execute_and_finalize/complex_finalization.out index 16fed64edf..968809fe2f 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/complex_finalization.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/complex_finalization.out @@ -11,16 +11,16 @@ additional: - child_outputs: zero_program.aleo/c: outputs: - - '{"type":"future","id":"868980695576387061465481340013995581415399669646103119988420471982198353684field","value":"{\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' + - '{"type":"future","id":"6477965281694625542813245938794172569328608429706708191922101843636085582648field","value":"{\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' one_program.aleo/d: outputs: - - '{"type":"future","id":"7019513656735375987781202584670889731433817481734857255379784812609399295012field","value":"{\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' + - '{"type":"future","id":"7600562933389723321829659564857024316904973330057294558938622149411503122565field","value":"{\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' two_program.aleo/b: outputs: - - '{"type":"future","id":"3159380222510695027024010240323042120907966737357325980281186387999863524975field","value":"{\n program_id: two_program.aleo,\n function_name: b,\n arguments: [\n {\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' + - '{"type":"future","id":"1088466287454699993852527092566314082160141085274506025284078608454717245108field","value":"{\n program_id: two_program.aleo,\n function_name: b,\n arguments: [\n {\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' three_program.aleo/e: outputs: - - '{"type":"future","id":"2107445810553019850887004032370986179841471500877564050507038295661575797827field","value":"{\n program_id: three_program.aleo,\n function_name: e,\n arguments: [\n {\n program_id: two_program.aleo,\n function_name: b,\n arguments: [\n {\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' + - '{"type":"future","id":"7841227793321257675149138943803344962284191528517008231244304707117434937108field","value":"{\n program_id: three_program.aleo,\n function_name: e,\n arguments: [\n {\n program_id: two_program.aleo,\n function_name: b,\n arguments: [\n {\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: one_program.aleo,\n function_name: d,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n {\n program_id: zero_program.aleo,\n function_name: c,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n },\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8\n ]\n}"}' credits.aleo/fee_public: outputs: - '{"type":"future","id":"1237672223493374809326586125815613616482431271830981051687054520069740484800field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8,\n 1312883u64\n ]\n}"}' diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/count_usages.out b/synthesizer/tests/expectations/vm/execute_and_finalize/count_usages.out index 7933b15076..21f59e8527 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/count_usages.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/count_usages.out @@ -12,12 +12,12 @@ additional: - child_outputs: basic_math.aleo/add_and_count: outputs: - - '{"type":"private","id":"2687119938526671223430712275520099287526474990567687943355031309835685603554field","value":"ciphertext1qyqp0gkmren9kcflhxpg3v9e2cw97um7lu4tfwuh7w5h5nk4mpvjjpquaydnu"}' - - '{"type":"future","id":"4247717008565083288734190529633596823232122291180671236322823911170152094500field","value":"{\n program_id: basic_math.aleo,\n function_name: add_and_count,\n arguments: [\n aleo1mrughg5ssadd9fc2uwve7l6u24xn76kyz24zsjtzta03vgkq4vpqggl6fg\n ]\n}"}' + - '{"type":"private","id":"4561312717108467882490189383753688162224283446985485227292501566765195528324field","value":"ciphertext1qyqxqf95wz9zvjvpar4mvg0uh8xuc3dwd0g3z7rggzs37wgn59lk5rqeqev0f"}' + - '{"type":"future","id":"1823043499627326708916435552316425587964911687609516559408234217585811375291field","value":"{\n program_id: basic_math.aleo,\n function_name: add_and_count,\n arguments: [\n aleo1mrughg5ssadd9fc2uwve7l6u24xn76kyz24zsjtzta03vgkq4vpqggl6fg\n ]\n}"}' basic_math.aleo/sub_and_count: outputs: - - '{"type":"private","id":"7992464697490466293984943598604231412571016633865588345761260178196099457747field","value":"ciphertext1qyqxeag0ujtnn39yp0x9qryt77fkcklyc466cp3l7g8wgt4524jngzqz5ask9"}' - - '{"type":"future","id":"6594089907002769296322737141374301940875927088813929000246625002187630516842field","value":"{\n program_id: basic_math.aleo,\n function_name: sub_and_count,\n arguments: [\n aleo1mrughg5ssadd9fc2uwve7l6u24xn76kyz24zsjtzta03vgkq4vpqggl6fg\n ]\n}"}' + - '{"type":"private","id":"6179141860878239968710321244474677697823391063964518415169464613412286673421field","value":"ciphertext1qyqd9vtp4hdlacy9n322hvdywk84crzw47vfygjmxe253v2tgjqpxqcq5jx54"}' + - '{"type":"future","id":"6353584285709285028969780236537279966694496448826640752394833353716781489471field","value":"{\n program_id: basic_math.aleo,\n function_name: sub_and_count,\n arguments: [\n aleo1mrughg5ssadd9fc2uwve7l6u24xn76kyz24zsjtzta03vgkq4vpqggl6fg\n ]\n}"}' credits.aleo/fee_public: outputs: - '{"type":"future","id":"1724410343181243501519372165830316719575121816257937877011429517054089311771field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1kw4knandael9qcpxs6g36rr6h7dwvjz6q25ueah6zz9v57zjlvxsx5llq8,\n 263392u64\n ]\n}"}' diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/program_callable.out b/synthesizer/tests/expectations/vm/execute_and_finalize/program_callable.out index 17a70a1d39..35b4c94e05 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/program_callable.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/program_callable.out @@ -16,8 +16,8 @@ additional: - child_outputs: child.aleo/foo: outputs: - - '{"type":"public","id":"6570086835149819439219303224003492878705751026121012692011734299993965867007field","value":"aleo16w8t56s7v6ud7vu33fr388ph0dq0c7yhp597cyjt88rr3nultcyqcyk9yy"}' - - '{"type":"public","id":"2866009676898789345591427281882170655806617413858789892357234972821058149651field","value":"aleo1qr2ha4pfs5l28aze88yn6fhleeythklkczrule2v838uwj65n5gqxt9djx"}' + - '{"type":"public","id":"8256096006685601051730823022659471790701845130080598423319521977566444421040field","value":"aleo16w8t56s7v6ud7vu33fr388ph0dq0c7yhp597cyjt88rr3nultcyqcyk9yy"}' + - '{"type":"public","id":"5221989025862141472722693152948767316757289409356062808145501796303456062879field","value":"aleo1qr2ha4pfs5l28aze88yn6fhleeythklkczrule2v838uwj65n5gqxt9djx"}' credits.aleo/fee_public: outputs: - '{"type":"future","id":"2015747658045377273535220569098051012671760616560705166778921345457847058512field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1qr2ha4pfs5l28aze88yn6fhleeythklkczrule2v838uwj65n5gqxt9djx,\n 2123u64\n ]\n}"}' diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/public_wallet.out b/synthesizer/tests/expectations/vm/execute_and_finalize/public_wallet.out index 1276dd48c4..96fdcea20c 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/public_wallet.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/public_wallet.out @@ -11,7 +11,7 @@ additional: - child_outputs: token.aleo/mint_public: outputs: - - '{"type":"future","id":"3687815127788961249655268422309693065088885703875160126919606715756865244929field","value":"{\n program_id: token.aleo,\n function_name: mint_public,\n arguments: [\n aleo1sry3pke49ykrf0aeshf889tr98r4c86p5f4ms766795ssdwfdyqq9jdg0j,\n 10u64\n ]\n}"}' + - '{"type":"future","id":"3040250960739602137216192760697867018750676343790464348994684811613512872895field","value":"{\n program_id: token.aleo,\n function_name: mint_public,\n arguments: [\n aleo1sry3pke49ykrf0aeshf889tr98r4c86p5f4ms766795ssdwfdyqq9jdg0j,\n 10u64\n ]\n}"}' credits.aleo/fee_public: outputs: - '{"type":"future","id":"4373249435479943424484888940718424132561120812144078253060284512525421799293field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1d3e2je2m2hsxwdsvntvf4jnnlj459ywfry6ch2qwrpy6l6r6yvpq8e88h5,\n 131201u64\n ]\n}"}' diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out b/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out index d1a041cc47..4fefc62cfd 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out @@ -26,7 +26,7 @@ outputs: test_rand.aleo/rand_chacha_check: outputs: - '{"type":"future","id":"887371549615679800380522845098080464570119184210350810479392117984911457950field","value":"{\n program_id: test_rand.aleo,\n function_name: rand_chacha_check,\n arguments: [\n 1field,\n true\n ]\n}"}' - speculate: the execution was rejected + speculate: the execution was accepted add_next_block: succeeded. additional: - child_outputs: