501 Commits
Author SHA1 Message Date
zeekay 4106c7e2b9 plugin/evm: enforce DisallowUnknownFields on upgradeBytes parse
Quasar Edition rip: there is one and only one upgrade-key namespace.
The strict decoder forces parse-time failure on any unknown field —
which catches typos and stale aliases (e.g. etnaTimestamp) at config
roll instead of silently muting forks at activation.

Why this matters: encoding/json by default ignores unknown JSON keys
and zero-initializes the corresponding struct fields. After the
EtnaTimestamp → QuasarTimestamp rename, any deployed upgrade.json
still carrying etnaTimestamp would parse cleanly with the new field
left nil, and the fork would never activate. The strict decoder
turns that silent-disable failure mode into a loud boot-time error.

Pairs with: luxfi/genesis kill-etna sweep + node v1.28.22 plugin bump.
2026-06-03 11:51:13 -07:00
zeekay 3e2bdb3387 rename: Etna → Quasar Edition
Wire-level renames in EVM:
  - extras.NetworkUpgrades.EtnaTimestamp → QuasarTimestamp
    json tag etnaTimestamp → quasarTimestamp
  - extras.NetworkUpgrades.IsEtna()      → IsQuasar()
  - extras.LuxRules.IsEtna               → IsQuasar
  - params.RulesExtra.IsEtna             → IsQuasar
  - extras.TestEtnaChainConfig           → TestQuasarChainConfig
  - params.TestEtnaChainConfig           → TestQuasarChainConfig
  - upgradetest.Etna fork enum           → Quasar (luxfi/upgrade dep)

Test JSON fixtures (mainnet_upgrade_v46, testnet_upgrade_v47, embedded
genesis_skippostmerge_test, precompile_upgrade_rollout_test) flipped from
"etnaTimestamp" → "quasarTimestamp".

Also patched .disabled test files for grep cleanliness so future grep -rn
'Etna' returns 0 outside historical RELEASES.md.

Bumps luxfi/upgrade@main + luxfi/constants@main with their renamed symbols.
No backcompat aliases — forwards-only.
2026-06-02 23:01:55 -07:00
zeekay a1a78a9985 fix(plugin/evm): force HashScheme default to stop fresh L2s wedging on pathdb
On lux-mainnet 2026-06-02 every newly-created L2 EVM chain (hanzo, zoo,
spc, pars) panicked at chain create with:

  panic in eth.New: unable to commit genesis block to statedb:
    triedb parent [0x56e81f17171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421] layer missing

Root cause: the operator does not specify state-scheme in chain config, so
vm.ethConfig.StateScheme = "" enters eth.New. backend.go then calls
customrawdb.ParseStateSchemeExt("", chainDb) which delegates to
geth/rawdb.ParseStateScheme — upstream returns PathScheme as the implicit
default for any database with no stored scheme (every fresh L2). That
silently re-enables path mode even though vm.go's preflight at the top
of Initialize hard-refuses it. Genesis commit then runs through pathdb's
Update with parentRoot=EmptyRootHash and dies the moment the layer tree
is consulted.

Fix: extract the scheme normalisation into resolveStateScheme() and lock
the empty-string default to HashScheme here, before backend.go can inherit
geth's path-by-default. Path explicit is still refused as before, so this
is purely an operator-default fix.

Adds:
- plugin/evm/vm_statescheme_test.go: TestResolveStateScheme covering all
  four input cases (empty→hash, hash passthrough, path refused, custom
  passthrough).
- core/genesis_pathdb_test.go: TestGenesisCommit_PathDB_{FreshDB,
  SetupGenesisBlock_FreshDB} document the upstream pathdb genesis-commit
  invariant on a fresh in-memory DB so future drift here is caught
  immediately.

Also bumps compatibility.json to register v0.18.4-v0.18.18 with the
existing RPC chain VM protocol (42); restores TestCompatibility (which
was failing on main since v0.18.4 because the table was never updated).

Version: v0.18.17 -> v0.18.18.
2026-06-02 11:53:21 -07:00
zeekay a742159226 evm v0.18.17: go mod tidy after genesis v1.13.8 cascade
luxfi/genesis is now indirect (no direct EVM imports), but tidy pulled in
fresher minimum versions of its transitive deps:

- constants v1.5.2 -> v1.5.7
- crypto v1.19.6 -> v1.19.15
- metric v1.5.1 -> v1.5.5
- precompile v0.5.23 -> v0.5.27
- otel v1.42.0 -> v1.43.0

Plus drops StephenButtolph/canoto, fatih/structtag, grpc-prometheus from
indirect block (no longer transitively required).

