Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Use Polkadot Constants instead of Hardcoding #868

Merged
merged 25 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4723a51
added Polkadot constants
Doordashcon Dec 18, 2021
b5ca45b
remove hardcoded constants
Doordashcon Dec 18, 2021
86f05c6
cargo +nightly fmt
Doordashcon Dec 18, 2021
9e224c3
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 20, 2021
0809b5d
add const existential deposit
Doordashcon Dec 20, 2021
ccc5025
update
Doordashcon Dec 21, 2021
b8f51e5
cargo +nightly fmt
Doordashcon Dec 21, 2021
6aec623
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 21, 2021
50c31f1
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 21, 2021
f0aedab
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 22, 2021
6bde2c7
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 22, 2021
8d9febd
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 26, 2021
02d37b6
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Dec 31, 2021
ea70ac7
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Jan 4, 2022
27f357c
not pulling
Doordashcon Jan 6, 2022
88ece77
readd constants.rs modules
Doordashcon Jan 6, 2022
c8513f2
update
Doordashcon Jan 6, 2022
1f22d4f
Cargo.lock
Doordashcon Jan 6, 2022
0089db8
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Jan 6, 2022
350ce65
update
Doordashcon Jan 6, 2022
cadd901
add balance constants
Doordashcon Jan 7, 2022
00aa8d4
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Jan 11, 2022
9e0395e
Update polkadot-parachains/statemine/src/constants.rs
Doordashcon Jan 11, 2022
e0c16f4
cargo fmt
Doordashcon Jan 12, 2022
207a089
Merge branch 'paritytech:master' into ddc-PCH-T1
Doordashcon Jan 12, 2022
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
3 changes: 3 additions & 0 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 pallets/dmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ pub mod pallet {
id, remaining, required,
));
}
},
}
}
}
// Cannot be an `else` here since the `maybe_enqueue_page` may have changed.
Expand Down
4 changes: 2 additions & 2 deletions pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,15 @@ impl<T: Config> Pallet<T> {
let index = Self::stash_overweight(sender, sent_at, overweight_xcm);
let e = Event::OverweightEnqueued(sender, sent_at, index, required);
Self::deposit_event(e);
},
}
Err(XcmError::WeightLimitReached(required))
if required <= max_weight =>
{
// That message didn't get processed this time because of being
// too heavy. We leave it around for next time and bail.
remaining_fragments = last_remaining_fragments;
break
},
}
Err(_) => {
// Message looks invalid; don't attempt to retry
},
Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/statemine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ parachains-common = { path = "../parachains-common", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
Expand Down
13 changes: 7 additions & 6 deletions polkadot-parachains/statemine/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
// limitations under the License.

pub mod currency {
use kusama_runtime_constants as constants;
use node_primitives::Balance;

/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9020).
Doordashcon marked this conversation as resolved.
Show resolved Hide resolved
pub const EXISTENTIAL_DEPOSIT: Balance = CENTS / 10;
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
gilescope marked this conversation as resolved.
Show resolved Hide resolved

pub const UNITS: Balance = 1_000_000_000_000;
pub const CENTS: Balance = UNITS / 30_000;
pub const GRAND: Balance = CENTS * 100_000;
pub const MILLICENTS: Balance = CENTS / 1_000;
pub const UNITS: Balance = constants::currency::UNITS;
pub const CENTS: Balance = constants::currency::CENTS;
pub const GRAND: Balance = constants::currency::GRAND;
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
// map to 1/10 of what the kusama relay chain charges (v9020)
apopiak marked this conversation as resolved.
Show resolved Hide resolved
(items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS) / 10
constants::currency::deposit(items, bytes) / 10
}
}

Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/statemint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ parachains-common = { path = "../parachains-common", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
Expand Down
13 changes: 7 additions & 6 deletions polkadot-parachains/statemint/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@

pub mod currency {
use node_primitives::Balance;
use polkadot_runtime_constants as constants;

/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9010).
pub const EXISTENTIAL_DEPOSIT: Balance = 10 * CENTS;
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
KiChjang marked this conversation as resolved.
Show resolved Hide resolved

pub const UNITS: Balance = 10_000_000_000;
pub const DOLLARS: Balance = UNITS;
pub const CENTS: Balance = UNITS / 100; // 100_000_000
pub const MILLICENTS: Balance = CENTS / 1_000; // 100_000
pub const UNITS: Balance = constants::currency::UNITS;
pub const DOLLARS: Balance = constants::currency::DOLLARS;
pub const CENTS: Balance = constants::currency::CENTS;
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
// 1/10 of Polkadot v9010
(items as Balance * 20 * DOLLARS + (bytes as Balance) * 100 * MILLICENTS) / 10
constants::currency::deposit(items, bytes) / 10
}
}

Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/westmint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ parachains-common = { path = "../parachains-common", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
westend-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
Expand Down
13 changes: 7 additions & 6 deletions polkadot-parachains/westmint/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@

pub mod currency {
use node_primitives::Balance;
use westend_runtime_constants as constants;

/// The existential deposit. Set to 1/10 of its parent Relay Chain.
pub const EXISTENTIAL_DEPOSIT: Balance = 100 * MILLICENTS;
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
KiChjang marked this conversation as resolved.
Show resolved Hide resolved

pub const UNITS: Balance = 1_000_000_000_000;
pub const CENTS: Balance = UNITS / 100;
pub const MILLICENTS: Balance = CENTS / 1_000;
pub const GRAND: Balance = CENTS * 100_000;
pub const UNITS: Balance = constants::currency::UNITS;
pub const CENTS: Balance = constants::currency::CENTS;
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
pub const GRAND: Balance = constants::currency::GRAND;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
// 1/10 of Westend testnet
(items as Balance * 100 * CENTS + (bytes as Balance) * 5 * MILLICENTS) / 10
constants::currency::deposit(items, bytes) / 10
}
}

Expand Down