ethereum / ethereum/state-actor

Stream per-address pattern code (lazy Code from templates through writers)

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
12
Forks
11
PR merge metrics
No merged PRs in 30d

Description

`create2_deploys`/`create_preimage_deploys` with `code_pattern: unique_jumpdest_pre_amsterdam` materialize one unique 24,576-byte runtime per derived contract inside `Expand`'s returned slice, and `generator.Config.materializePreAlloc` then retains every blob in `Config.GenesisCode` for the entire run — peak RSS grows ≈24.6 KB per derived contract (measured: 247.8 MB at 10k contracts, GC-bracketed heap probe; linear → ≈3.7 GB at `spec-repricing-min.yaml`'s 150k, ≈37 GB at 1.5M), while `Storage` already streams via `iter.Seq2`.

PR #76's interim guard (added during review hardening) only warns above 2 GiB estimated residency and hard-fails above 64 GiB. Actually bounding residency requires:

- a lazy `Code` source on `templates.PreAllocEntity` (e.g. `CodeFn func() []byte` or a code iterator alongside `Storage`),
- teaching `generator.Config.materializePreAlloc` not to pin the bytes in `GenesisCode`,
- updating every client writer (geth, besu, nethermind, reth) to emit code per-entity and release it.

**Acceptance:** building `examples/spec-repricing-min.yaml` shows peak RSS independent of `salt_count`; cross-client genesis roots byte-identical to today's; the 2 GiB specbuild warning removed or demoted.

Related: `TODO(template-aware-budget)` in `internal/specbuild/build.go` (per-template `ProjectCost`) — a sibling blind spot in the same seam, kept separate.

Contributor guide

Open the contributing guide

Research direction

Start with Expand and generator.Config.materializePreAlloc, then trace templates.PreAllocEntity into the geth, besu, nethermind, and reth writers. Use examples/spec-repricing-min.yaml to measure peak RSS and compare cross-client genesis roots with current output. Done means residency is independent of salt_count, roots remain byte-identical, and the 2 GiB warning is removed or demoted.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.