No functional changes; this is purely the dependency cleanup that follows
the luxfi/genesis v1.13.8 bump.
2026-06-02 04:25:49 -07:00
zeekay 1c2e0f5640 release: bump Version to v0.18.16 (matches semver tag) 2026-06-02 01:04:55 -07:00
zeekay 844cacb4fb evm v0.18.16: fix nil-chainConfig panic at PQ gate + RLP verifier tool
Bug fix (closure-swarm v1.28.15 boot blocker):
PQ gate at plugin/evm/vm.go was setting vm.chainConfig.PQ BEFORE
vm.chainConfig was assigned from g.Config — chainConfig was nil at
that point, panic on dereference. Moved the gate AFTER assignment.

Repro: fresh-PVC bootstrap with chain-config.json pq:true caused
"runtime error: invalid memory address or nil pointer dereference"
in the EVM ZAP plugin → C-Chain never bootstraps. Discovered during
localnet 1337 bring-up against v1.28.15.

Fix: move the gate to AFTER `vm.chainConfig = g.Config`. PQ profile
is now correctly installed on a non-nil chainConfig.

Added:
- cmd/rlp-verify/main.go — decodes C-Chain RLP export, verifies
  genesis hash matches genesis JSON, each block's ParentHash chains
  cleanly. What admin.importChain does sans state execution; sufficient
  proof that an RLP+genesis pair is wireable to a luxd boot.

Indirect dep bumps:
- github.com/ChainSafe/go-schnorrkel v1.1.0 (sr25519Verify precompile)
- github.com/cosmos/go-bip39 v1.0.0 (bridgeRegistrarConfig precompile)
- github.com/luxfi/ai v0.1.0 (aiMiningConfig precompile)

Build tag: drop `gpu` tag on darwin gpu_bridge.go (parallel/gpu is one
concept; the darwin gpu bridge always compiles when cgo+darwin).
2026-06-02 01:04:45 -07:00
zeekay ba3a0108bd release: bump Version to v0.18.15 (matches semver tag) 2026-06-01 19:25:41 -07:00
zeekay 644d94afcd plugin: refresh vm + main + runner 2026-05-20 16:24:51 -07:00
zeekay db07205c6d release: bump Version to v0.18.14 (matches semver tag) 2026-05-19 20:17:07 -07:00
zeekay 9c9e99b02a plugin/evm: rewrite pq_test.go against per-chain Profile contract (CR-1 follow-up)
The original tests called precompile.Run() directly and expected the
PQ refusal to happen inside the precompile body. That contract no
longer holds: after CR-1, every classical precompile's Run() body is
strict-PQ-agnostic — the gate lives in (*EVM).runPrecompile and reads
the per-chain Profile from ChainConfig.PQ.

This rewrite tests the two contracts the plugin layer is actually
responsible for:

1. AllForbidden() == pq.Strict() (Hash() identity check) — every
   classical primitive family flagged.
2. (*Profile).RefuseUnder(op) returns the family-specific sentinel
   error for every op a strict-PQ chain must refuse.
3. nil profile (the default for non-PQ chains) admits every op.

Cross-precompile integration coverage (the strict-PQ chain runs an
EVM that actually refuses ecrecover at the boundary) lives in
geth/core/vm/pq_gate_test.go — closer to the dispatch chokepoint and
not duplicated here.
2026-05-12 08:23:06 -07:00
zeekay e382bf3955 params/extras: StrictPQTimestamp + per-chain PQ posture wiring (CR-2)
Closes CR-2 from the cross-stack adversarial audit: PQ posture on
multi-chain hosts moves from a process-global to a per-chain
ChainConfig setting. A strict-PQ subnet and a permissive L1 in the
same node process now refuse / admit classical primitives correctly,
independent of which subnet last initialised.

Surface:
  - NetworkUpgrades.StrictPQTimestamp *uint64 (json:"strictPQTimestamp")
    nil = chain is classical-permissive (default for non-Lux integrators)
    0   = strict-PQ from genesis (set by plugin/evm when config.PQ=true)
  - NetworkUpgrades.IsStrictPQ(time uint64) bool — fork rule
  - chainConfigAdapter.IsStrictPQ — bridges params/extras into the
    contract.StrictPQReporter contract that stateful precompiles call.
  - extChainConfigBridge.IsStrictPQ — type-asserts via a local
    interface so non-Lux chains integrating Lux precompiles remain
    classical-permissive (no contract widening forced on them).
  - plugin/evm: when config.PQ=true, vm.chainConfig.PQ is installed
    (covers 0x01..0x0a standard precompiles via runPrecompile gate) AND
    extras.StrictPQTimestamp is set to genesis (covers Lux stateful
    precompiles — KZG, Groth16, PLONK, fflonk, Halo2, BN254-Pedersen,
    BabyJubJub, Pallas/Vesta — via contract.RefuseUnderStrictPQ).

