Skip to content

Commit

Permalink
Reduce transaction byte fees to 10 micro per byte (#633)
Browse files Browse the repository at this point in the history
* Reduce tx byte fee by 10

* Updates runtime version pre-deploy
  • Loading branch information
crystalin authored Jul 21, 2021
1 parent 6f7f057 commit 771f8c0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
11 changes: 6 additions & 5 deletions runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ pub mod currency {
pub const MICROUNIT: Balance = MILLIUNIT / 1_000;
pub const NANOUNIT: Balance = MICROUNIT / 1_000;

pub const BYTE_FEE: Balance = 100 * MICROUNIT;
pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROUNIT;
pub const STORAGE_BYTE_FEE: Balance = 100 * MICROUNIT;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 1 * UNIT + (bytes as Balance) * BYTE_FEE
items as Balance * 1 * UNIT + (bytes as Balance) * STORAGE_BYTE_FEE
}
}

Expand Down Expand Up @@ -129,7 +130,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonbase"),
impl_name: create_runtime_str!("moonbase"),
authoring_version: 3,
spec_version: 0158,
spec_version: 0159,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -256,7 +257,7 @@ where
}

parameter_types! {
pub const TransactionByteFee: Balance = currency::BYTE_FEE;
pub const TransactionByteFee: Balance = currency::TRANSACTION_BYTE_FEE;
}

impl pallet_transaction_payment::Config for Runtime {
Expand Down Expand Up @@ -417,7 +418,7 @@ parameter_types! {
pub const MinimumDeposit: Balance = 4 * currency::UNIT;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
pub const PreimageByteDeposit: Balance = currency::BYTE_FEE;
pub const PreimageByteDeposit: Balance = currency::STORAGE_BYTE_FEE;
pub const InstantAllowed: bool = true;
}

Expand Down
11 changes: 6 additions & 5 deletions runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ pub mod currency {
pub const MICROGLMR: Balance = MILLIGLMR / 1_000;
pub const NANOGLMR: Balance = MICROGLMR / 1_000;

pub const BYTE_FEE: Balance = 100 * MICROGLMR;
pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROGLMR;
pub const STORAGE_BYTE_FEE: Balance = 100 * MICROGLMR;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 1 * GLMR + (bytes as Balance) * BYTE_FEE
items as Balance * 1 * GLMR + (bytes as Balance) * STORAGE_BYTE_FEE
}
}

Expand Down Expand Up @@ -130,7 +131,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonbeam"),
impl_name: create_runtime_str!("moonbeam"),
authoring_version: 3,
spec_version: 0158,
spec_version: 0159,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -271,7 +272,7 @@ where
}

parameter_types! {
pub const TransactionByteFee: Balance = currency::BYTE_FEE;
pub const TransactionByteFee: Balance = currency::TRANSACTION_BYTE_FEE;
}

impl pallet_transaction_payment::Config for Runtime {
Expand Down Expand Up @@ -432,7 +433,7 @@ parameter_types! {
pub const MinimumDeposit: Balance = 4 * currency::GLMR;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
pub const PreimageByteDeposit: Balance = currency::BYTE_FEE;
pub const PreimageByteDeposit: Balance = currency::STORAGE_BYTE_FEE;
pub const InstantAllowed: bool = false;
}

Expand Down
11 changes: 6 additions & 5 deletions runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ pub mod currency {
pub const MOVR: Balance = 1_000_000_000_000_000_000;
pub const KILOMOVR: Balance = 1_000_000_000_000_000_000_000;

pub const BYTE_FEE: Balance = 100 * MICROMOVR;
pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROMOVR;
pub const STORAGE_BYTE_FEE: Balance = 100 * MICROMOVR;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 1 * MOVR + (bytes as Balance) * BYTE_FEE
items as Balance * 1 * MOVR + (bytes as Balance) * STORAGE_BYTE_FEE
}
}

Expand Down Expand Up @@ -132,7 +133,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonriver"),
impl_name: create_runtime_str!("moonriver"),
authoring_version: 3,
spec_version: 0158,
spec_version: 0159,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -273,7 +274,7 @@ where
}

parameter_types! {
pub const TransactionByteFee: Balance = currency::BYTE_FEE;
pub const TransactionByteFee: Balance = currency::TRANSACTION_BYTE_FEE;
}

impl pallet_transaction_payment::Config for Runtime {
Expand Down Expand Up @@ -434,7 +435,7 @@ parameter_types! {
pub const MinimumDeposit: Balance = 4 * currency::MOVR;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
pub const PreimageByteDeposit: Balance = currency::BYTE_FEE;
pub const PreimageByteDeposit: Balance = currency::STORAGE_BYTE_FEE;
pub const InstantAllowed: bool = true;
}

Expand Down
11 changes: 6 additions & 5 deletions runtime/moonshadow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ pub mod currency {
pub const MICROMSHD: Balance = MILLIMSHD / 1_000;
pub const NANOMSHD: Balance = MICROMSHD / 1_000;

pub const BYTE_FEE: Balance = 100 * MICROMSHD;
pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROMSHD;
pub const STORAGE_BYTE_FEE: Balance = 100 * MICROMSHD;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 1 * MSHD + (bytes as Balance) * BYTE_FEE
items as Balance * 1 * MSHD + (bytes as Balance) * STORAGE_BYTE_FEE
}
}

Expand Down Expand Up @@ -129,7 +130,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonshadow"),
impl_name: create_runtime_str!("moonshadow"),
authoring_version: 3,
spec_version: 0158,
spec_version: 0159,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -270,7 +271,7 @@ where
}

parameter_types! {
pub const TransactionByteFee: Balance = currency::BYTE_FEE;
pub const TransactionByteFee: Balance = currency::TRANSACTION_BYTE_FEE;
}

impl pallet_transaction_payment::Config for Runtime {
Expand Down Expand Up @@ -431,7 +432,7 @@ parameter_types! {
pub const MinimumDeposit: Balance = 4 * currency::MSHD;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
pub const PreimageByteDeposit: Balance = currency::BYTE_FEE;
pub const PreimageByteDeposit: Balance = currency::STORAGE_BYTE_FEE;
pub const InstantAllowed: bool = false;
}

Expand Down

0 comments on commit 771f8c0

Please sign in to comment.