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

Reduce the base fee on Polkadot System Chains #398

Merged
merged 12 commits into from
Jul 25, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Bounties: Remove payout delay ([polkadot-fellows/runtimes#386](https://github.com/polkadot-fellows/runtimes/pull/386))
- Polkadot System Chains: Reduce the base transaction fee by half
Copy link
Member

Choose a reason for hiding this comment

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

Should please follow the standard convention of how we mention them here. Will fix it in my MR now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. Another thing we should add to the CI check.


## [1.2.8] 03.07.2024

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) {
owner: *owner == t.receiver.account_id,
amount: *amount == expected_foreign_asset_amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Issued { .. }) => {},
]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) {
owner: *owner == t.receiver.account_id,
amount: *amount == expected_foreign_asset_amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Issued { .. }) => {},
]
);
}
Expand Down
10 changes: 5 additions & 5 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1811,11 +1811,11 @@ mod tests {
/// Weight is being charged for both dimensions.
#[test]
fn weight_charged_for_both_components() {
let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(10_000, 0));
let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(20_000, 0));
assert!(!fee.is_zero(), "Charges for ref time");

let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(0, 10_000));
assert_eq!(fee, CENTS, "10kb maps to CENT");
let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(0, 20_000));
assert_eq!(fee, CENTS, "20kb maps to CENT");
}

/// Filling up a block by proof size is at most 30 times more expensive than ref time.
Expand All @@ -1836,10 +1836,10 @@ mod tests {
}

#[test]
fn test_transasction_byte_fee_is_one_tenth_of_relay() {
fn test_transasction_byte_fee_is_one_twentieth_of_relay() {
let relay_tbf = polkadot_runtime_constants::fee::TRANSACTION_BYTE_FEE;
let parachain_tbf = TransactionByteFee::get();
assert_eq!(relay_tbf / 10, parachain_tbf);
assert_eq!(relay_tbf / 20, parachain_tbf);
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ frame_support::parameter_types! {
/// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Polkadot
/// BridgeHub.
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`)
pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 177_594_900;
pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 88_797_450;

/// Transaction fee that is paid at the Polkadot BridgeHub for delivering single inbound message.
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`)
pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 942_248_365;
pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 471_124_182;

/// Transaction fee that is paid at the Polkadot BridgeHub for delivering single outbound message confirmation.
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_confirmation_transaction` + `33%`)
pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 172_377_865;
pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 86_188_932;
}

/// Compute the total estimated fee that needs to be paid in DOTs by the sender when sending
Expand Down
4 changes: 2 additions & 2 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,9 @@ mod tests {
use super::*;

#[test]
fn test_transasction_byte_fee_is_one_tenth_of_relay() {
fn test_transasction_byte_fee_is_one_twentieth_of_relay() {
let relay_tbf = polkadot_runtime_constants::fee::TRANSACTION_BYTE_FEE;
let parachain_tbf = TransactionByteFee::get();
assert_eq!(relay_tbf / 10, parachain_tbf);
assert_eq!(relay_tbf / 20, parachain_tbf);
}
}
4 changes: 2 additions & 2 deletions system-parachains/collectives/collectives-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,8 +1194,8 @@ fn test_ed_is_one_tenth_of_relay() {
}

#[test]
fn test_transasction_byte_fee_is_one_tenth_of_relay() {
fn test_transasction_byte_fee_is_one_twentieth_of_relay() {
let relay_tbf = polkadot_runtime_constants::fee::TRANSACTION_BYTE_FEE;
let parachain_tbf = TransactionByteFee::get();
assert_eq!(relay_tbf / 10, parachain_tbf);
assert_eq!(relay_tbf / 20, parachain_tbf);
}
12 changes: 6 additions & 6 deletions system-parachains/constants/src/polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ pub mod fee {

/// Cost of every transaction byte at Polkadot system parachains.
///
/// It is the Relay Chain (Polkadot) `TransactionByteFee` / 10.
pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS;
/// It is the Relay Chain (Polkadot) `TransactionByteFee` / 20.
pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS / 2;

/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
/// node's balance type.
Expand Down Expand Up @@ -122,9 +122,9 @@ pub mod fee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// In Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// The standard system parachain configuration is 1/10 of that, as in 1/100 CENT.
// The standard system parachain configuration is 1/20 of that, as in 1/200 CENT.
let p = super::currency::CENTS;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
let q = 200 * Balance::from(ExtrinsicBaseWeight::get().ref_time());

smallvec![WeightToFeeCoefficient {
degree: 1,
Expand All @@ -140,9 +140,9 @@ pub mod fee {
impl WeightToFeePolynomial for ProofSizeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// Map 10kb proof to 1 CENT.
// Map 20kb proof to 1 CENT.
let p = super::currency::CENTS;
let q = 10_000;
let q = 20_000;

smallvec![WeightToFeeCoefficient {
degree: 1,
Expand Down
Loading