Skip to content

feat(vyper): recover historical storage layouts#2881

Open
banteg wants to merge 6 commits into
argotorg:stagingfrom
banteg:feat/vyper-historical-storage-layouts
Open

feat(vyper): recover historical storage layouts#2881
banteg wants to merge 6 commits into
argotorg:stagingfrom
banteg:feat/vyper-historical-storage-layouts

Conversation

@banteg

@banteg banteg commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • recover Vyper storage layouts from 0.1.0-beta.16 through 0.4.1b3 with the exact compiler package in an isolated uv process
  • preserve historical allocator semantics, nested HashMap order, struct members, module namespaces, fixed-array/Bytes spans, and compiler-assigned lock positions
  • recover and expose Vyper transient storage layouts from 0.3.8, including splitting the mixed persistent/transient namespace emitted by 0.3.80.3.10
  • keep 0.4.1b4+ on the existing native Standard JSON path and treat supplemental extraction failure as non-fatal
  • compile releases without GitHub binary assets through the same exact Python fallback and make multi-source output selection work across old formatters
  • persist and expose recovered layouts through the existing API v2 storageLayout and transientStorageLayout fields, with an identity-checked resumable backfill for existing rows

Extraction matrix

Vyper releases Source of truth
0.1.0-beta.160.2.12 compiler GlobalContext positions (legacy hashed-composite roots)
0.2.130.2.15 annotated AST/compiler-assigned positions
0.2.160.4.1b3 native layout captured before the historical Standard JSON formatter drops it, enriched from compiler type objects
0.3.80.3.10 transient native slots split into persistent and transient namespaces using the compiler AST's is_transient metadata
0.4.00.4.1b3 transient native transient_storage_layout captured with persistent layout
0.4.1b4+ unchanged native Standard JSON layout

Structured historical types stay backward-compatible with Sourcify's flat Vyper layout: each affected leaf gets an optional type_definitions graph. Definitions are leaf-scoped, so initialized modules and same-name imported structs remain accurate without changing native leaf type/slot/span values.

Persistence and operations

  • API v2 returns persistent artifacts via storageLayout and Vyper transient artifacts via the existing transientStorageLayout field.
  • The private backfill update is atomic and only succeeds when compiler version, target, settings, additional input, and the full path-to-source-content map exactly match the stored compilation identity.
  • A resumable, one-representative-per-compilation backfill config is included under services/database/massive-replace-script/vyper-storage-layout-backfill.
  • The server image and affected CircleCI jobs install pinned uv 0.11.21.
  • The frontend's hard-coded pre-0.4.1 warning remains a separate follow-up once this backend is deployed.

Validation

  • npm test in packages/compilers — 29 passing; historical exact-package cases remain opt-in
  • exact Vyper 0.3.8 and 0.4.0 transient-layout probes — 2 passing, covering both the mixed and separate compiler namespaces
  • direct exact-package probes passed for the previously broken 0.4.0b1 and RC compiler-data APIs; the opt-in CI matrix also covers 0.4.0b1 and 0.4.0rc5
  • npm run build — compilers-types, compilers, and lib-sourcify
  • focused VyperCompilation persistent/transient extraction test passes
  • focused server database persistence test passes
  • Etherscan utility suite — 29 passing
  • custom replacement unit suite — 3 passing
  • Ruff, Prettier, YAML parsing, backfill config syntax, and git diff --check pass

The full server integration suite requires its Postgres/local-chain services and is left to CI. Local ESLint invocation is currently blocked before file analysis by the checkout's ESLint 8/flat-config dependency mismatch (ERR_PACKAGE_PATH_NOT_EXPORTED); TypeScript builds and focused tests are clean.

@banteg
banteg marked this pull request as ready for review July 11, 2026 15:19
@banteg
banteg marked this pull request as draft July 11, 2026 17:52
@banteg

banteg commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

not ready yet, will also add transient storage layout extraction

@banteg
banteg marked this pull request as ready for review July 11, 2026 18:46
@marcocastignoli

Copy link
Copy Markdown
Member

not ready yet, will also add transient storage layout extraction

is it now ready?

@banteg

banteg commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

is it now ready?

yes, it's ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

2 participants