Skip to content

Commit

Permalink
fix: use near_workspaces::compile_project() to avoid errors due to …
Browse files Browse the repository at this point in the history
…the missing contract WASM file
  • Loading branch information
denbite committed Oct 7, 2024
1 parent 51d9bb9 commit 2e8b9a9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
11 changes: 3 additions & 8 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit 2e8b9a9

Please sign in to comment.