Skip to content

Commit

Permalink
Merge pull request #649 from galacticcouncil/apopiak/defer-duration-c…
Browse files Browse the repository at this point in the history
…onfig

fix!: Configure Defer Duration
  • Loading branch information
mrq1911 authored Dec 8, 2023
2 parents 7653ecc + 422f5f7 commit e8bb419
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
8 changes: 4 additions & 4 deletions 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 integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.0.0"
version = "1.0.1"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion pallets/marketplace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-marketplace"
version = "5.0.16"
version = "5.0.17"
authors = ["GalacticCoucil"]
description = "The marketplace for trading NFTs"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion pallets/xyk-liquidity-mining/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-xyk-liquidity-mining"
version = "1.1.9"
version = "1.1.10"
description = "Liquidity mining"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion runtime/basilisk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "basilisk-runtime"
version = "107.0.0"
version = "108.0.0"
authors = ["GalacticCouncil"]
edition = "2021"
homepage = "https://github.com/galacticcouncil/Basilisk-node"
Expand Down
2 changes: 1 addition & 1 deletion runtime/basilisk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("basilisk"),
impl_name: create_runtime_str!("basilisk"),
authoring_version: 1,
spec_version: 107,
spec_version: 108,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
19 changes: 18 additions & 1 deletion runtime/basilisk/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,25 @@ impl pallet_xcm::Config for Runtime {
type RemoteLockConsumerIdentifier = ();
}

#[test]
fn defer_duration_configuration() {
use sp_runtime::{traits::One, FixedPointNumber, FixedU128};
/// Calculate the configuration value for the defer duration based on the desired defer duration and
/// the threshold percentage when to start deferring.
/// - `defer_by`: the desired defer duration when reaching the rate limit
/// - `a``: the fraction of the rate limit where we start deferring, e.g. 0.9
fn defer_duration(defer_by: u32, a: FixedU128) -> u32 {
assert!(a < FixedU128::one());
// defer_by * a / (1 - a)
(FixedU128::one() / (FixedU128::one() - a)).saturating_mul_int(a.saturating_mul_int(defer_by))
}
assert_eq!(
defer_duration(600 * 4, FixedU128::from_rational(9, 10)),
DeferDuration::get()
);
}
parameter_types! {
pub DeferDuration: RelayChainBlockNumber = 100; // 10 min
pub DeferDuration: RelayChainBlockNumber = 600 * 36; // 36 hours
pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days
}

Expand Down

0 comments on commit e8bb419

Please sign in to comment.