EVM state machine with system contract integration
Overview
The Fenines execution layer implements a fully EVM-compatible state machine with modifications to support consensus-driven system transactions and native staking primitives. The architecture maintains Ethereum compatibility while extending functionality through precompiled system contracts at deterministic addresses.
EVM Version: London (EIP-1559 compatible) Gas Model: Dynamic base fee with burn mechanism State Model: Modified Patricia Merkle Trie System Contracts: 4 precompiled addresses
State Machine Architecture
State Transition Function
The state transition function extends Ethereum’s model:Υ(σ,T)=σ′∪TXsystemwhere:
σ = World state at block n−1
T = Set of user transactions
TXsystem = System transactions (at epoch boundaries)
σ′ = Resulting world state at block n
Epoch-Aware Transitions
State evolution branches based on block position:σn={ProcessBlock(σn−1,Tn)ProcessEpoch(σn−1,Tn,TXsys)if nmod200=0if nmod200=0
System Contract Framework
Contract Deployment Strategy
System contracts are genesis-embedded with immutable addresses:
Address
Contract
Type
Purpose
0x0000...1000
FenineSystem
Logic
Validator & delegator management
0x0000...1001
NFTPassport
Logic
Whitelist & referral system
0x0000...1002
TaxManager
Logic
Tax calculation & burn mechanism
0x0000...1003
RewardManager
Storage
Dynamic reward configuration
0xFFFF...FFFF
FeeRecorder
EOA
Gas fee accumulation
These addresses are consensus-critical. Changing them requires a hard fork.
// Called at epoch boundary (TX 1)function updateValidatorCandidates() external// Called at epoch boundary (TX 2)function distributeBlockReward(uint256 reward) external// Called at epoch boundary (TX 3)function syncRewardState() external
Access Control:require(msg.sender=block.coinbase)Only the current block validator can call system functions.
These slots are consensus-critical and must match exactly across all nodes.
// Slot 11 (0x0B): activeValidatorSet.length// Used by consensus engine for reward routingbytes32 constant ACTIVE_VALIDATOR_SET_SLOT = bytes32(uint256(11));// Dynamic array elements at:// keccak256(slot) + index
Portion of gas fees are burned:Burnedn=BaseFeen×GusedThis creates deflationary pressure:Supplyn+1=Supplyn+Rblock−BurnednNetwork becomes deflationary when:Burned>Rblock⟺BaseFee×Gused>1 FENBreak-even Analysis:BaseFeebreak-even=Gused1018For Gused=15M (target):BaseFeebreak-even≈66.67 gwei
Gas Price Priority
Transaction ordering within a block follows:Priority(tx)=min(maxFeePerGas,maxPriorityFeePerGas+baseFee)Transactions sorted by priority descending.
System Transaction Execution
Exemption Rules
System transactions bypass standard checks:
Check
User TX
System TX
Balance ≥ gasLimit × maxFee
✅ Required
❌ Exempt
Nonce sequential
✅ Required
✅ Required
Signature valid
✅ Required
✅ Required
Gas limit ≤ block limit
✅ Required
✅ Required
Implementation:
func (st *StateTransition) preCheck() error { // Skip balance check for system transactions if st.isSystemTx() { return nil } // Standard balance check if st.state.GetBalance(st.from) < requiredBalance { return ErrInsufficientFunds } return nil}
Execution Order
At epoch blocks, transactions execute in strict order:Oexec=[TXsys,1,TXsys,2,TXsys,3,TXuser,1,…,TXuser,n]Ordering Guarantee:∀i<j:nonce(TXi)<nonce(TXj)
State Commitment
After all transactions execute, state root computed:StateRoot=Keccak256(MPT(σn))where MPT = Modified Patricia Merkle Trie.