From efedcbf856b2fc7cec012f3ba132850fc388248e Mon Sep 17 00:00:00 2001 From: parazyd Date: Wed, 10 Jan 2024 15:17:39 +0100 Subject: [PATCH] contract/money: Rename "integration" test to "token_mint" --- src/contract/money/Makefile | 8 ++++- .../tests/{integration.rs => token_mint.rs} | 34 ++----------------- 2 files changed, 9 insertions(+), 33 deletions(-) rename src/contract/money/tests/{integration.rs => token_mint.rs} (65%) diff --git a/src/contract/money/Makefile b/src/contract/money/Makefile index 73392b76d..20d3dccc7 100644 --- a/src/contract/money/Makefile +++ b/src/contract/money/Makefile @@ -74,13 +74,19 @@ test-pow-reward: all --features=no-entrypoint,client \ --test pow_reward +test-token-mint: all + RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \ + --release --package $(PKGNAME) \ + --features=no-entrypoint,client \ + --test token_mint + bench: RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \ --release --package $(PKGNAME) \ --features=no-entrypoint,client \ --test verification_bench -test: test-integration test-mint-pay-swap test-txs-verification test-genesis-mint test-pow-reward +test: test-integration test-mint-pay-swap test-txs-verification test-genesis-mint test-pow-reward test-token-mint clippy: all RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(WASM_TARGET) \ diff --git a/src/contract/money/tests/integration.rs b/src/contract/money/tests/token_mint.rs similarity index 65% rename from src/contract/money/tests/integration.rs rename to src/contract/money/tests/token_mint.rs index 267d5f7a6..a2e3989f2 100644 --- a/src/contract/money/tests/integration.rs +++ b/src/contract/money/tests/token_mint.rs @@ -16,34 +16,19 @@ * along with this program. If not, see . */ -//! Integration test for functionalities of the money smart contract: -//! -//! * Airdrops of the native token from the faucet -//! * Arbitrary token minting -//! * Transfers/Payments -//! * Atomic swaps -//! * Token mint freezing -//! -//! With this test we want to confirm the money contract state transitions -//! work between multiple parties and are able to be verified. -//! Note: Transfers and atomic swaps are covered in the mint_pay_swap test. -//! -//! TODO: Malicious cases - use darkfi::Result; use darkfi_contract_test_harness::{init_logger, Holder, TestHarness}; use log::info; #[test] -fn money_integration() -> Result<()> { +fn token_mint() -> Result<()> { smol::block_on(async { init_logger(); // Holders this test will use - const HOLDERS: [Holder; 3] = [Holder::Faucet, Holder::Alice, Holder::Bob]; + const HOLDERS: [Holder; 2] = [Holder::Alice, Holder::Bob]; // Some numbers we want to assert - const ALICE_NATIVE_AIRDROP: u64 = 10000000000; // 100 DRK const BOB_SUPPLY: u64 = 2000000000; // 10 BOB // Slot to verify against @@ -52,21 +37,6 @@ fn money_integration() -> Result<()> { // Initialize harness let mut th = TestHarness::new(&["money".to_string()]).await?; - info!("[Faucet] Building Alice airdrop tx"); - let (airdrop_tx, airdrop_params) = - th.airdrop_native(ALICE_NATIVE_AIRDROP, &Holder::Alice, None, None)?; - - for holder in &HOLDERS { - info!("[{holder:?}] Executing Alice airdrop tx"); - th.execute_airdrop_native_tx(holder, &airdrop_tx, &airdrop_params, current_slot) - .await?; - } - - th.assert_trees(&HOLDERS); - - // Alice gathers her new coin - th.gather_owncoin(&Holder::Alice, &airdrop_params.outputs[0], None)?; - info!("[Bob] Building BOB token mint tx"); let (token_mint_tx, token_mint_params) = th.token_mint(BOB_SUPPLY, &Holder::Bob, &Holder::Bob, None, None)?;