Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup dependencies #507

Merged
merged 1 commit into from
Feb 7, 2024
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
1,392 changes: 1,184 additions & 208 deletions Cargo.lock

Large diffs are not rendered by default.

35 changes: 0 additions & 35 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,3 @@ members = [
"faucet",
"runner"
]

[patch.crates-io]
sp-core = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-state-machine = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-io = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-keyring = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }

[patch."https://github.com/paritytech/substrate"]
frame-support = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
frame-support-procedural = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
frame-support-procedural-tools = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
frame-support-procedural-tools-derive = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-api = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-application-crypto = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-arithmetic = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-core = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-debug-derive = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-externalities = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-inherents = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-io = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-keyring = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-keystore = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-runtime-interface = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-runtime-interface-proc-macro = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-staking = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-state-machine = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-std = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-storage = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-tracing = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-trie = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-version = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-wasm-interface = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
sp-weights = { git = "https://github.com/paritytech//substrate", branch = "polkadot-v0.9.42" }
2 changes: 1 addition & 1 deletion bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ serde = "1.0.139"
serde_json = "1.0.82"

# Substrate dependencies
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-core = { version = "21.0.0", default-features = false }

[dev-dependencies]
mockall = "0.8.1"
Expand Down
2 changes: 1 addition & 1 deletion faucet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ serial_test = "0.9.0"
runtime = { path = "../runtime", features = ["testing-utils"] }

# Substrate dependencies
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-keyring = "24.0.0"
2 changes: 1 addition & 1 deletion oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ backoff = { version = "0.3.0", features = ["tokio"] }
git-version = "0.3.4"
futures = "0.3.5"
async-trait = "0.1.40"
statrs = "0.15"
statrs = "0.16"
serde_json = "1.0"
serde = "1.0"