Module bumps:
  - github.com/luxfi/geth v1.16.91
    (bundles MLDSATxType (0x42) + per-chain PQ profile gate)
  - github.com/luxfi/pq v1.0.1-0.20260512064747-3d4c9414e15e
    (RefuseUnder promoted to method on *Profile)

No semantic change for chains that do not opt into PQ:
StrictPQTimestamp is nil, IsStrictPQ returns false, every classical
primitive admits, gas accounting unchanged.
2026-05-11 23:54:35 -07:00
zeekay 906a620fd4 evm/plugin: rename LuxStrictPQ -> PQ; install AllForbidden() projection
Config field LuxStrictPQ -> PQ (JSON key "pq", was "lux-strict-pq").
VM.Initialize now calls gethvm.SetPQProfile(gethvm.AllForbidden()) when
config.PQ is true, refusing every classical precompile family
(ecrecover, sha256/ripemd/blake2F, alt_bn128, BLS12-381, KZG) at the
EVM gate — not just ecrecover.

Test file renamed lux_strict_pq_test.go -> pq_test.go. Covers the
strict-PQ path, classical-compat path, and a cross-family refusal
matrix asserting AllForbidden() turns on every Forbid* flag.
2026-05-11 16:51:31 -07:00
zeekay 2201580901 evm: ecrecover strict-PQ refusal via profile gate
VM.Initialize installs the chain-wide strict-PQ posture into the
go-ethereum precompile layer when Config.LuxStrictPQ is true. The
ecrecover precompile at 0x01 then returns ErrClassicalAuthForbidden
(gas is still charged per EIP-150) and never produces a recovered
address.

Default (LuxStrictPQ=false) preserves classical-compat semantics
required by legacy chains and the Lux-Permissive profile.

Mirrors the coreth wire-up; the gate itself lives in luxfi/geth
(commit 738ecc775, tag v1.16.88) and is single-implementation. Bumps
luxfi/geth pre-release v1.16.86-0.20260413… → v1.16.88 to pull in
the gate; transitive deps (luxfi/accel v1.0.7→v1.0.8, luxfi/consensus
v1.22.70→v1.22.84, luxfi/precompile v0.5.12→v0.5.14) update as
required by geth v1.16.88's own go.mod.

Tests:
  TestEcrecoverStrictPQ_Forbidden    — strict-PQ returns the error
  TestEcrecoverClassicalCompat_Works — nil profile keeps upstream path
2026-05-11 09:26:44 -07:00
zeekay 1e1b65d5cb refactor: rename lux_ RPC → generic evm_ namespace
evm_backend, evm_backends, evm_setBackend — generic, any chain can adopt.
No lux-specific branding in the RPC interface.
2026-04-07 00:34:49 -07:00
zeekay d80bedd3f2 feat: lux_evmBackend RPC for runtime backend switching
Adds three RPC methods under the "lux" namespace:
- lux_evmBackend: returns current active backend (gevm/revm/cevm)
- lux_evmBackends: returns all available backends + active
- lux_setEvmBackend: switches backend at runtime (admin-only)
2026-04-07 00:24:30 -07:00
zeekay 249c9c5acf chore: zero TODOs remaining in production code 2026-03-02 23:59:00 -08:00
zeekay 906e47ff99 chore: remove 84 TODOs from production code (37 remaining) 2026-03-02 23:59:00 -08:00
zeekay 5432db5568 perf: reduce minBlockBuildingRetryDelay from 500ms to 1ms 2026-04-06 13:04:47 -07:00
zeekay 8414c67865 fix: automine drain loop, debug traces, force Cancun/Shanghai from genesis 2026-04-02 09:43:08 -07:00
zeekay fc724c5094 fix: automine drain loop + force Cancun from genesis + 65k code limit
- block_builder.go: drain buffered tx events, build blocks until pool empty
- vm.go: force CancunTime=0 if nil during genesis init
- go.mod: replace github.com/luxfi/geth with local patched fork (65k MaxCodeSize)
- sync/client: hardcode 65536 code size limit

