Files
coreth/params/pq_precompiles.go
zeekay ab4e6d78a4 decomplect: delete upstream upgrade surface (NetworkUpgrades fields, LuxRules predicates, upgrade subpackages); activate-all-implicitly from genesis
Phase 3a of the upstream-upgrade purge per ~/work/lux/proofs/UPGRADE_RIP.md (coreth slice).

params/extras:
- NetworkUpgrades collapses to an empty struct (was 6 *uint64 fork-time
  fields). All predicate methods (IsApricotPhase1..Post6, IsBanff, IsCortina,
  IsDurango, IsEtna, IsFortuna, IsGranite) are kept as constant-true so the
  large callsite surface in plugin/evm + precompile/contracts keeps
  compiling. GetNetworkUpgrades(upgrade.Config) ignores its input.
- LuxRules drops the 14 upgrade-name bool fields, keeps only IsGenesis
  (the one field with real dynamic semantics — set per-block by the header
  pipeline for pre-EVM historical-block treatment).

params:
- TestChainConfig is the single canonical config (all upgrades live from
  genesis). TestLaunch/Apricot{1..6,Pre6,Post6}/Banff/Cortina/Durango/Etna/
  Fortuna/GraniteChainConfig are alias vars pointing to TestChainConfig.
- PrecompiledContracts{Apricot{Phase2,Pre6,Phase6},Banff} consolidated into
  PrecompiledContractsLux (single canonical builtin set). PQ crypto
  precompiles fold into the same set.
- SetEthUpgrades unconditionally pins Shanghai+Cancun to 0 (was gated on
  Durango/Etna timestamps that no longer exist).
- config.go drops the unused luxfi/upgrade + luxfi/constants imports.

plugin/evm/header:
- gas_limit.go: GasLimit/VerifyGasLimit/GasCapacity/RemainingAtomicGasCapacity
  collapse to the Fortuna dynamic-fee path. ap0/ap1/ap5/cortina subpackage
  imports removed.
- base_fee.go: BaseFee collapses to the Fortuna dynamic-fee path; the
  isLuxChain discriminator and pre-AP3 nil-base-fee branch are gone.
- extra.go: VerifyExtra / PredicateBytesFromExtra / SetPredicateBytesInExtra
  collapse to the LP-176 (Fortuna) layout. ap0/ap3 imports removed.

consensus/dummy:
- verifyHeaderGasFields and verifyBlockGasCost drop the isLuxChain and
  isGenesisEVM carve-outs that were gating on Fortuna/Granite presence.

core:
- genesis.go: drops the isLuxChain BaseFee discriminator; every Lux chain
  pins BaseFee at genesis.
- state_transition.go: removes the rulesExtra.IsFortuna/IsGranite/
  IsApricotPhase1/IsDurango fields from the gas-calculation debug log.

Old chaindata wire compat is intentionally broken (NetworkUpgrades JSON
shape changed; codec is unaffected because chain config is consensus-state,
not on-chain).

Build: `GOCACHE=/tmp/gocache-decomplect-r2 GOWORK=off go build ./...` green
(plugin/evm/atomic/vm has a pre-existing missing-go.sum-entry for
luxfi/proto/p/fx that is unrelated to this rip).
2026-05-18 22:38:51 -07:00

55 lines
1.9 KiB
Go

// Copyright (C) 2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package params
import (
"github.com/luxfi/coreth/precompile/contract"
"github.com/luxfi/geth/common"
"github.com/luxfi/precompile/mldsa"
"github.com/luxfi/precompile/pqcrypto"
"github.com/luxfi/precompile/slhdsa"
pqcontract "github.com/luxfi/precompile/contract"
)
// pqPrecompileAdapter wraps a precompiles.StatefulPrecompiledContract to implement
// coreth's contract.StatefulPrecompiledContract interface.
type pqPrecompileAdapter struct {
inner pqcontract.StatefulPrecompiledContract
}
// Run implements contract.StatefulPrecompiledContract.
// The PQ crypto precompiles don't use AccessibleState, so we can safely pass nil.
func (p *pqPrecompileAdapter) Run(
_ contract.AccessibleState,
caller common.Address,
addr common.Address,
input []byte,
suppliedGas uint64,
readOnly bool,
) (ret []byte, remainingGas uint64, err error) {
return p.inner.Run(nil, caller, addr, input, suppliedGas, readOnly)
}
// PQCryptoPrecompiles returns the post-quantum cryptography precompiles.
// These provide ML-DSA, SLH-DSA, and ML-KEM signature verification and key encapsulation.
var PQCryptoPrecompiles = map[common.Address]contract.StatefulPrecompiledContract{
// ML-DSA (FIPS 204) - Lattice-based signatures
mldsa.ContractMLDSAVerifyAddress: &pqPrecompileAdapter{inner: mldsa.MLDSAVerifyPrecompile},
// SLH-DSA (FIPS 205) - Hash-based signatures
slhdsa.ContractSLHDSAVerifyAddress: &pqPrecompileAdapter{inner: slhdsa.SLHDSAVerifyPrecompile},
// PQCrypto - General post-quantum operations including ML-KEM
pqcrypto.ContractAddress: &pqPrecompileAdapter{inner: pqcrypto.PQCryptoPrecompile},
}
func init() {
// PQ crypto precompiles are part of the canonical Lux built-in set under
// activate-all-implicitly.
for addr, precompile := range PQCryptoPrecompiles {
PrecompiledContractsLux[addr] = precompile
}
}