Expand Down
4 changes: 3 additions & 1 deletion runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ clap = { version = "4.0.17", features = ["derive"]}
hex = "0.4.3"
tokio = { version = "1.8", features = ["rt-multi-thread", "macros", "time"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
thiserror = "1.0.0"
log = "0.4.0"
env_logger = "0.7.1"
Expand All @@ -27,6 +26,9 @@ backoff = { version = "0.3.0", features = ["tokio"] }
subxt = { version = "0.29.0", default_features = false, features = ["jsonrpsee-ws"] }
sha2 = "0.8.2"

# Substrate dependencies
sp-core = { version = "21.0.0", default-features = false }

[dev-dependencies]
sysinfo = "0.25.1"
tempdir = "0.3.7"
Expand Down
19 changes: 11 additions & 8 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ default = []
testing-utils = [
"tempdir",
"rand",
"frame-support",
]
parachain-metadata-interlay = []
parachain-metadata-kintsugi = []
Expand All @@ -28,17 +29,14 @@ url = "2"
cfg-if = "1.0"
prometheus = { version = "0.12.0", features = ["process"] }
lazy_static = "1.4.0"
base58 = { version = "0.2.0" }
blake2 = { version = "0.10.4", default-features = false }
scale-decode = { version = "0.7.0", features = ["derive"] }
scale-encode = { version = "0.3.0", features = ["derive"] }

# Substrate dependencies
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-core = { version = "21.0.0", default-features = false }
sp-runtime = "24.0.0"
sp-keyring = "24.0.0"
frame-support = { version = "21.0.0", optional = true }

# Subxt dependencies
subxt = { version = "0.29.0", default_features = false, features = ["jsonrpsee-ws"] }
Expand All @@ -54,12 +52,17 @@ rand = { version = "0.7", optional = true }
git = "https://github.com/interlay/interbtc"
rev = "700fcc9b9aab8f5337d62cb8f18c894722cf02f4"
package = "interbtc-primitives"
default_features = false
# NOTE: sp-runtime still in lockfile but not used
# https://github.com/rust-lang/cargo/issues/10801
features = ["std"]

[dependencies.module-bitcoin]
git = "https://github.com/interlay/interbtc"
rev = "700fcc9b9aab8f5337d62cb8f18c894722cf02f4"
package = "bitcoin"
features = ["parser"]
default_features = false
features = ["std", "parser"]

[dev-dependencies]
runtime = { path = ".", features = ["testing-utils"] }
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{
error::{Error, KeyLoadingError},
rpc::ShutdownSender,
InterBtcParachain, InterBtcSigner,
InterBtcParachain, InterBtcSigner, ShutdownSender,
};
use clap::Parser;
use sp_core::{sr25519, Pair};
Expand Down
47 changes: 22 additions & 25 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,45 @@ mod tests;

#[cfg(feature = "testing-utils")]
pub mod integration;
use subxt::config::SubstrateConfig;

pub mod utils;

pub use addr::PartialAddress;
pub use assets::{AssetRegistry, LendingAssets, RuntimeCurrencyInfo, TryFromSymbol};
use codec::{Decode, Encode};
pub use error::{Error, SubxtError};
pub use primitives::CurrencyInfo;
pub use prometheus;
pub use retry::{notify_retry, RetryPolicy};
#[cfg(feature = "testing-utils")]
pub use rpc::SudoPallet;
pub use rpc::{
BtcRelayPallet, CollateralBalancesPallet, FeePallet, FeeRateUpdateReceiver, InterBtcParachain, IssuePallet,
OraclePallet, RedeemPallet, ReplacePallet, SecurityPallet, TimestampPallet, UtilFuncs, VaultRegistryPallet,
DEFAULT_SPEC_NAME, SS58_PREFIX,
OraclePallet, RedeemPallet, ReplacePallet, SecurityPallet, SudoPallet, TimestampPallet, UtilFuncs,
VaultRegistryPallet, DEFAULT_SPEC_NAME, SS58_PREFIX,
};
pub use shutdown::{ShutdownReceiver, ShutdownSender};
pub use sp_arithmetic::{traits as FixedPointTraits, FixedI128, FixedPointNumber, FixedU128};
pub use sp_core;
pub use sp_runtime::{traits as FixedPointTraits, FixedPointNumber, FixedU128};
pub use std::collections::btree_set::BTreeSet;
use std::{marker::PhantomData, time::Duration};
use subxt::{config::polkadot::PolkadotExtrinsicParams, subxt, Config};
pub use types::*;

use std::time::Duration;
use subxt::{
config::{polkadot::PolkadotExtrinsicParams, SubstrateConfig},
subxt, Config,
};

pub const TX_FEES: u128 = 2000000000;
pub const MILLISECS_PER_BLOCK: u64 = 12000;
pub const BLOCK_INTERVAL: Duration = Duration::from_millis(MILLISECS_PER_BLOCK);

pub const BTC_RELAY_MODULE: &str = "BTCRelay";
pub const ISSUE_MODULE: &str = "Issue";
pub const SECURITY_MODULE: &str = "Security";
pub const SYSTEM_MODULE: &str = "System";
pub const VAULT_REGISTRY_MODULE: &str = "VaultRegistry";

pub const STABLE_BITCOIN_CONFIRMATIONS: &str = "StableBitcoinConfirmations";
pub const STABLE_PARACHAIN_CONFIRMATIONS: &str = "StableParachainConfirmations";
pub const DISABLE_DIFFICULTY_CHECK: &str = "DisableDifficultyCheck";

// TODO: possibly substitute CurrencyId, VaultId, H256Le
#[cfg_attr(
feature = "parachain-metadata-interlay",
subxt(
Expand All @@ -71,6 +72,11 @@ pub const DISABLE_DIFFICULTY_CHECK: &str = "DisableDifficultyCheck";
),
derive_for_type(path = "interbtc_primitives::VaultCurrencyPair", derive = "Eq, PartialEq"),
derive_for_type(path = "interbtc_primitives::VaultId", derive = "Eq, PartialEq"),
derive_for_type(path = "sp_runtime::DispatchError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_runtime::TransactionalError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_arithmetic::ArithmeticError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_runtime::TokenError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_runtime::ModuleError", derive = "serde::Deserialize"),
substitute_type(path = "primitive_types::H256", with = "::subxt::utils::Static<crate::H256>"),
substitute_type(path = "primitive_types::U256", with = "::subxt::utils::Static<crate::U256>"),
substitute_type(path = "primitive_types::H160", with = "::subxt::utils::Static<crate::H160>"),
Expand All @@ -88,10 +94,6 @@ pub const DISABLE_DIFFICULTY_CHECK: &str = "DisableDifficultyCheck";
with = "::subxt::utils::Static<crate::BtcAddress>"
),
substitute_type(path = "interbtc_primitives::CurrencyId", with = "crate::CurrencyId"),
substitute_type(
path = "frame_support::traits::misc::WrapperKeepOpaque",
with = "::subxt::utils::Static<crate::WrapperKeepOpaque>"
),
substitute_type(
path = "bitcoin::types::BlockHeader",
with = "::subxt::utils::Static<::module_bitcoin::types::BlockHeader>"
Expand Down Expand Up @@ -125,6 +127,11 @@ pub const DISABLE_DIFFICULTY_CHECK: &str = "DisableDifficultyCheck";
),
derive_for_type(path = "interbtc_primitives::VaultCurrencyPair", derive = "Eq, PartialEq"),
derive_for_type(path = "interbtc_primitives::VaultId", derive = "Eq, PartialEq"),
derive_for_type(path = "sp_runtime::DispatchError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_runtime::TransactionalError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_arithmetic::ArithmeticError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_runtime::TokenError", derive = "serde::Deserialize"),
derive_for_type(path = "sp_runtime::ModuleError", derive = "serde::Deserialize"),
substitute_type(path = "primitive_types::H256", with = "::subxt::utils::Static<crate::H256>"),
substitute_type(path = "primitive_types::U256", with = "::subxt::utils::Static<crate::U256>"),
substitute_type(path = "primitive_types::H160", with = "::subxt::utils::Static<crate::H160>"),
Expand All @@ -142,10 +149,6 @@ pub const DISABLE_DIFFICULTY_CHECK: &str = "DisableDifficultyCheck";
with = "::subxt::utils::Static<crate::BtcAddress>"
),
substitute_type(path = "interbtc_primitives::CurrencyId", with = "crate::CurrencyId"),
substitute_type(
path = "frame_support::traits::misc::WrapperKeepOpaque",
with = "::subxt::utils::Static<crate::WrapperKeepOpaque>"
),
substitute_type(
path = "bitcoin::types::BlockHeader",
with = "::subxt::utils::Static<::module_bitcoin::types::BlockHeader>"
Expand All @@ -166,12 +169,6 @@ pub const DISABLE_DIFFICULTY_CHECK: &str = "DisableDifficultyCheck";
)]
pub mod metadata {}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Default, Clone, Decode, Encode)]
pub struct WrapperKeepOpaque<T> {
data: Vec<u8>,
_phantom: PhantomData<T>,
}

