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

feat: limit xcm transfers #727

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
24 changes: 24 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion crates/currency/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ pub mod pallet {
/// ## Configuration
/// The pallet's configuration trait.
#[pallet::config]
pub trait Config: frame_system::Config + orml_tokens::Config<Balance = BalanceOf<Self>> {
pub trait Config:
frame_system::Config + orml_tokens::Config<Balance = BalanceOf<Self>, CurrencyId = primitives::CurrencyId>
{
type UnsignedFixedPoint: FixedPointNumber<Inner = BalanceOf<Self>>
+ TruncateFixedPointToInt
+ Encode
Expand Down
51 changes: 51 additions & 0 deletions crates/xcm-limit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[package]
name = "xcm-limit"
version = "1.2.0"
authors = ["Interlay Ltd"]
edition = "2021"

[dependencies]
serde = { version = "1.0.130", default-features = false, features = ["derive"], optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }

fixed-hash = { version = "0.7.0", default-features = false, features = ["byteorder"] }
log = { version = "0.4.14", default-features = false }

visibility = { version = "0.0.1", optional = true }

# Substrate dependencies
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false, optional = true }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.26" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.26" }

[features]
default = ["std"]
std = [
"serde",
"codec/std",
"scale-info/std",

"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",

"frame-support/std",
"frame-system/std",
"frame-benchmarking/std",

"xcm/std",
"xcm-executor/std"
]
64 changes: 64 additions & 0 deletions crates/xcm-limit/src/default_weights.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//! Autogenerated weights for clients-info
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-12-13, STEPS: `100`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128

// Executed Command:
// target/release/interbtc-standalone
// benchmark
// --chain
// dev
// --execution=wasm
// --wasm-execution=compiled
// --pallet
// clients-info
// --extrinsic
// *
// --steps
// 100
// --repeat
// 10
// --output
// crates/clients-info/src/default_weights.rs
// --template
// .deploy/weight-template.hbs


#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weight functions needed for vault_registry.
pub trait WeightInfo {
fn set_current_client_release() -> Weight;
fn set_pending_client_release() -> Weight;
}

/// Weights for vault_registry using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn set_current_client_release() -> Weight {
(4_130_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}

fn set_pending_client_release() -> Weight {
(4_130_000 as Weight)
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn set_current_client_release() -> Weight {
(4_130_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}

fn set_pending_client_release() -> Weight {
(4_130_000 as Weight)
}
}
Loading