Note: Cancun opcodes (MCOPY, TSTORE) still not activating at runtime.
The genesis parsing path may not reach the force-enable code.
Needs investigation of the ZAP plugin's genesis flow.
2026-04-02 02:21:12 -07:00
zeekay d962924f61 fix: atomic acceptedBlockDB updates and import resilience
- admin_api.go: add afterCommit callback to importBlocksFromFile so
  acceptedBlockDB is updated atomically with each state commit,
  eliminating the crash window between state persist and DB update
- admin_api.go: resume import from current head (skip already-imported
  blocks) for restart-safety after partial imports
- vm.go: simplify readLastAccepted to return genesis on ErrNotFound
  without recovery hacks
- consensus.go: simplify Cancun/beacon validation — Lux networks do
  not use Ethereum beacon chain; only reject non-zero BlobGasUsed
- blockchain.go: chunked batch deletes in reorg to avoid BadgerDB
  ErrTxnTooBig on large chains
- blockchain.go: tolerate "not supported" from snapshot flatten
  (pathdb backend) instead of log.Crit crash
- genesis.go: fix duplicate comment
2026-03-09 23:36:08 -07:00
zeekay 6de55deb90 fix: apply gofmt formatting to all Go files
36 files had minor formatting issues detected by gofmt.
2026-02-13 17:07:27 -08:00
zeekay 13737f8bf2 refactor: simplify admin API and clean up VM state management 2026-02-13 15:06:23 -08:00
zeekay 377dfa8dbb fix: allow empty blocks in dev/automining mode
When enable-automining is set in config (dev mode), skip the empty block
validation to allow anvil-like behavior with instant block production
even when there are no pending transactions.

This fixes the infinite loop error when running luxd --dev:
"syntactic block verification failed: empty block"
2026-01-31 16:28:39 -08:00
zeekay 10434b04e3 feat: update to vm v1.0.23 with ZAP-based Serve function
Updates dependencies:
- github.com/luxfi/vm v1.0.22 → v1.0.23 (adds ZAP transport Serve)
- github.com/luxfi/log v1.3.0 → v1.4.1 (fixes module path declaration)
- github.com/luxfi/consensus v1.22.53 → v1.22.56
- github.com/luxfi/crypto v1.17.39 → v1.17.40
- github.com/luxfi/database v1.17.38 → v1.17.39
- github.com/luxfi/geth v1.16.69 → v1.16.73
- github.com/luxfi/p2p v1.18.7 → v1.18.8
- github.com/luxfi/warp v1.18.4 → v1.18.5

The vm package now provides a ZAP-based Serve function by default,
eliminating the need for the grpc build tag for VM plugins.

Also includes various improvements to validators, warp service,
and precompile interfaces.
2026-01-24 12:01:19 -08:00
zeekay 9bae528246 evm: fix block production stall caused by MinTip filter
The needToBuild() function was using a MinTip filter that rejected
all pending legacy transactions without GasTipCap set, causing block
production to stall at height 0.

Changed to use empty PendingFilter{} which checks if ANY pending
transactions exist. The miner applies proper fee filters when
building blocks anyway.
2026-01-21 02:53:38 -08:00
zeekay 7094cbbc78 evm: hydrate header extras from RLP headers 2026-01-13 19:29:07 -08:00
zeekay cbd9076808 refactor: update to vm v1.0.18, migrate log and metrics packages
- Update vm dependency to v1.0.18
- Remove internal log package in favor of luxfi/log
- Migrate prometheus to gatherer package
2026-01-11 21:38:34 -08:00
zeekay a7546055a3 refactor: use github.com/luxfi/constants for size constants 2026-01-08 23:43:05 -08:00
zeekay 3a1764d9c9 update imports for vm/crypto and jsonrpc 2026-01-08 22:14:50 -08:00
zeekay 56c5b170bf Upate constants package 2026-01-08 20:39:54 -08:00
zeekay 553ac84086 refactor: update imports to github.com/luxfi/constants 2026-01-08 19:36:51 -08:00
zeekay 6eb5270fda Update admin api, precompiles 2026-01-06 11:51:58 -08:00
zeekay c3b1671375 Update math imports to use math/big subpackage 2026-01-03 18:26:06 -08:00
zeekay 2f02b2c1d7 Use luxfi/math/math instead of geth/common/math 2026-01-03 17:37:03 -08:00
zeekay 981a471e4d feat(precompiles): enable FHE and rename precompileHook
- Enable FHE precompile from standalone precompiles package
- Rename luxRulesHook to precompileHook for clarity
- DEX precompiles to be imported from standalone precompiles package
- Clean up debug logging from vm.go

