Skip to content

docs: reference system-contract bytecode via versioned artifacts#340

Open
RealiCZ wants to merge 3 commits into
mainfrom
cz/doc/bytecode-artifact-refs
Open

docs: reference system-contract bytecode via versioned artifacts#340
RealiCZ wants to merge 3 commits into
mainfrom
cz/doc/bytecode-artifact-refs

Conversation

@RealiCZ

@RealiCZ RealiCZ commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the inline deployed-bytecode hex blobs on the system-contract spec pages (Oracle v1.0.0/v1.1.0/v2.0.0, KeylessDeploy v1.0.0, MegaAccessControl v1.0.0, MegaLimitControl v1.0.0, SequencerRegistry v1.0.0) with references to the canonical versioned artifacts under crates/system-contracts/artifacts/.
  • Each Deployed bytecode: entry now shows a truncated prefix, a link to the artifact JSON (deployedBytecode field), and a cast keccak/jq one-liner that re-derives the code hash; the code hash stated on each page remains the normative identity of the bytes.
  • This removes ~11 KB of hex that duplicated data already hash-verified at build time by crates/system-contracts/build.rs, following the OP Stack specs precedent: the code hash is the normative anchor, full bytes live outside the prose page.
  • Docs only; no behavior change.

Verification

  • Every replaced blob was compared byte-for-byte against its artifact's deployedBytecode before deletion, and every stated code hash equals the artifact's codeHash.
  • The verification command shown on each page was executed for all seven artifacts and reproduces the stated code hash.
  • All seven artifact links point to files present on main.

@RealiCZ RealiCZ added spec:unchanged No change to any `mega-evm`'s behavior comp:misc Changes to the miscellaneous part of this repo api:unchanged No change to the public interface or API comp:doc Changes in the documentation labels Jul 16, 2026
@github-actions

Copy link
Copy Markdown

🧬 Mutation testing

No results at target/mutants/mutants.out — nothing was mutated (e.g. no mutatable changes).

@github-actions

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Nothing to test — no mutants were generated on the changed lines.

@RealiCZ RealiCZ removed the comp:misc Changes to the miscellaneous part of this repo label Jul 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cd972833f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/spec/system-contracts/keyless-deploy.md

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Clean

  • Reviewed a docs-only change that replaces inline hex blobs on 5 system-contract spec pages with truncated prefixes plus links to the versioned artifact JSONs and a cast keccak/jq reproduction recipe.
  • Verified against crates/system-contracts/artifacts/: all 7 artifact files exist, every truncated prefix matches its artifact deployedBytecode, and every Code hash: in the docs equals its artifact codeHash.
  • Code hash remains the normative anchor, and the version-pinned filenames (Oracle-1.0.0.json, etc.) keep the main-branch links stable for frozen spec versions.
  • No new actionable findings. No prior review threads to reconcile.

@flyq flyq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. State the working directory for the verification command.
    jq -r .deployedBytecode crates/system-contracts/artifacts/… assumes the reader runs it from a repo checkout root; the spec pages are published on docs.megaeth.com where that context is not obvious.
    A short lead-in such as "From the repository root:" above the code block (once per page) would remove the ambiguity.
  2. Consider one sentence making the hash's normative role explicit.
    The PR body says "the code hash stated on each page remains the normative identity of the bytes", but no page says this in so many words.
    A single sentence on the system-contracts overview page (e.g. "The code hash is the normative identity of a contract version; the linked artifact JSON is the canonical source of the full bytes.") would make the intent survive future edits.
    The truncated 12-byte prefixes are cosmetic either way — all seven start with the same Solidity prologue (0x6080604052…), so they carry no discriminating value and could equally be dropped.

Host each version's deployed bytecode under docs/spec/static/bytecode/ (OP-specs convention) instead of linking implementation-repo artifact paths, and add a consistency test pinning the static files 1:1 to the versioned artifacts.
@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 366 untouched benchmarks


Comparing cz/doc/bytecode-artifact-refs (29f0c80) with main (999c516)

Open in CodSpeed

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 1 finding

  • Summary: Re-review of the second commit that publishes each system-contract version's full deployed bytecode under docs/spec/static/bytecode/, links it from the spec pages, adds docs/spec/AGENTS.md guidance, and introduces docs_bytecode_consistency to pin the static files 1:1 to the versioned artifacts.
  • The refactor cleanly addresses the earlier immutability concern (bytes now live in-spec, no blob/main mutation surface) and the new test makes the invariant enforceable.
  • Inline comments: 1 anchorable finding posted on a changed line.
  • Body-only items: none.

Still open from earlier reviews: none (prior Codex thread is resolved and the previous Claude review posted a Clean verdict).

Comment thread crates/system-contracts/tests/docs_bytecode_consistency.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29f0c80ea2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/system-contracts/tests/docs_bytecode_consistency.rs Outdated
Comment thread docs/spec/system-contracts/overview.md Outdated
Comment thread crates/system-contracts/tests/docs_bytecode_consistency.rs Outdated
Back to referencing versioned artifact JSONs directly; add a working-directory lead-in to the verification commands and state the code hash's normative role on the overview page.
@RealiCZ

RealiCZ commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

@flyq
Thanks for the review — both suggestions taken:

  1. The verification lead-in on every page now reads "To verify the code hash, from the repository root:". It is attached to each code block (rather than once per page) so that each version section on the Oracle page stays self-contained for readers who deep-link to a specific version.
  2. Added to the system-contracts overview (Deployment Semantics): "The code hash stated on each contract page is the normative identity of that contract version. The artifact JSON linked on each page is the canonical source of the full deployed bytecode."

On the truncated prefixes: kept them intentionally. The format follows the OP specs convention, where the prefix is likewise the shared Solidity prologue plus a full-bytecode link:

https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/ecotone/derivation.md#gaspriceoracle-deployment

It serves as a visual cue that the value is bytecode, not as a discriminator.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Clean

  • Reviewed the re-review scope: the third commit (9dfb3ee) reverted the static-bytecode-files approach; the PR now contains only doc-only changes across overview.md and six system-contract pages, replacing inline hex blobs with a truncated prefix, an artifact-JSON link, and a cast keccak ... deployedBytecode ... reproduction command.
  • Verified the artifact JSON fields the new commands target (deployedBytecode, codeHash) exist in each referenced artifact, and the code hashes stated in the docs match the artifacts.
  • No new actionable findings from me this round.

Resolved from earlier rounds:

  • My prior [Minor] on the reverted crates/system-contracts/tests/docs_bytecode_consistency.rs skip logic — that file no longer exists in this PR.

Still open from earlier rounds (other reviewer, unchanged status — flagging for awareness, not re-litigating):

  • High-Precision Timestamp not covered by the new overview.md claim — HPT has a HIGH_PRECISION_TIMESTAMP_ORACLE_CODE_HASH in crates/mega-evm/src/system/oracle.rs but no artifact JSON and no code-hash entry on high-precision-timestamp.md, so the new sentence about the linked artifact JSON being the canonical source of the full deployed bytecode does not quite hold for that page.

@RealiCZ
RealiCZ requested a review from flyq July 17, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:unchanged No change to the public interface or API comp:doc Changes in the documentation spec:unchanged No change to any `mega-evm`'s behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants