Skip to content

Reorganization of OTF patches on top of the correct branch#60

Open
l0r1s wants to merge 13 commits intofrontier-stable2506-otf-patchesfrom
frontier-stable2506-otf-patches-reorg
Open

Reorganization of OTF patches on top of the correct branch#60
l0r1s wants to merge 13 commits intofrontier-stable2506-otf-patchesfrom
frontier-stable2506-otf-patches-reorg

Conversation

@l0r1s
Copy link
Copy Markdown

@l0r1s l0r1s commented Apr 6, 2026

Reorganize OTF patches on Frontier

Motivation

Previously, our OTF-specific patches lived on master, interleaved with upstream Frontier commits. This made it hard to tell what was ours vs upstream, and upgrading to a new Frontier release meant cherry-picking our changes out of a mixed history.

This branch applies our patches as clean, isolated commits on top of an unmodified upstream stable2506 tag. Each future Frontier upgrade gets its own version branch with the patches reapplied, making the OTF delta explicit and rebases straightforward.

Patches

1. Balance conversion between Substrate and EVM

Substrate uses 9-decimal balances, EVM expects 18 decimals. This patch introduces a BalanceConverter trait with into_evm_balance and into_substrate_balance methods, along with EvmBalance and SubstrateBalance wrapper types. The conversion is applied at every boundary: account_basic (reporting balances to RPC), withdraw_fee / correct_and_deposit_fee (gas fee lifecycle), and transfer (EVM value transfers). The OnChargeEVMTransaction trait signatures change from raw U256 to EvmBalance to enforce type safety. A () identity implementation is provided as the default for test environments, and the template runtime uses SubtensorEvmBalanceConverter with a 1e9 factor.

2. Contract creation whitelisting

Adds WhitelistedCreators and DisableWhitelistCheck storage items to pallet-evm, along with set_whitelist and disable_whitelist extrinsics (sudo-gated, call_index 4 and 5). The whitelist is enforced in the runner's validate() method for contract creation (target.is_none()). When the check is enabled and the source address is not in the whitelist, the transaction fails with NotAllowed. DisableWhitelistCheck is exposed in the EVM genesis config so dev chains can disable it at genesis.

3. Uniform transaction priority (MEV prevention)

Disables priority fee-based transaction ordering to prevent MEV. In stack.rs, max_priority_fee_per_gas is forced to None regardless of what the transaction specifies. In ethereum/lib.rs, the transaction pool priority is hardcoded to 1 for all EVM transactions instead of being computed from gas price or tip. The tip component is always zero; base fees are burned as usual.

4. Aura and Babe consensus data providers

Adds client/aura and client/babe crates that implement consensus data providers needed by the OTF runtime. These provide slot-based block authoring support for frontier's block import pipeline.

5. Precompile code metadata fix

Modifies account_code_metadata to return size: 1 and the empty code hash for precompile addresses. This allows contract calls to precompiles (e.g. IPrecompile.call) to succeed by bypassing the code size check that would otherwise reject calls to addresses with no deployed code.

l0r1s added 10 commits April 6, 2026 16:41
- Introduced `fc-aura` and `fc-babe` packages for Aura and Babe consensus mechanisms.
- Updated `Cargo.toml` to include new dependencies and features for both consensus providers.
- Implemented `AuraConsensusDataProvider` and `BabeConsensusDataProvider` with necessary methods for digest creation.
- Adjusted existing RPC configurations to accommodate new consensus data providers.
@l0r1s l0r1s marked this pull request as ready for review April 6, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant