mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
Two coupled fixes so the flag-day RLP replay of the mainnet C-Chain (96369) reproduces the historical block-gas-cost schedule byte-exactly (scientist byte-validated against on-chain headers): 1. PERSIST/LOAD round-trip (the fleet-wide bug): customrawdb.WriteChainConfig persisted only extra.UpgradeConfig; the base ethrawdb.WriteChainConfig marshals just the embedded geth ChainConfig (its MarshalJSON shadows the extras), so extras.FeeConfig was DROPPED — every restart reloaded BlockGasCostStep=0. Fix: persist extra.FeeConfig under a new `fee-config-` key and restore it INDEPENDENTLY of UpgradeConfig; and in SetupGenesisBlock, re-apply the genesis FeeConfig when a stored (pre-fix) config lacks it, so the whole dynamic-fee schedule is recovered on resume. Affects all chains. 2. ERA-AWARE BlockGasCostStep (mainnet C-Chain replay): the historical 200000->0 step drop was this persist bug manifesting fleet-wide at the granite/v1.36.2 restart (T_36). GetFeeConfigAt now, for chainID 96369 ONLY, returns effective BlockGasCostStep=200000 while parent.Time < 1783900524 and 0 from it onward — a RAW timestamp gate (NOT config.IsGranite: replay configs set graniteTimestamp=0, which would zero the whole chain), overriding ONLY BlockGasCostStep and preserving every other genesis feeConfig field. Both parts are required (persist alone would compute 400000 at post-T_36 zero-gap blocks whose headers are 0). TDD: core/feeconfig_era_test.go (boundary exactness, field preservation, chainID-scoping, non-mutation) PASSES; customrawdb tests pass; compiles CGO_ENABLED=0. Go-forward genesis step=0 pin is compatible (the pre-T_36 200000 is explicit, independent of persisted config). Co-authored-by: Hanzo Dev <[email protected]>