feat(chain): the 2 GiB PoW target is measured, and it is unreachable - #3
Merged
Conversation
CF-11 is the finding that matters. Every block this chain has ever produced, in tests, in CI and on the compose testnet, used a 64 KiB scratchpad. The documented mainnet intent is 2 GiB, and no code had ever executed at it. Measured: 6.57 ms at 64 KiB, 24.0 s at 256 MiB, 185.7 s and 2,165 MiB peak RSS at 2 GiB. Against a 15 s block time one attempt is 12x the whole block interval, and a 200-block getblocks page is ~10.3 core-hours. The walk costs 1.31x, not 8x, so the pad is the cost and it is CPU-bound. params.js now carries POW_MAX_SCRATCH_KIB and refuses to start above it, so a node configured for the intended value declines to boot rather than mining a chain nothing can validate. Six documents that called this a two-constant edit now say it is unreachable. The 3-node measurement network is recorded as unmeasured rather than estimated: at 185.7 s per attempt its first block is ~13 core-hours, so the measurement that justified it is the one saying it cannot run. CF-10 — defer hashing rather than re-rooting both tries on every mutation: 35.3 s and 212.1 MiB per full block become 5.2 s and 9.2 MiB, and five times the state-trie width now costs 1.00x rather than 1.31x. GeneralStateTests re-run at 20,077/20,077. setStorage still materialises the storage root per write and is written up rather than half-fixed. CF-09 — cap RPC execution gas and add a time budget. CF-12 — speculative execution gets its own store, so an eth_call no longer writes into the state that also holds consensus. CF-27 — the genesis hash is in the p2p handshake. Two nodes with the same network name and different genesis used to connect happily and disagree for ever, silently. CF-28 — refuse a genesis.json whose chainId disagrees with HEARTH_NETWORK. CF-29 — the explorer-api suite is green; the fixture owned the bug. CF-26 — the status paragraphs in five documents, and twelve more that asserted the old behaviour, now match what the code does. CF-13 — the explorer and wallet reach the chain over JSON-RPC through a second nginx location, leaving /rpc/ on REST so the miner keeps working. CF-30 — the chain id resolves from configuration once, rather than 7411 being hardcoded in six places while the testnet runs 7412. Deliberately not adopted from eth_chainId: a hostile rpc parameter would then choose what you sign for. Also present: the JSON-RPC method families each client class needs — the filter family, net_peerCount, eth_feeHistory, and block-transaction-by-index. No WebSocket surface; 8546 stays reserved for v2 eth_subscribe. Co-Authored-By: Claude <noreply@anthropic.com>
This repo has no root package.json and pnpm/action-setup looks for one at the repo root regardless of the job working-directory, so the DeFi contracts job failed at setup with "No pnpm version is specified" before a single contract compiled. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of an estate-wide remediation of the 49-ticket defect register in
audit.md, sequenced by the phase plan inupgrade.md. Each ticket was resolved against its own Done when boxes, then handed to an independent reviewer told to assume it was not fixed and to walk the ticket's How it fails scenario through the new code.Verification
pnpm typecheckpasses across every workspace in this repo.What has NOT been verified
Stated plainly so review effort goes to the right places:
docker compose buildreturns exit 0 while cancelling every target, so a green build here would prove nothing anyway.partialorINCOMPLETE; where any of those touch this repo they are listed in the commit body rather than hidden.🤖 Generated with Claude Code