Skip to content

Commit

Permalink
fixed wasm build
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed Nov 13, 2024
1 parent a5d0ea6 commit fefeba0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions common/cosmwasm-smart-contracts/contracts-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ serde_json = { workspace = true }

[build-dependencies]
vergen = { workspace = true, features = ["build", "git", "gitcl", "rustc", "cargo"] }

[features]
naive_float = []
6 changes: 3 additions & 3 deletions common/cosmwasm-smart-contracts/contracts-common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Deref for Percent {
}

// this is not implemented via From traits due to its naive nature and loss of precision
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "naive_float")]
pub trait NaiveFloat {
fn naive_to_f64(&self) -> f64;

Expand All @@ -139,7 +139,7 @@ pub trait NaiveFloat {
Self: Sized;
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "naive_float")]
impl NaiveFloat for Decimal {
fn naive_to_f64(&self) -> f64 {
use cosmwasm_std::Fraction;
Expand Down Expand Up @@ -185,7 +185,7 @@ impl NaiveFloat for Decimal {
}
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "naive_float")]
impl NaiveFloat for Percent {
fn naive_to_f64(&self) -> f64 {
self.0.naive_to_f64()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ pub fn default_mixnet_init_msg() -> nym_mixnet_contract_common::InstantiateMsg {
standby: 0,
},
},
current_nym_node_version: "1.1.10".to_string(),
version_score_weights: Default::default(),
version_score_params: Default::default(),
profit_margin: Default::default(),
interval_operating_cost: Default::default(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,10 @@ pub fn instantiate_contracts(
mixnet_contract_address.clone(),
&nym_mixnet_contract_common::MigrateMsg {
vesting_contract_address: Some(vesting_contract_address.to_string()),
unsafe_skip_state_updates: None,
current_nym_node_semver: "1.1.10".to_string(),
version_score_weights: Default::default(),
unsafe_skip_state_updates: Some(true),
version_score_params: Default::default(),
},
mixnet_code_id,
)
Expand Down
2 changes: 1 addition & 1 deletion nym-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ nym-gateway-client = { path = "../common/client-libs/gateway-client" }
nym-inclusion-probability = { path = "../common/inclusion-probability" }
nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet-contract", features = ["utoipa"] }
nym-vesting-contract-common = { path = "../common/cosmwasm-smart-contracts/vesting-contract" }
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" }
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common", features = ["naive_float"] }
nym-multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" }
nym-coconut = { path = "../common/nymcoconut", features = ["key-zeroize"] }
nym-sphinx = { path = "../common/nymsphinx" }
Expand Down
2 changes: 1 addition & 1 deletion nym-api/nym-api-requests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nym-crypto = { path = "../../common/crypto", features = ["serde", "asymmetric"]

nym-ecash-time = { path = "../../common/ecash-time" }
nym-compact-ecash = { path = "../../common/nym_offline_compact_ecash" }
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", features = ["naive_float"] }
nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" }
nym-node-requests = { path = "../../nym-node/nym-node-requests", default-features = false, features = ["openapi"] }
nym-network-defaults = { path = "../../common/network-defaults" }
Expand Down

0 comments on commit fefeba0

Please sign in to comment.