Skip to content

Commit

Permalink
feat: add fast-inflation flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigoriy Simonov authored and CertainLach committed Nov 16, 2023
1 parent 83c9d63 commit 8b49ab6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js-packages/tests/creditFeesToTreasury.seqtest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function skipInflationBlock(api: ApiPromise): Promise<void> {
const blockInterval = inflationBlockInterval.toNumber();
const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
const currentBlock = head.number.toNumber();
if(currentBlock % blockInterval < blockInterval - 2) {
if(currentBlock % blockInterval < blockInterval - (blockInterval / 5)) {
unsubscribe();
resolve();
} else {
Expand Down
1 change: 1 addition & 0 deletions pallets/inflation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ std = [
'sp-std/std',
]
try-runtime = ["frame-support/try-runtime"]
fast-inflation = []

[dependencies]
parity-scale-codec = { workspace = true }
Expand Down
8 changes: 7 additions & 1 deletion runtime/common/config/pallets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ impl pallet_balances_adapter::Config for Runtime {
type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
}

// every time per how many blocks inflation is applied
#[cfg(feature = "fast-inflation")]
parameter_types! {
pub const InflationBlockInterval: BlockNumber = 10; // every time per how many blocks inflation is applied
pub const InflationBlockInterval: BlockNumber = 10;
}
#[cfg(not(feature = "fast-inflation"))]
parameter_types! {
pub const InflationBlockInterval: BlockNumber = 100;
}

/// Pallet-inflation needs block number in on_initialize, where there is no `validation_data` exists yet
Expand Down
1 change: 1 addition & 0 deletions runtime/opal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ lookahead = []
preimage = []
refungible = []
session-test-timings = []
fast-inflation = []

################################################################################
# local dependencies
Expand Down
1 change: 1 addition & 0 deletions runtime/quartz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ governance = []
preimage = []
refungible = []
session-test-timings = []
fast-inflation = []

################################################################################
# local dependencies
Expand Down
1 change: 1 addition & 0 deletions runtime/unique/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ governance = []
preimage = []
refungible = []
session-test-timings = []
fast-inflation = []

################################################################################
# local dependencies
Expand Down

0 comments on commit 8b49ab6

Please sign in to comment.