From 0a20a930ebff631cd9d3d05b5fd6c96bf978cb11 Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 24 Jun 2021 13:10:14 +0300 Subject: [PATCH] EthClient: fix tests. (#598) --- contracts/near/eth-client/Cargo.toml | 5 ++++- contracts/near/eth-client/src/lib.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contracts/near/eth-client/Cargo.toml b/contracts/near/eth-client/Cargo.toml index 19857a850..0c2d81345 100644 --- a/contracts/near/eth-client/Cargo.toml +++ b/contracts/near/eth-client/Cargo.toml @@ -21,10 +21,13 @@ ethash = { git = "https://github.com/nearprotocol/rust-ethash" } hex = "0.4.0" rustc-hex = "2.1.0" +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +# serde's Serialize and Deserialize traits are required for `near_bindgen` macro for non-wasm32 targets +serde = { version = "1.0", features = ["derive"] } + [dev-dependencies] web3 = "0.8.0" lazy_static = "1.4.0" -serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" indicatif = "0.14" diff --git a/contracts/near/eth-client/src/lib.rs b/contracts/near/eth-client/src/lib.rs index 579a8c927..0518760ce 100644 --- a/contracts/near/eth-client/src/lib.rs +++ b/contracts/near/eth-client/src/lib.rs @@ -5,7 +5,7 @@ use near_sdk::collections::UnorderedMap; use near_sdk::AccountId; use near_sdk::{env, near_bindgen, PanicOnDefault}; -#[cfg(test)] +#[cfg(not(target_arch = "wasm32"))] use serde::{Deserialize, Serialize}; near_sdk::setup_alloc!(); @@ -15,7 +15,7 @@ near_sdk::setup_alloc!(); mod tests; #[derive(Default, Debug, Clone, BorshDeserialize, BorshSerialize)] -#[cfg_attr(test, derive(Serialize, Deserialize))] +#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))] pub struct DoubleNodeWithMerkleProof { pub dag_nodes: Vec, // [H512; 2] pub proof: Vec,