diff --git a/crates/humanode-runtime/src/constants.rs b/crates/humanode-runtime/src/constants.rs index fa1a9bc8b..d2450a359 100644 --- a/crates/humanode-runtime/src/constants.rs +++ b/crates/humanode-runtime/src/constants.rs @@ -92,8 +92,9 @@ pub mod fees { /// The multiplier to get the fee from weight. /// /// We compute the fee to weight multiplier based on the weight of the `balances.transfer` call, - /// and try to fit the fee such that a single transfer call costs ~0.1 HMND. - pub const WEIGHT_TO_FEE: Balance = 385_000_000; + /// and try to fit the fee such that a single transfer call costs ~67 HMND: + /// the base value of `3_850_000_000` prices a single transfer at ~1 HMND. + pub const WEIGHT_TO_FEE: Balance = 67 * 3_850_000_000; /// The multiplier to get the fee from length. pub const LENGTH_TO_FEE: Balance = 1; @@ -109,10 +110,11 @@ pub mod evm_fees { /// The amount of fee per gas unit. /// Comes from the following rationale: /// - a simple transfer costs 21000 gas - /// - we want the cost of this transfer to be around ~0.2 HMND - /// - so we must charge about 0.2 * 10^18 / 21000 fee per a unit of gas - /// The value below is a nice round number that fits the requirements outlined above. - pub const FEE_PER_GAS: u128 = 10_000_000_000_000; + /// - we want the cost of this transfer to be around ~134 HMND + /// - so we must charge about 134 * 10^18 / 21000 fee per a unit of gas + /// The value below is a nice round number that fits the requirements outlined above: + /// the base value of `100_000_000_000_000` prices a single transfer at ~2 HMND. + pub const FEE_PER_GAS: u128 = 67 * 100_000_000_000_000; /// The max proof size ratio per block. /// Set to the zero as humanode is solo chain. Otherwise, additional used gas has diff --git a/crates/humanode-runtime/src/tests/fees.rs b/crates/humanode-runtime/src/tests/fees.rs index c5a08df72..c9b1cc7c7 100644 --- a/crates/humanode-runtime/src/tests/fees.rs +++ b/crates/humanode-runtime/src/tests/fees.rs @@ -178,7 +178,7 @@ fn switch_block() { AllPalletsWithSystem::on_initialize(System::block_number()); } -/// A test that validates that a simple balance transfer with a keep alive costs 0.1 HMND. +/// A test that validates that a simple balance transfer with a keep alive costs 67 HMND. #[test] fn simple_balances_transfer_keep_alive() { // Build the state from the config. @@ -213,8 +213,8 @@ fn simple_balances_transfer_keep_alive() { (call, len) }; - // The expected fee that we aim to target: 0.1 HMND. - let expected_fee = ONE_BALANCE_UNIT / 10; + // The expected fee that we aim to target: 67 HMND. + let expected_fee = 67 * ONE_BALANCE_UNIT; // The tolerance within which the actual fee is allowed to be around the expected fee. let epsilon = expected_fee / 200; @@ -223,7 +223,7 @@ fn simple_balances_transfer_keep_alive() { }) } -/// A test that validates that a simple EVM balance transfer with a keep alive costs 0.2 HMND. +/// A test that validates that a simple EVM balance transfer with a keep alive costs 134 HMND. /// Computes the fee via [`TransactionPayment::query_call_info`]. #[test] fn simple_evm_transaction_via_query_call_info() { @@ -258,8 +258,8 @@ fn simple_evm_transaction_via_query_call_info() { }), }); - // The expected fee that we aim to target: 0.2 HMND. - let expected_fee = ONE_BALANCE_UNIT / 5; + // The expected fee that we aim to target: 134 HMND. + let expected_fee = 134 * ONE_BALANCE_UNIT; // The tolerance within which the actual fee is allowed to be around the expected fee. let epsilon = expected_fee / 10; @@ -268,7 +268,7 @@ fn simple_evm_transaction_via_query_call_info() { }) } -/// A test that validates that a simple EVM balance transfer with a keep alive costs 0.2 HMND. +/// A test that validates that a simple EVM balance transfer with a keep alive costs 134 HMND. /// Computes the fee via an estimate EVM runner invocation. #[test] fn simple_evm_transaction_via_runner_estimate() { @@ -334,8 +334,8 @@ fn simple_evm_transaction_via_runner_estimate() { } ); - // The expected fee that we aim to target: 0.2 HMND. - let expected_fee = ONE_BALANCE_UNIT / 5; + // The expected fee that we aim to target: 134 HMND. + let expected_fee = 134 * ONE_BALANCE_UNIT; // The tolerance within which the actual fee is allowed to be around the expected fee. let epsilon = expected_fee / 10; diff --git a/utils/e2e-tests/ts/tests/base/rpc/eth.ts b/utils/e2e-tests/ts/tests/base/rpc/eth.ts index abf8299d0..5a116291c 100644 --- a/utils/e2e-tests/ts/tests/base/rpc/eth.ts +++ b/utils/e2e-tests/ts/tests/base/rpc/eth.ts @@ -43,7 +43,7 @@ describe("eth rpc", () => { describe("fee", () => { describe("when transferring 1 eHMND", () => { const transferValue = ethers.parseEther("1"); - const expectedFee = ethers.parseEther("0.2"); + const expectedFee = ethers.parseEther("134"); const tolerance = expectedFee / 10n; it("is within the tolerance around the expected cost", async () => {