Skip to content

Make the native and EVM transaction fees configurable - #1705

Draft
MOZGIII wants to merge 5 commits into
masterfrom
adjustable-fee
Draft

MOZGIII wants to merge 5 commits into
masterfrom
adjustable-fee

Conversation

@MOZGIII

@MOZGIII MOZGIII commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What

Makes the native and EVM transaction fees configurable at the state level.

The runtime prices fees from baseline constants that put a simple transfer at ~1 HMND / ~1 eHMND, and scales them by multipliers held in the state of the new pallet-humanode-fee-params.

Design

Multiplier Applies to Default
NativeFeeMultiplier WeightToFee and LengthToFee of pallet_transaction_payment 1
EvmFeeMultiplier FeeCalculator::min_gas_price of pallet_evm 2
  • The multipliers are FixedU128, so fractional values work.
  • Root sets them via set_native_fee_multiplier / set_evm_fee_multiplier; each emits an ...Updated event.
  • The defaults encode the intent that an EVM transfer costs double the native one: the native path is the more efficient way to transact, so it stays the one we push users towards.
  • The runtime plugs the pallet in through two adapters it exports: NativeWeightToFee<Runtime, Baseline> wrapping the existing ConstantMultipliers, and EvmFeeCalculator<Runtime, BaselineFeePerGas> replacing the former EvmFeePerGas.
  • Constants renamed to reflect their new role: WEIGHT_TO_FEE_BASELINE, LENGTH_TO_FEE_BASELINE, FEE_PER_GAS_BASELINE.

Upgrade path

Chains upgrading from the previous runtime keep their current fee levels. The EnactFeeMultipliers migration, driven by the pallet's storage version going 0 → 1, sets the multipliers to NativeFeeMultiplierBeforeFeeParams (10) and EvmFeeMultiplierBeforeFeeParams (15), which reproduce the previous WEIGHT_TO_FEE and FEE_PER_GAS values. The EVM one matches within 0.1%, as the old gas price was a hand-rounded number.

New networks start from the pallet defaults; 10 and 15 exist only in the migration.

Tests

  • Pallet: genesis, setters and origins, fractional values, the migration (enact, no-op, try-runtime hooks), and both adapters.
  • Runtime tests::fees: the existing cases follow the defaults of 1 and 2, and new cases change each multiplier and check the fee follows, plus one that runs the migration and checks the previous fee levels come out.
  • E2E base/rpc: the dev node expectations are 1 HMND / 2 eHMND, and new cases set each multiplier through sudo.

Reviewer notes

  • The weights in crates/humanode-runtime/src/weights/pallet_humanode_fee_params.rs are hand-written as a placeholder and need regenerating with utils/weights/benchmark-all.
  • spec_version bump goes in a separate PR, as usual.

@MOZGIII
MOZGIII force-pushed the adjustable-fee branch 2 times, most recently from 5d29ef1 to 47d2b24 Compare October 27, 2026 20:53
MOZGIII and others added 5 commits October 28, 2026 23:38
Adds a pallet that holds the native and EVM fee multipliers in the state,
with root-gated setters, defaults of 1 and 2, and a v1 migration that
enacts provided multipliers on chains upgrading from a runtime without
the pallet.
The fee constants become unit prices that put a basic transfer at 1 HMND
and 1 eHMND; the runtime scales them by the multipliers held in the state.
New networks start at the pallet defaults of 1 and 2, and the migration
enacts 10 and 15 on the chains upgrading from the previous runtime.
Covers changing each multiplier through a root call, the gas price
runtime API following the EVM multiplier, and the migration reproducing
the fee levels of the previous runtime.
The dev node fee expectations follow the pallet defaults of 1 and 2,
and new cases change each multiplier through sudo and check the fee
follows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant