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

Increase target block fullness to 50% #2692

Merged
merged 3 commits into from
Mar 4, 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
2 changes: 1 addition & 1 deletion runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ parameter_types! {
= U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS);
/// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees with. Blocks filled less
/// than this will decrease the weight and more will increase.
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(50);
/// The adjustment variable of the runtime. Higher values will cause `TargetBlockFullness` to
/// change the fees more rapidly. This fast multiplier responds by doubling/halving in
/// approximately one hour at extreme block congestion levels.
Expand Down
20 changes: 10 additions & 10 deletions runtime/moonbase/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2932,37 +2932,37 @@ mod fee_tests {

assert_eq!(
sim(1_000_000_000, Perbill::from_percent(0), 1),
U256::from(999_000_500),
U256::from(998_002_000),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do these hardcoded values come from? If we use a formula maybe compute expected value with the formula?

);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(25), 1),
U256::from(1_000_000_000),
U256::from(999_000_500),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(50), 1),
U256::from(1_001_000_500),
U256::from(1_000_000_000),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(100), 1),
U256::from(1_003_004_500),
U256::from(1_002_002_000),
);

// 1 "real" hour (at 12-second blocks)
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(0), 300),
U256::from(740_818_257),
U256::from(548_811_855),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(25), 300),
U256::from(1_000_000_000),
U256::from(740_818_257),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(50), 300),
U256::from(1_349_858_740),
U256::from(1_000_000_000),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(100), 300),
U256::from(2_459_599_798u128),
U256::from(1_822_118_072u128),
);

// 1 "real" day (at 12-second blocks)
Expand All @@ -2972,11 +2972,11 @@ mod fee_tests {
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(25), 7200),
U256::from(1_000_000_000),
U256::from(125_000_000),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(50), 7200),
U256::from(1_339_429_158_283u128),
U256::from(1_000_000_000u128),
);
assert_eq!(
sim(1_000_000_000, Perbill::from_percent(100), 7200),
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ parameter_types! {
= U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS);
/// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees with. Blocks filled less
/// than this will decrease the weight and more will increase.
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(50);
/// The adjustment variable of the runtime. Higher values will cause `TargetBlockFullness` to
/// change the fees more rapidly. This low value causes changes to occur slowly over time.
pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(4, 1_000);
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ parameter_types! {
= U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS);
/// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees with. Blocks filled less
/// than this will decrease the weight and more will increase.
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(50);
/// The adjustment variable of the runtime. Higher values will cause `TargetBlockFullness` to
/// change the fees more rapidly. This low value causes changes to occur slowly over time.
pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(4, 1_000);
Expand Down
4 changes: 2 additions & 2 deletions test/suites/dev/moonbase/test-fees/test-fee-multiplier-max.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describeSuite({
blockNumber = (await context.polkadotJs().rpc.chain.getHeader()).number.toBigInt();
baseFeePerGas = (await context.viem().getBlock({ blockNumber: blockNumber }))
.baseFeePerGas!;
expect(baseFeePerGas).to.equal(124_883_131_084_512n);
expect(baseFeePerGas).to.equal(124_758_310_508_112n);
noandrea marked this conversation as resolved.
Show resolved Hide resolved

const rawSigned = await createEthersTransaction(context, {
to: contractAddress,
Expand Down Expand Up @@ -171,7 +171,7 @@ describeSuite({
expect(withdrawEvents?.length).to.equal(1);
const withdrawEvent = withdrawEvents![0];
const amount = withdrawEvent.event.data.amount.toBigInt();
expect(amount).to.equal(11_880_382_026_331_795_584n);
expect(amount).to.equal(11_868_507_595_257_710_784n);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this hardcoded value come from?

},
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
// export const TARGET_FILL_AMOUNT =
// ((MAX_BLOCK_WEIGHT * 0.75 * 0.25 - EXTRINSIC_BASE_WEIGHT) / MAX_BLOCK_WEIGHT) * 1_000_000_000;
// In 0.9.43 rootTesting::fillBlock() now uses more weight so we need to account for that
const TARGET_FILL_AMOUNT = 186_927_918;
const TARGET_FILL_AMOUNT = 374_427_918;

// Note on the values from 'transactionPayment.nextFeeMultiplier': this storage item is actually a
// FixedU128, which is basically a u128 with an implicit denominator of 10^18. However, this
Expand Down
Loading