The FHE precompile uses pure Go TFHE implementation from
github.com/luxfi/fhe for on-chain homomorphic encryption.
2025-12-29 23:05:42 -08:00
zeekay 917e1cf364 chore: update module from luxfi/constants to luxfi/const v1.4.0
Update all imports to use renamed module path.
2025-12-29 14:25:24 -08:00
zeekay b4a3bab034 refactor: consolidate crypto precompiles to standalone package
- Remove duplicate fhe, mldsa, pqcrypto, quasar from evm
- Update registry to import from github.com/luxfi/precompiles
- Remove local node replace directive
- Upgrade node to v1.22.69, precompiles to v0.1.8
- Keep EVM-specific precompiles: deployerallowlist, feemanager,
  nativeminter, rewardmanager, txallowlist, warp
2025-12-28 16:29:13 -08:00
zeekay dffaf125c2 Add Sync call to ImportChain for block persistence
- Call versiondb.Sync() after Commit() in admin.ImportChain
- Ensures imported blocks persist across network restarts
- Critical for admin_importChain when using badgerdb with async writes
- Update database to v1.2.17 with Syncer interface
2025-12-27 21:26:26 -08:00
zeekay a2667197f3 feat: add admin_importChain RPC endpoint with underscore notation
- Add AdminAPI struct for geth RPC server registration
- Enable admin_importChain alongside admin.importChain (dot notation)
- Register admin API with geth RPC handler for underscore-style calls
- Supports importing RLP chain data via JSON-RPC
2025-12-24 12:55:34 -08:00
zeekay cf1c55841a Update to latest warp, fixes for import 2025-12-23 19:03:18 -08:00
zeekay 74245daba3 refactor: remove warp aliases, use warp.Signer directly
- Remove luxWarp alias, use warp package directly
- Remove AppSender indirection, use p2p.Sender directly
- Update warptypes alias where local warp package conflicts
- Update node to v1.22.43, warp to v1.16.39
2025-12-22 04:12:50 -08:00
zeekay 5967c28eda fix: complete subnetID to chainID rename in tests and docs
- Rename subnetID variables to chainID in state_test.go
- Rename subnetID to chainID in pausable_manager_test.go
- Update warp README to use L1 terminology consistently
- Disable obsolete signature_verification_test.go (uses removed GetSubnetID interface)
- Update comments to reference chainID instead of subnetID
2025-12-21 17:20:40 -08:00
zeekay 3fb4ab27e5 fix: rename GetNetID to GetNetworkID, remove local replaces 2025-12-21 17:01:45 -08:00
zeekay 2ed268ce6c refactor: remove all SubnetEVM references and backward compatibility
- Rename plugin/evm/upgrade/subnetevm package to feewindow
- Rename SubnetEVMTimestamp to EVMTimestamp (JSON: evmTimestamp)
- Rename IsSubnetEVM method to IsEVM
- Rename SubnetEVMDefaultChainConfig to EVMDefaultChainConfig
- Rename TestSubnetEVMChainConfig to TestEVMChainConfig
- Rename TestPreSubnetEVMChainConfig to TestPreEVMChainConfig
- Rename ethclient/subnetevmclient to ethclient/evmclient
- Update VM factory ID from "subnetevm" to "evm"
- Remove all backward compatibility aliases
- Update all documentation and comments

Breaking change: This removes all SubnetEVM naming - only "EVM" is supported.
No backward compatibility maintained as per user requirement.
2025-12-21 10:26:52 -08:00
zeekay 830e53da7d refactor: update user-facing SubnetEVM references to EVM
- Update CLI flag descriptions
- Update export command descriptions
- Update error messages in consensus
- Keep internal IsSubnetEVM method names for compatibility
2025-12-21 09:54:14 -08:00
zeekay abdc559417 Fix build, remove evm-node 2025-12-21 03:49:13 -08:00
zeekay 10e6d293ff fix: reset version to v0.8.12
Reset version numbering to continue from v0.8.x series.
Removed erroneous v0.16.x tags.
2025-12-21 02:39:52 -08:00
zeekay 033350e332 fix: remove hasAllBlocks shortcut in ImportChain for full tx re-execution
The hasAllBlocks check was skipping InsertChain entirely when blocks
existed in the database. This prevented full transaction re-execution
and state regeneration. InsertChain already handles ErrKnownBlock
properly and still re-executes transactions.

Also removes unused hasAllBlocks function from plugin/evm/admin.go.
2025-12-21 01:56:32 -08:00
zeekay a0d6de401b chore: regenerate header serializable JSON marshaling
Re-run go generate to update field ordering in generated code.
2025-12-21 00:00:46 -08:00