Skip to content

Commit

Permalink
trying to fix float number
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 9, 2024
1 parent cee109d commit 4d7429b
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 94 deletions.
48 changes: 5 additions & 43 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ cw-multi-test = {version = "^1.0.0", default-features = false}
num-integer = { version = "^0.1.46", default-features = false }
num-rational = {git = "https://github.com/dzmitry-lahoda-forks/num-rational.git", rev = "719b4dbe0afd69b98f5875e3bdf936b9df822522", default-features = false}
num-traits = { version = "^0.2.18", default-features = false }
num = { version = "^0.4.1", default-features = false }


ibc-proto = { version = "^0.42.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion contracts/cosmwasm/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ cosmwasm-schema = { workspace = true, optional = true }
cw-utils = { workspace = true }
cw2 = { workspace = true }
cw20 = { workspace = true }
num = { workspace = true }
hex = { workspace = true, default-features = false, features = ["alloc"] }
schemars = { workspace = true }
serde = { workspace = true }
Expand All @@ -58,6 +57,7 @@ cvm-runtime = { path = "../../../crates/cvm-runtime", features = [
"cosmwasm",
"cosmos",
], default-features = false }
num-traits = { workspace = true }

cvm-route = { path = "../../../crates/cvm-route", features = [
"cosmwasm",
Expand Down
2 changes: 1 addition & 1 deletion contracts/cosmwasm/executor/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use cvm_runtime::{
use cvm_runtime::{executor::*, shared::CvmAddress};
use cw2::{ensure_from_older_version, set_contract_version};
use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg};
use num::Zero;
use num_traits::Zero;

const CONTRACT_NAME: &str = include_str!("contract_name.txt");
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down
1 change: 0 additions & 1 deletion contracts/cosmwasm/order/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ sha2 = {workspace = true, default-features = false, features = ["std"] }
no-panic = { workspace = true }
tuples = { workspace = true }
num-rational = { workspace = true, default-features = false, features = [
"num-bigint-std",
"serde",
] }

Expand Down
4 changes: 1 addition & 3 deletions crates/cvm-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ ibc-app-transfer-types = { workspace = true, features = [
"parity-scale-codec",
] }
ibc-core-host-types = { workspace = true, features = ["serde"] }
num = { workspace = true }
num-rational = { workspace = true }
num-rational = { workspace = true, default-features = false}
parity-scale-codec = { workspace = true, optional = true }
prost = { workspace = true, features = ["prost-derive"] }
scale-info = { workspace = true, features = ["derive"], optional = true }
Expand Down Expand Up @@ -86,6 +85,5 @@ std = [
"ibc-app-transfer-types/schema",
"ibc-core-host-types/schema",
"ibc-primitives/schema",
"num/std",
"thiserror/std",
]
4 changes: 1 addition & 3 deletions crates/cvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ cosmwasm-schema = { workspace = true, optional = true }
cosmwasm-std = { workspace = true, no-default-features = true, optional = true}
cw-storage-plus = { workspace = true, optional = true}

# num = { workspace = true, optional = false}
parity-scale-codec = { workspace = true, optional = true }
prost = { workspace = true, features = ["prost-derive"] }
scale-info = { workspace = true, features = ["derive"], optional = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, features = ["alloc", "derive"] }
num = { workspace = true, default-features = false}
hex ={ workspace = true, default-features = false, features = ["serde"]}
bech32 = { workspace = true, default-features = false}
derive_more = { workspace = true, default-features = false}
num-traits = { workspace = true, default-features = false}

[dev-dependencies]
serde-json-wasm = { workspace = true, default-features = false }
Expand All @@ -42,5 +41,4 @@ json-schema = [
]

std = [
"num/std",
]
2 changes: 1 addition & 1 deletion crates/cvm/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cw_storage_plus::{Key, Prefixer};
use crate::shared::Displayed;
use core::ops::Add;
use cosmwasm_std::{Uint128, Uint256};
use num::Zero;
use num_traits::Zero;
use serde::{Deserialize, Serialize};

/// Newtype for CVM assets ID. Must be unique for each asset and must never change.
Expand Down
26 changes: 0 additions & 26 deletions mantis/node/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 mantis/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ndarray ={ workspace = true, features = ["std", "serde"]}
env_logger = {workspace = true}
cw-multi-test = { workspace = true }
petgraph = {workspace = true}
num-rational = {workspace = true, features = ["cosmwasm", "serde", "json-schema"]}
num-rational = {workspace = true, features = ["cosmwasm", "serde", "json-schema"], default-features = false}


[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion mantis/node/src/mantis/autopilot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
use super::cosmos::client::{CosmWasmWriteClient, CosmosChainInfo, CosmosQueryClient, Tip};

pub async fn cleanup(
write_client: &mut CosmWasmWriteClient,
_write_client: &mut CosmWasmWriteClient,
_cosmos_query_client: &mut CosmosQueryClient,
order_contract: String,
signing_key: &cosmrs::crypto::secp256k1::SigningKey,
Expand Down
4 changes: 2 additions & 2 deletions mantis/node/src/mantis/blackbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use blackbox_rs::{types::*, Client};
/// Given total amount it, order owners and desired out, produce CVM program from and by requesting route
use cvm_runtime::{
outpost::GetConfigResponse,
shared::{CvmAddress, CvmFundsFilter, CvmInstruction, CvmProgram, Displayed},
shared::{CvmFundsFilter, CvmInstruction, CvmProgram,},
Amount,
};

Expand All @@ -22,7 +22,7 @@ fn build_next(
NextItem::Exchange(exchange) => {
let exchange = new_exchange(exchange);
current.instructions.push(exchange);
build_next(current, rest, &glt, salt);
build_next(current, rest, glt, salt);
}
NextItem::Spawn(spawn) => {
let mut program = CvmProgram::default();
Expand Down
5 changes: 2 additions & 3 deletions mantis/node/src/mantis/cosmos/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ pub async fn get_latest_block_and_account_by_key(
/// latest chain state
pub async fn get_latest_block(rpc: &str) -> cosmrs::tendermint::block::Height {
let rpc_client: cosmrs::rpc::HttpClient = cosmrs::rpc::HttpClient::new(rpc).unwrap();
let status = rpc_client
rpc_client
.status()
.await
.expect("status")
.sync_info
.latest_block_height;
status
.latest_block_height
}

pub async fn sign_and_tx_tendermint(
Expand Down
9 changes: 4 additions & 5 deletions mantis/node/src/mantis/solve.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use core::num;
use cvm_runtime::{
outpost::GetConfigResponse,
shared::{CvmAddress, CvmBalanceFilter, CvmFunds, CvmFundsFilter, CvmInstruction, Displayed},
Amount, AssetId, Destination,
shared::{CvmAddress, CvmBalanceFilter, CvmFundsFilter, CvmInstruction, Displayed},
AssetId, Destination,
};
use cw_mantis_order::{CrossChainPart, OrderAmount, OrderItem, OrderSolution, OrderSubMsg};
use mantis_cw::{DenomPair, OrderCoinPair, OrderSide, OrderedTuple2};
use cw_mantis_order::{OrderAmount, OrderItem, OrderSolution,};
use mantis_cw::{DenomPair, OrderCoinPair,};
use num_rational::Ratio;

use crate::{
Expand Down
2 changes: 0 additions & 2 deletions mantis/node/src/solver/router/shortest_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use cvm_route::venue::VenueId;
use cvm_runtime::shared::{CvmFundsFilter, CvmInstruction, CvmProgram};
use cvm_runtime::{exchange, AssetId, ExchangeId};
use petgraph::algo::bellman_ford;
use petgraph::dot::{Config, Dot};
use std::collections::BTreeMap;
use std::ops::Deref;

// need some how unify with python
#[derive(Debug, Clone)]
Expand Down

0 comments on commit 4d7429b

Please sign in to comment.