Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-contracts-upload-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: arc-ubuntu-20.04
platform: [ arc-ubuntu-20.04 ]

runs-on: ${{ matrix.platform }}
env:
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.

Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ use crate::{
use contracts_common::IdentityKeyRef;
use cosmwasm_std::{Coin, Decimal, StdError, StdResult, Uint128};

#[track_caller]
pub fn compare_decimals(a: Decimal, b: Decimal, epsilon: Option<Decimal>) {
let epsilon = epsilon.unwrap_or_else(|| Decimal::from_ratio(1u128, 100_000_000u128));
if a > b {
assert!(a - b < epsilon, "{a} != {b}")
assert!(a - b < epsilon, "{a} != {b}, delta: {}", a - b)
} else {
assert!(b - a < epsilon, "{a} != {b}")
assert!(b - a < epsilon, "{a} != {b}, delta: {}", b - a)
}
}

Expand Down
6 changes: 4 additions & 2 deletions contracts/Cargo.lock

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

1 change: 1 addition & 0 deletions contracts/mixnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ time = { version = "0.3", features = ["macros"] }
[dev-dependencies]
anyhow.workspace = true
rand_chacha = "0.3"
rand = "0.8.5"
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }

[features]
Expand Down
2 changes: 1 addition & 1 deletion contracts/mixnet/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub fn execute(
crate::vesting_migration::try_migrate_vested_mixnode(deps, info)
}
ExecuteMsg::MigrateVestedDelegation { mix_id } => {
crate::vesting_migration::try_migrate_vested_delegation(deps, info, mix_id)
crate::vesting_migration::try_migrate_vested_delegation(deps, env, info, mix_id)
}

// legacy vesting
Expand Down
9 changes: 5 additions & 4 deletions contracts/mixnet/src/mixnodes/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,28 +156,29 @@ pub(crate) mod tests {
test: &mut TestSetup,
stake: Option<Uint128>,
) -> Vec<DummyMixnode> {
let (mix_id, keypair) = test.add_dummy_mixnode_with_keypair(OWNER_EXISTS, stake);
let (mix_id, keypair) = test.add_legacy_mixnode_with_keypair(OWNER_EXISTS, stake);
let mix_exists = DummyMixnode {
mix_id,
owner: Addr::unchecked(OWNER_EXISTS),
identity: keypair.public_key().to_base58_string(),
};

let (mix_id, keypair) = test.add_dummy_mixnode_with_keypair(OWNER_UNBONDING, stake);
let (mix_id, keypair) = test.add_legacy_mixnode_with_keypair(OWNER_UNBONDING, stake);
let mix_unbonding = DummyMixnode {
mix_id,
owner: Addr::unchecked(OWNER_UNBONDING),
identity: keypair.public_key().to_base58_string(),
};

let (mix_id, keypair) = test.add_dummy_mixnode_with_keypair(OWNER_UNBONDED, stake);
let (mix_id, keypair) = test.add_legacy_mixnode_with_keypair(OWNER_UNBONDED, stake);
let mix_unbonded = DummyMixnode {
mix_id,
owner: Addr::unchecked(OWNER_UNBONDED),
identity: keypair.public_key().to_base58_string(),
};

let (mix_id, keypair) = test.add_dummy_mixnode_with_keypair(OWNER_UNBONDED_LEFTOVER, stake);
let (mix_id, keypair) =
test.add_legacy_mixnode_with_keypair(OWNER_UNBONDED_LEFTOVER, stake);
let mix_unbonded_leftover = DummyMixnode {
mix_id,
owner: Addr::unchecked(OWNER_UNBONDED_LEFTOVER),
Expand Down
12 changes: 6 additions & 6 deletions contracts/mixnet/src/mixnodes/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub(crate) mod tests {
#[test]
fn obeys_limits() {
let mut test = TestSetup::new();
test.add_dummy_mixnodes(1000);
test.add_legacy_mixnodes(1000);
let limit = 2;

let page1 = query_mixnode_bonds_paged(test.deps(), None, Some(limit)).unwrap();
Expand All @@ -276,7 +276,7 @@ pub(crate) mod tests {
#[test]
fn has_default_limit() {
let mut test = TestSetup::new();
test.add_dummy_mixnodes(1000);
test.add_legacy_mixnodes(1000);

// query without explicitly setting a limit
let page1 = query_mixnode_bonds_paged(test.deps(), None, None).unwrap();
Expand All @@ -290,7 +290,7 @@ pub(crate) mod tests {
#[test]
fn has_max_limit() {
let mut test = TestSetup::new();
test.add_dummy_mixnodes(1000);
test.add_legacy_mixnodes(1000);

// query with a crazily high limit in an attempt to use too many resources
let crazy_limit = 1000;
Expand Down Expand Up @@ -353,7 +353,7 @@ pub(crate) mod tests {
#[test]
fn obeys_limits() {
let mut test = TestSetup::new();
test.add_dummy_mixnodes(1000);
test.add_legacy_mixnodes(1000);
let limit = 2;

let page1 = query_mixnodes_details_paged(test.deps(), None, Some(limit)).unwrap();
Expand All @@ -363,7 +363,7 @@ pub(crate) mod tests {
#[test]
fn has_default_limit() {
let mut test = TestSetup::new();
test.add_dummy_mixnodes(1000);
test.add_legacy_mixnodes(1000);

// query without explicitly setting a limit
let page1 = query_mixnodes_details_paged(test.deps(), None, None).unwrap();
Expand All @@ -377,7 +377,7 @@ pub(crate) mod tests {
#[test]
fn has_max_limit() {
let mut test = TestSetup::new();
test.add_dummy_mixnodes(1000);
test.add_legacy_mixnodes(1000);

// query with a crazily high limit in an attempt to use too many resources
let crazy_limit = 1000;
Expand Down
Loading