#[derive(Debug, Clone, Eq, PartialEq)]
pub struct InterBtcRuntime;

Expand Down
9 changes: 4 additions & 5 deletions runtime/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pub use crate::ShutdownSender;
use crate::{
assets::LendingAssets,
conn::{new_websocket_client, new_websocket_client_with_retry},
metadata, notify_retry,
types::*,
AccountId, AssetRegistry, CurrencyId, Error, InterBtcRuntime, InterBtcSigner, RetryPolicy, RichH256Le, SubxtError,
AccountId, AssetRegistry, CurrencyId, Error, FixedU128 as UnsignedFixedPoint, InterBtcRuntime, InterBtcSigner,
RetryPolicy, RichH256Le, ShutdownSender, SubxtError,
};
use async_trait::async_trait;
use bitcoin::RawTransactionProof;
Expand All @@ -15,7 +15,7 @@ use module_bitcoin::{
parser::{parse_block_header, parse_transaction},
types::FullTransactionProof,
};
use primitives::{BalanceWrapper, UnsignedFixedPoint};
use primitives::BalanceWrapper;
use serde_json::Value;
use std::{convert::TryInto, future::Future, ops::Range, sync::Arc, time::Duration};
use subxt::{
Expand Down Expand Up @@ -557,8 +557,7 @@ impl InterBtcParachain {
}
#[cfg(test)]
fn lending_mock_market_from_id(&self, id: u32) -> metadata::runtime_types::loans::types::Market<Balance> {
use primitives::{Rate, Ratio};
use sp_runtime::FixedPointNumber;
use sp_runtime::{FixedPointNumber, FixedU128 as Rate, Permill as Ratio};

metadata::runtime_types::loans::types::Market::<Balance> {
close_factor: Static(Ratio::from_percent(50)),
Expand Down
Loading