From 9dc5e487dbb431fefc153424535864e625b12e13 Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Thu, 12 Sep 2024 09:45:39 +0200 Subject: [PATCH] rusk: adapt deployment tests --- rusk/tests/config/multi_transfer_deploy.toml | 14 ++++++++++++++ rusk/tests/services/multi_transfer.rs | 16 +++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 rusk/tests/config/multi_transfer_deploy.toml diff --git a/rusk/tests/config/multi_transfer_deploy.toml b/rusk/tests/config/multi_transfer_deploy.toml new file mode 100644 index 0000000000..f17449f61a --- /dev/null +++ b/rusk/tests/config/multi_transfer_deploy.toml @@ -0,0 +1,14 @@ +[[phoenix_balance]] +address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN" +seed = 57005 +notes = [10_000_000_000] + +[[phoenix_balance]] +address = "3MoVQ6VfGNu8fJ5GeHPRDVUfxcsDEmGXpWhvKhXY7F2dKCp7QWRw8RqPcbuJGdRqeTtxpuiwETnGAJLnhT4Kq4e8" +seed = 57005 +notes = [10_000_000_000] + +[[phoenix_balance]] +address = "4RyaodGmN8MyUDmpRrtRxJJhrVW2HsY2ycRUnRUXR97JCN1GHraQT9Ygb8yYo7oKzyZg2EXXCGkHBwoeNb96BKtQ" +seed = 57005 +notes = [1_000_000_000_000] diff --git a/rusk/tests/services/multi_transfer.rs b/rusk/tests/services/multi_transfer.rs index 803ce108a7..4761f2b70c 100644 --- a/rusk/tests/services/multi_transfer.rs +++ b/rusk/tests/services/multi_transfer.rs @@ -25,6 +25,7 @@ const BLOCK_HEIGHT: u64 = 1; const BLOCK_GAS_LIMIT: u64 = 24_000_000; const GAS_LIMIT: u64 = 12_000_000; // Lowest value for a transfer const INITIAL_BALANCE: u64 = 10_000_000_000; +const INITIAL_BALANCE_DEPLOY: u64 = 1_000_000_000_000; const BOB_BYTECODE: &[u8] = include_bytes!( "../../../target/dusk/wasm32-unknown-unknown/release/bob.wasm" @@ -39,6 +40,15 @@ fn initial_state>(dir: P) -> Result { new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } +// Creates the Rusk initial state for the tests below +fn initial_state_deploy>(dir: P) -> Result { + let snapshot = + toml::from_str(include_str!("../config/multi_transfer_deploy.toml")) + .expect("Cannot deserialize config"); + + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) +} + /// Executes three different transactions in the same block, expecting only two /// to be included due to exceeding the block gas limit fn wallet_transfer( @@ -218,7 +228,7 @@ fn wallet_transfer_deploy( "Wrong initial balance for the sender" ); assert_eq!( - initial_balance_2, INITIAL_BALANCE, + initial_balance_2, INITIAL_BALANCE_DEPLOY, "Wrong initial balance for the sender" ); @@ -255,7 +265,7 @@ fn wallet_transfer_deploy( init_args, 0, GAS_LIMIT, - 1, + 20_000, ) .expect("Failed to deploy"); txs.push(tx); @@ -387,7 +397,7 @@ pub async fn multi_transfer_deploy() -> Result<()> { logger(); let tmp = tempdir().expect("Should be able to create temporary directory"); - let rusk = initial_state(&tmp)?; + let rusk = initial_state_deploy(&tmp)?; let cache = Arc::new(RwLock::new(HashMap::new()));