Skip to content

feat(chain): the 2 GiB PoW target is measured, and it is unreachable - #3

Merged
savvaniss merged 2 commits into
mainfrom
deep-research
Jul 29, 2026
Merged

feat(chain): the 2 GiB PoW target is measured, and it is unreachable#3
savvaniss merged 2 commits into
mainfrom
deep-research

Conversation

@savvaniss

Copy link
Copy Markdown
Contributor

Summary

Part of an estate-wide remediation of the 49-ticket defect register in audit.md, sequenced by the phase plan in upgrade.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 typecheck passes across every workspace in this repo.
  • Each ticket carries a reproduction of its documented failure, then evidence that it no longer occurs.
  • Findings that survived adversarial review were sent back for a repair pass before landing.

What has NOT been verified

Stated plainly so review effort goes to the right places:

  • No end-to-end run of the assembled stack. Typechecks and unit tests are not the same as driving the feature. docker compose build returns exit 0 while cancelling every target, so a green build here would prove nothing anyway.
  • Some tickets in the wider programme came back partial or INCOMPLETE; where any of those touch this repo they are listed in the commit body rather than hidden.
  • Documentation corrections were verified against source, but the estate has a history of docs drifting from code — treat prose changes as claims to check, not conclusions.

🤖 Generated with Claude Code

Savvanis Spyros and others added 2 commits July 29, 2026 23:40
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>
@savvaniss
savvaniss merged commit 5774dd8 into main Jul 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant