Skip to content

Rebase foundation: clean upstream ancestry + repeatable workflow + 2.x conflict map#344

Open
Richard1048576 wants to merge 5 commits into
mainfrom
feat/rebase-reth-2.x
Open

Rebase foundation: clean upstream ancestry + repeatable workflow + 2.x conflict map#344
Richard1048576 wants to merge 5 commits into
mainfrom
feat/rebase-reth-2.x

Conversation

@Richard1048576

Copy link
Copy Markdown
Collaborator

Goals (per request)

  1. Attempt rebasing onto latest upstream reth and surface what it takes.
  2. Make future rebases cheap — no more giant from-scratch conflict every time.

This PR delivers the foundation + process for both. It contains no reth source changes — the actual conflict resolution + revm fork bump are scoped as follow-up PRs (sequence below). Safe to review/merge independently.

What was found

  • Gravity-reth is based on upstream reth v1.8.3; upstream's forward line is now v2.x (latest stable v2.2.0; v1.11 was the last 1.x). The earlier draft targeting v1.11.4 was wrong — that's a side-branch maintenance tag, not on the forward line.
  • Why every past rebase exploded: the fork's git ancestry to upstream is broken. reth trees were imported as squashed commits (e.g. d620fd0e "merge reth-v1.8.3" is single-parent, not a real merge), so upstream tags aren't ancestors of main and git rebase replays garbage.
  • Dependency reality: moving to v2.2.0 means bumping four Galxe forks in lockstep — revm 29 → 38 (9 major, the long pole), grevm, alloy-evm, revm-inspectors — plus MSRV 1.88 → 1.93.

The fix (in this PR)

  1. Re-anchored the fork onto the real upstream v1.8.3 tag → tag gravity-base/v1.8.3-clean-ancestry. This restores clean git ancestry so git rebase --onto <new> <base> works. Once the 2.x rebase lands, main will have v2.2.0 as a real ancestor and this never needs doing again.
  2. scripts/rebase-upstream.sh — wraps the correct --onto form (reth cuts maintenance releases on side branches, so plain git rebase <tag> picks the wrong base — discovered + handled here), guards the base tag, auto-backups, prints a categorized conflict map.
  3. Real conflict map from a trial git rebase --onto v2.2.0 v1.8.3: 111 conflicting files (28 substantive / 43 medium / 40 mechanical), subsystem heatmap, consensus-critical cluster flagged.
  4. Durable fix documented: conflict count ≈ number of upstream files we edit inline. Shrink it by moving Gravity logic into owned crates / extension traits (the Gravity-owned crates already produce zero conflicts). Do this opportunistically while resolving each subsystem.

Files

File Purpose
docs/design/rebase-to-reth-2.x-plan.md full migration plan (target, deps, layered strategy, phases, risks, effort)
docs/design/upstream-rebase-workflow.md why rebases hurt + the one-time fix + recurring workflow + durable surface-shrink
docs/design/rebase-2.x-conflict-map.md measured 111-file conflict map + 7-PR landing sequence
scripts/rebase-upstream.sh the repeatable rebase command

Follow-up PR sequence (in conflict-map §4)

PR 1 revm/grevm/alloy-evm fork bumps → PR 2 scaffolding compiles → PR 3 execution/EVM → PR 4 engine → PR 5 storage/trie/stages → PR 6 periphery+tests → PR 7 mainnet-block-replay state-root verification.

Open decisions for the team (plan doc §9)

  1. Confirm target v2.2.0 (vs main tip revm-40, vs staged 1.11→2.x).
  2. What's driving the rebase? (a specific upstream feature/fix may be a cheaper targeted backport than a full migration)
  3. Owner for the revm 29→38 bump (the critical path).
  4. MSRV 1.93 toolchain/CI coordination.

Not done here (deliberately)

No conflict resolution, no dependency bump, no compile — those need the revm fork ready + a compile/test loop, and consensus-critical files (state-root: merkle stage, trie, evm execute) must not be blind-merged. Tracked as the follow-up PRs.

🤖 Generated with Claude Code

…lict map

Establishes the foundation for migrating Gravity-reth onto upstream
reth 2.x and for making every *future* rebase cheap.

Root cause of past pain: the fork's git ancestry to upstream is broken
(reth trees were imported as squashed commits, so upstream tags are not
ancestors of main → `git rebase` replays garbage). Fix: re-anchor the
fork tree onto the real upstream v1.8.3 tag (preserved as tag
gravity-base/v1.8.3-clean-ancestry), restoring clean ancestry so
`git rebase --onto <new> <base>` works from now on.

Adds:
- docs/design/upstream-rebase-workflow.md — why rebases were painful,
  the one-time re-anchor fix, the recurring workflow, the reth
  release-branch `--onto` gotcha, and the durable fix (shrink the
  inline-modification surface by moving Gravity logic into owned
  crates / extension traits).
- docs/design/rebase-2.x-conflict-map.md — measured trial-rebase
  result: 111 conflicting files (28 substantive / 43 medium / 40
  mechanical), subsystem heatmap, consensus-critical cluster, and a
  7-PR landing sequence.
- scripts/rebase-upstream.sh — wraps the correct `--onto` form, guards
  that the base tag is a real ancestor, auto-backups, and prints a
  categorized conflict map. No auto-resolve, no push.

No reth source changes in this PR. The actual conflict resolution +
revm 29→38 fork bump are the follow-up PRs (sequence in the conflict
map doc §4).
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Your PR title doesn't follow the Conventional Commit guidelines.

Example of valid titles:

  • feat: add new user login
  • fix: correct button size
  • docs: update README

Usage:

  • feat: Introduces a new feature
  • fix: Patches a bug
  • chore: General maintenance tasks or updates
  • test: Adding new tests or modifying existing tests
  • bench: Adding new benchmarks or modifying existing benchmarks
  • perf: Performance improvements
  • refactor: Changes to improve code structure
  • docs: Documentation updates
  • ci: Changes to CI/CD configurations
  • revert: Reverts a previously merged PR
  • deps: Updates dependencies

Breaking Changes

Breaking changes are noted by using an exclamation mark. For example:

  • feat!: changed the API
  • chore(node)!: Removed unused public function

Help

For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/

Evaluation of the reth-2.x critical-path dependency (Galxe/revm).

Key findings:
- Gravity's revm fork = 2 semantic commits over upstream revm 29.
- fee-charge-disable: upstream adopted it natively (optional_fee_charge
  feature) → DROP Gravity's version on forward-port.
- lazy-reward: not upstreamed; the real port (~20 files threading
  ResultAndReward + is_lazy_reward through handler/inspector). This is
  essentially the entire remaining fork delta.
- Trial rebase onto revm 38: small Gravity edits landing in
  heavily-rewritten upstream files (op-revm/handler.rs: +1006 upstream
  vs 10 Gravity). Difficulty is API-shape understanding, not volume.
- Net: the "9-major revm bump" long pole collapses to porting ONE
  consensus-critical feature + adopting one upstream feature.

Doc kept in gravity-reth (not the revm fork) to keep the revm fork
minimal — every Gravity line in revm conflicts on the next bump.
…lant

PR 1 (the 4 dependency forks) is complete and tested — the reth-2.2.0
transplant is now unblocked. Records:

- §6: all 4 Galxe forks done with branches + test counts
  (revm v38.0.0-gravity 420, alloy-evm v0.34.0-gravity 51,
  grevm feat/revm-38 14, revm-inspectors v0.39.0-gravity 42),
  plus the git-tip-vs-crates.io version-genealogy lesson that
  determined every fork's base commit.
- §7: ready-to-paste [patch.crates-io] redirecting all revm-family
  crates to the Galxe forks (op-revm intentionally omitted; MSRV 1.93).
- §8: note that reth is all-or-nothing to compile, so the 111-file
  transplant should be a dedicated effort gated on Phase-6 state-root
  parity, not expected to produce intermediate green builds.
… merge

Ran the full cherry-pick of the re-anchored foundation onto upstream
v2.2.0 and triaged all 111 conflicts (§9):

- 272 files apply clean (owned crates + non-overlapping edits)
- 81/111 conflicts resolve mechanically to upstream (take-HEAD): Gravity
  v1.8.3-era code upstream evolved, or edits v2.2.0 already adopted
  (e.g. triev2 field). Auto-classified by absence of Gravity markers in
  the per-file diff. + 3 DU deletions.
- 30/111 need a real merge, ranked by size. The irreducible hard core
  is just ~5 deep storage/engine files (database/provider 322,
  persistence 217, tree/mod 193, tree/tests 175, static_file 126) —
  Gravity's storage + pipe-exec integration vs v2.2.0's rewritten
  internals. These are flagged for author-pairing + Phase-6 state-root
  verification and explicitly NOT guessed (silent-chain-halt risk).

Net: the transplant is confirmed bounded + tractable — bulk is
mechanical, hard core is ~5 files. Reproduce commands included.
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