From 2e8b9a9362ceb0617a7e371f16f6b909b6608cab Mon Sep 17 00:00:00 2001 From: denbite Date: Mon, 7 Oct 2024 13:26:49 +0200 Subject: [PATCH] fix: use `near_workspaces::compile_project()` to avoid errors due to the missing contract WASM file --- .github/workflows/pull-request.yml | 10 ---------- Cargo.lock | 1 + Cargo.toml | 2 +- tests/common.rs | 11 +++-------- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 69e4312..1a7c6e9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -14,16 +14,6 @@ jobs: - name: Check Formatting run: cargo fmt --check - - name: Install cargo-near CLI - run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.8.1/cargo-near-installer.sh | sh - - - name: Rustc version - run: rustc -V - - # mandatory for e2e tests - - name: Build release version of contract - run: cargo near build --no-abi --no-docker - - name: Run cargo test run: cargo test diff --git a/Cargo.lock b/Cargo.lock index 54a45ed..a229743 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3336,6 +3336,7 @@ dependencies = [ "base64 0.22.1", "bs58 0.5.1", "cargo-near", + "cargo_metadata", "chrono", "fs2", "json-patch", diff --git a/Cargo.toml b/Cargo.toml index db7bfeb..7e74313 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,5 +31,5 @@ overflow-checks = true [dev-dependencies] near-sdk = { version = "5.3.0", features = ["unit-testing"] } -near-workspaces = "0.12.0" +near-workspaces = { version = "0.12.0", features = ["unstable"] } tokio = { version = "1", features = ["full"] } diff --git a/tests/common.rs b/tests/common.rs index 7ea6798..463b25e 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -7,8 +7,6 @@ pub const ARBITRUM_CHAIN_ID: u64 = 42161; pub const ETHEREUM_CHAIN_ID: u64 = 1; const MPC_CONTRACT_WASM_FILE_PATH: &str = "tests/res/mpc_contract.wasm"; -const ABSTRACT_DAO_CONTRACT_WASM_FILE_PATH: &str = - "target/wasm32-unknown-unknown/release/near_abstract_dao.wasm"; fn get_mpc_request_scalars_for_chain(chain_id: u64) -> (&'static str, &'static str) { // epsilon persists the same across chains @@ -25,12 +23,9 @@ fn get_mpc_request_scalars_for_chain(chain_id: u64) -> (&'static str, &'static s } pub async fn deploy_abstract_dao_contract(root: &Account, mpc_contract_id: &AccountId) -> Contract { - let wasm = std::fs::read(ABSTRACT_DAO_CONTRACT_WASM_FILE_PATH).expect( - format!( - "Couldn't find Wasm file intended for Abstract Dao contract at {ABSTRACT_DAO_CONTRACT_WASM_FILE_PATH}" - ) - .as_str(), - ); + let wasm = near_workspaces::compile_project(".") + .await + .expect("Failed to compile contract WASM!"); let account = root .create_subaccount("contract")