mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
The 0x9999 DEX precompile must see the true (networkID, cChainID) and prove an ERC-20 has live code, on BOTH paths: - block processing: ApplyTransactionWithResults now threads bc.ConsensusContext() onto blockContext.ConsensusContext when absent (nil-guarded; the miner's NewEVMBlockContext already sets it). The stale "StatefulPrecompileHook not exposed" note is removed — vm.NewEVM preserves ConsensusContext onto evm.Context. - eth_call/estimateGas: ChainContext.ConsensusContext now returns the backend blockchain's consensus context (which embeds the chain Runtime via runtime.WithContext), not the RPC request context — the latter made every identity-reading precompile see networkID 0 / C-Chain Empty (fail-closed) on eth_call. EthAPIBackend.ConsensusContext exposes it. - stateDBBridge.GetCodeSize forwards EXTCODESIZE to the internal StateDB so the OnChainAssetVerifier's C1 live-code proof works; returns -1 (not 0) when unavailable so the value path fails CLOSED rather than admit a fabricated zero. Adds cmd/dexlive (real end-to-end 0x9999 value-path harness over a running localnet C-Chain: deploy 2 ERC-20s, open market, seed maker, taker swap, read DEXFill + balance deltas; synthetic/no-code negative control must revert) and the consensus-identity unit tests for both paths.