Skip to content

Replace Geth fork with original Geth#859

Merged
m-Peter merged 2 commits into
mainfrom
mpeter/replace-geth-fork
Aug 21, 2025
Merged

Replace Geth fork with original Geth#859
m-Peter merged 2 commits into
mainfrom
mpeter/replace-geth-fork

Conversation

@m-Peter
Copy link
Copy Markdown
Collaborator

@m-Peter m-Peter commented Aug 8, 2025

Depends on: onflow/flow-go#7676
Work towards: onflow/flow-go#7232

Description

Replaces https://github.com/onflow/go-ethereum with https://github.com/ethereum/go-ethereum .


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • Chores
    • Repointed go-ethereum imports from a fork to the official upstream repository.
    • Updated go.mod and test module dependencies (added upstream go-ethereum, refreshed Flow-related versions and transitive deps).
    • Updated comment/reference links to point to the official repositories.
    • No functional, API, or user-facing behavior changes introduced.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 8, 2025

Walkthrough

Replaced import paths across the repository from the forked module github.com/onflow/go-ethereum/... to the upstream github.com/ethereum/go-ethereum/... and updated go.mod/test go.mod dependency versions; no code logic, signatures, or control flow were changed.

Changes

Cohort / File(s) Change Summary
API Layer Imports
api/api.go, api/debug.go, api/net.go, api/pool.go, api/pull.go, api/pull_test.go, api/rate_limiter.go, api/server.go, api/stream.go, api/utils.go, api/wallet.go, api/web3.go
Switched go-ethereum imports from github.com/onflow/go-ethereum/... to github.com/ethereum/go-ethereum/...; no logic changes.
Bootstrap & Config
bootstrap/bootstrap.go, config/config.go
Updated geth types/common import paths to upstream repository.
CLI / Command
cmd/run/cmd.go
Corrected common and crypto imports to upstream paths.
Models
models/block.go, models/block_test.go, models/errors/errors.go, models/events_test.go, models/receipt.go, models/transaction.go, models/transaction_test.go
Replaced forked go-ethereum imports with upstream ones; minor comment/issue link updates.
Services & EVM
services/evm/executor.go, services/ingestion/... (engine.go, engine_test.go, event_subscriber_test.go), services/logs/filter.go, services/logs/filter_test.go, services/replayer/... (blocks_provider.go, blocks_provider_test.go, call_tracer_collector.go), services/requester/... (batch_tx_pool.go, overridable_blocks_provider.go, remote_cadence_arch.go, requester.go, single_tx_pool.go, tx_pool.go)
Updated go-ethereum import paths to github.com/ethereum/go-ethereum/...; comments referencing fork updated where present.
Storage
storage/index.go, storage/index_test.go, storage/mocks/*, storage/pebble/* (blocks.go, receipts.go, storage_test.go, traces.go, transactions.go)
Switched common, types, rlp, etc. imports to upstream repository.
Tests & Helpers
tests/e2e_web3js_test.go, tests/helpers.go, tests/integration_test.go, tests/key_store_release_test.go, tests/tx_batching_test.go
Replaced fork imports with upstream github.com/ethereum/go-ethereum/....
Go Module Files
go.mod, tests/go.mod
Added direct dependency github.com/ethereum/go-ethereum v1.16.2; removed direct github.com/onflow/go-ethereum; bumped/adjusted multiple transitive dependencies and Flow/Cadence versions.
Eth Types
eth/types/types.go, eth/types/types_test.go
Updated import paths and reference URLs to upstream go-ethereum.
Other
models/*, services/*, storage/*, tests/* (many files)
Numerous files updated to use github.com/ethereum/go-ethereum/... in place of github.com/onflow/go-ethereum/...; changes limited to imports and doc links.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

Compatibility

Suggested reviewers

  • janezpodhostnik
  • peterargue
  • zhangchiqing

Poem

I hopped through imports, one by one,
Swapped forks for upstream, now it's done.
Paths aligned, dependencies sing,
A tidy nest for code to spring.
🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mpeter/replace-geth-fork

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

looks good, but let's wait to merge until the flow-go PR is merged and tagged and the updated version is used here.

@m-Peter m-Peter force-pushed the mpeter/replace-geth-fork branch from 099d36d to a3fd787 Compare August 12, 2025 11:17
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (4)
storage/index.go (1)

5-5: Prune leftover onflow/go-ethereum references in modules (repeat)

Echoing the earlier review: ensure go.mod (and tests/go.mod) no longer list github.com/onflow/go-ethereum, even as indirect. A repo-wide tidy should remove it.

You can re-run:

#!/bin/bash
set -euo pipefail

# Expect no results
fd -a 'go.mod' | xargs -I {} rg -n 'github.com/onflow/go-ethereum' {} || true

# Tidy both modules (run locally)
# go mod tidy
# (cd tests && go mod tidy)
go.mod (1)

16-16: Pinned flow-go version still pulls in the fork; update to a version post-PR 7676.

This mirrors an existing review: flow-go at this pseudo-version still drags github.com/onflow/go-ethereum into your module graph, undermining the migration.

Quick check:

#!/bin/bash
set -euo pipefail
echo "==> Module graph entries for go-ethereum variants"
go mod graph | rg 'onflow/go-ethereum|ethereum/go-ethereum' || true
echo "==> Explain why fork appears"
go mod why -m github.com/onflow/go-ethereum || true
tests/go.mod (2)

14-14: tests: flow-go version still includes the fork; bump to post-PR 7676.

Matches the earlier review feedback: please pin a flow-go pseudo-version that has merged the upstream geth migration, so the fork isn’t pulled in.

Verify:

#!/bin/bash
set -euo pipefail
echo "==> tests module graph for ethereum forks"
( cd tests && go mod graph | rg 'onflow/go-ethereum|ethereum/go-ethereum' || true )
echo "==> tests: why fork appears"
( cd tests && go mod why -m github.com/onflow/go-ethereum || true )

168-168: tests: fork is still present indirectly; add a replace to de-fork the graph.

Until flow-go is bumped, force upstream geth in tests too to avoid mixed-type issues in integration code.

Apply at the bottom of tests/go.mod:

replace github.com/onflow/go-ethereum => github.com/ethereum/go-ethereum v1.16.2

Then:

#!/bin/bash
set -euo pipefail
cd tests
go mod tidy
go mod graph | rg 'onflow/go-ethereum' || echo "Fork removed from tests graph"
🧹 Nitpick comments (1)
services/replayer/blocks_provider.go (1)

6-7: Optional: drop the gethCommon alias for consistency

Tests use unaliased common. Removing the alias improves consistency across the codebase.

Apply within the import block:

- gethCommon "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common"

And update references elsewhere in this file:

// outside the selected range; update these occurrences accordingly
func(n uint64) common.Hash { ... }
return common.Hash{}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 099d36d and a3fd787.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (58)
  • api/api.go (1 hunks)
  • api/debug.go (2 hunks)
  • api/net.go (1 hunks)
  • api/pool.go (1 hunks)
  • api/pull.go (1 hunks)
  • api/pull_test.go (1 hunks)
  • api/rate_limiter.go (1 hunks)
  • api/server.go (1 hunks)
  • api/stream.go (1 hunks)
  • api/utils.go (1 hunks)
  • api/wallet.go (1 hunks)
  • api/web3.go (1 hunks)
  • bootstrap/bootstrap.go (1 hunks)
  • cmd/run/cmd.go (1 hunks)
  • config/config.go (1 hunks)
  • eth/types/types.go (2 hunks)
  • eth/types/types_test.go (1 hunks)
  • go.mod (2 hunks)
  • models/block.go (1 hunks)
  • models/block_test.go (1 hunks)
  • models/errors/errors.go (1 hunks)
  • models/events_test.go (1 hunks)
  • models/receipt.go (1 hunks)
  • models/transaction.go (2 hunks)
  • models/transaction_test.go (1 hunks)
  • services/evm/executor.go (1 hunks)
  • services/ingestion/engine.go (1 hunks)
  • services/ingestion/engine_test.go (1 hunks)
  • services/ingestion/event_subscriber_test.go (1 hunks)
  • services/logs/filter.go (1 hunks)
  • services/logs/filter_test.go (1 hunks)
  • services/replayer/blocks_provider.go (1 hunks)
  • services/replayer/blocks_provider_test.go (2 hunks)
  • services/replayer/call_tracer_collector.go (1 hunks)
  • services/requester/batch_tx_pool.go (1 hunks)
  • services/requester/overridable_blocks_provider.go (1 hunks)
  • services/requester/remote_cadence_arch.go (1 hunks)
  • services/requester/requester.go (2 hunks)
  • services/requester/single_tx_pool.go (1 hunks)
  • services/requester/tx_pool.go (1 hunks)
  • storage/index.go (1 hunks)
  • storage/index_test.go (1 hunks)
  • storage/mocks/BlockIndexer.go (1 hunks)
  • storage/mocks/ReceiptIndexer.go (1 hunks)
  • storage/mocks/TraceIndexer.go (1 hunks)
  • storage/mocks/TransactionIndexer.go (1 hunks)
  • storage/mocks/mocks.go (1 hunks)
  • storage/pebble/blocks.go (1 hunks)
  • storage/pebble/receipts.go (1 hunks)
  • storage/pebble/storage_test.go (1 hunks)
  • storage/pebble/traces.go (1 hunks)
  • storage/pebble/transactions.go (1 hunks)
  • tests/e2e_web3js_test.go (1 hunks)
  • tests/go.mod (2 hunks)
  • tests/helpers.go (1 hunks)
  • tests/integration_test.go (1 hunks)
  • tests/key_store_release_test.go (1 hunks)
  • tests/tx_batching_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • storage/pebble/transactions.go
  • models/receipt.go
  • services/requester/single_tx_pool.go
  • models/errors/errors.go
🚧 Files skipped from review as they are similar to previous changes (46)
  • api/net.go
  • tests/integration_test.go
  • models/block_test.go
  • services/requester/remote_cadence_arch.go
  • models/events_test.go
  • api/pull.go
  • api/rate_limiter.go
  • api/api.go
  • api/utils.go
  • storage/pebble/receipts.go
  • eth/types/types_test.go
  • services/logs/filter_test.go
  • services/requester/tx_pool.go
  • services/ingestion/event_subscriber_test.go
  • tests/helpers.go
  • storage/pebble/storage_test.go
  • tests/key_store_release_test.go
  • cmd/run/cmd.go
  • tests/tx_batching_test.go
  • api/pull_test.go
  • storage/mocks/BlockIndexer.go
  • services/requester/requester.go
  • storage/pebble/blocks.go
  • storage/mocks/TraceIndexer.go
  • models/transaction_test.go
  • config/config.go
  • storage/mocks/TransactionIndexer.go
  • services/replayer/call_tracer_collector.go
  • services/ingestion/engine.go
  • api/server.go
  • services/logs/filter.go
  • storage/mocks/ReceiptIndexer.go
  • api/pool.go
  • api/stream.go
  • bootstrap/bootstrap.go
  • services/requester/batch_tx_pool.go
  • services/requester/overridable_blocks_provider.go
  • storage/pebble/traces.go
  • services/evm/executor.go
  • services/ingestion/engine_test.go
  • storage/mocks/mocks.go
  • api/wallet.go
  • eth/types/types.go
  • models/block.go
  • storage/index_test.go
  • api/debug.go
🔇 Additional comments (8)
api/web3.go (1)

6-7: Upstream go-ethereum imports look correct; behavior unchanged

hexutil.Bytes and crypto.Keccak256 APIs are stable in upstream. No functional differences introduced.

tests/e2e_web3js_test.go (1)

10-11: LGTM: imports migrated to upstream go-ethereum

common.HexToAddress and crypto.HexToECDSA usage remain identical in upstream; no test logic changes introduced.

services/replayer/blocks_provider.go (2)

6-7: LGTM: switch to upstream common and tracers

The import path updates align with upstream go-ethereum; no functional changes within this file.


7-7: Verify upstream tracer API support in pinned Flow-Go version

Your project currently pins:

  • github.com/ethereum/go-ethereum v1.16.2
  • github.com/onflow/flow-go v0.41.0-rc.1.0.20250807061657-1ff6abcc39a8

Please confirm that the Flow-Go commit 1ff6abcc39a8 includes the tracer API changes from Flow-Go PR #7676 (upstream use of github.com/ethereum/go-ethereum/eth/tracers). In particular:

  • The Tracer type signature and DefaultDirectory behavior in Flow-Go match those in go-ethereum v1.16.2.
  • There are no local patches or forked tracer implementations in Flow-Go that diverge from upstream.

If the pinned SHA does not include those changes, update your go.mod references accordingly.

Files to verify:

  • go.mod (root)
  • tests/go.mod
services/replayer/blocks_provider_test.go (1)

8-9: LGTM: tests updated to upstream imports; native tracer side-effect import retained

The switch to github.com/ethereum/go-ethereum/common and eth/tracers is correct, and keeping eth/tracers/native for registration via init preserves tracer availability.

Also applies to: 26-26

models/transaction.go (1)

345-345: Updated reference URL to upstream geth — LGTM.

go.mod (1)

9-9: Direct dependency on upstream go-ethereum v1.16.2 — LGTM.

This is the right direction for the migration.

tests/go.mod (1)

8-8: Align tests module to upstream geth — LGTM.

Comment thread api/web3.go
Comment thread go.mod Outdated
Comment thread models/transaction.go
Comment thread services/replayer/blocks_provider_test.go
@m-Peter m-Peter force-pushed the mpeter/replace-geth-fork branch from a3fd787 to 9ee037e Compare August 21, 2025 08:16
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
services/ingestion/event_subscriber_test.go (2)

381-390: Fix: invalid loop over int (range txCount) will not compile

range over an int is invalid. Use a standard counted for-loop.

Apply:

-    // generate txs
-    for i := range txCount {
+    // generate txs
+    for i := 0; i < txCount; i++ {
         cdcEvent, txEvent, tx, _, err := newTransaction(cadenceHeight)
         require.NoError(t, err)
         hashes[i] = tx.Hash()
         flowEvent := flow.Event{
             Type:  string(txEvent.Etype),
             Value: cdcEvent,
         }
         flowEvents = append(flowEvents, flowEvent)
     }

1-490: Update common.Hash comparisons to use ==

The repo‐wide scan confirms three instances where Cmp is called on common.Hash (or its alias gethCommon.Hash). Please replace these with simple == comparisons. Do not modify any *big.Int.Cmp usages.

• storage/pebble/receipts.go:104

-   if rcp.TxHash.Cmp(ID) == 0 {
+   if rcp.TxHash == ID {

• services/logs/filter_test.go:103

-   if mustHash(b).Cmp(id) == 0 {
+   if mustHash(b) == id {

• services/ingestion/event_subscriber_test.go:154

-   if h.Cmp(tx.Hash()) == 0 {
+   if h == tx.Hash() {
api/stream.go (1)

128-140: Fix bloom helpers for upstream geth (CreateBloom/MergeBloom signatures differ).

In upstream go-ethereum, CreateBloom expects a Receipts slice and there is no MergeBloom helper with the same signature as the fork. Also, initializing LogsBloom via CreateBloom(&Receipt{}) won’t compile. Initialize with a zero bloom and use CreateBloom on the receipts slice.

Apply:

@@
   blockHeader := &ethTypes.BlockHeader{
     Number:           hexutil.Uint64(block.Height),
     Hash:             h,
     ParentHash:       block.ParentBlockHash,
     Nonce:            gethTypes.BlockNonce{0x1},
     Sha3Uncles:       gethTypes.EmptyUncleHash,
-    LogsBloom:        gethTypes.CreateBloom(&gethTypes.Receipt{}).Bytes(),
+    // Zero bloom; overridden below if receipts exist.
+    LogsBloom:        gethTypes.Bloom{}.Bytes(),
     TransactionsRoot: block.TransactionHashRoot,
     ReceiptsRoot:     block.ReceiptRoot,
     Miner:            evmTypes.CoinbaseAddress.ToCommon(),
     GasLimit:         hexutil.Uint64(BlockGasLimit),
     Timestamp:        hexutil.Uint64(block.Timestamp),
   }
@@
-    // TODO(m-Peter): Consider if its worthwhile to move this in storage.
-    blockHeader.LogsBloom = gethTypes.MergeBloom(receipts).Bytes()
+    // TODO(m-Peter): Consider if it's worthwhile to move this in storage.
+    blockHeader.LogsBloom = gethTypes.CreateBloom(receipts).Bytes()

Also applies to: 155-157

models/transaction.go (2)

269-270: Receipt bloom computation uses the wrong helper/argument.

Upstream geth’s CreateBloom takes a Receipts slice; passing a single *Receipt won’t compile. Compute the bloom from the receipt’s logs (or wrap the receipt into a slice).

Apply one of these (preferred first):

-  gethReceipt.Bloom = gethTypes.CreateBloom(gethReceipt)
+  gethReceipt.Bloom = gethTypes.LogsBloom(gethReceipt.Logs)

Alternative:

-  gethReceipt.Bloom = gethTypes.CreateBloom(gethReceipt)
+  gethReceipt.Bloom = gethTypes.CreateBloom(gethTypes.Receipts{gethReceipt})

301-308: Compute EffectiveGasPrice correctly for legacy and EIP-1559 transactions

The current logic in models/transaction.go inverts the calculation:

  • It treats any tx with GasPrice()==0 (intended as EIP-1559) as only paying the base fee, omitting the tip.
  • It treats all other txs (legacy or dynamic-fee) as only paying the tip, omitting the base fee.

Instead, you should:

  • For EIP-1559 (dynamic-fee) transactions: EffectiveGasPrice = baseFee + effectiveTip
  • For legacy transactions: EffectiveGasPrice = GasPrice

Minimal patch:

--- a/models/transaction.go
+++ a/models/transaction.go
@@ -299,8 +299,14 @@ func parseReceipt(…)
-    if gethTx.GasPrice().Sign() == 0 {
-        receipt.EffectiveGasPrice = BaseFeePerGas
-    } else {
-        receipt.EffectiveGasPrice, err = gethTx.EffectiveGasTip(nil)
-        if err != nil {
-            return nil, nil, nil, err
-        }
-    }
+    // EIP-1559: pay baseFee + effective tip; Legacy: pay exactly GasPrice
+    if gethTx.GasPrice().Sign() == 0 {
+        tip, err := gethTx.EffectiveGasTip(BaseFeePerGas)
+        if err != nil {
+            return nil, nil, nil, err
+        }
+        receipt.EffectiveGasPrice = new(big.Int).Add(BaseFeePerGas, tip)
+    } else {
+        receipt.EffectiveGasPrice = gethTx.GasPrice()
+    }

– If you’d prefer using the block’s real base fee instead of the BaseFeePerGas constant, I can help wire it through the event payload.

♻️ Duplicate comments (4)
storage/mocks/BlockIndexer.go (1)

1-14: Re-run module cleanup to drop any lingering onflow/go-ethereum entries

Past verification flagged a stale indirect github.com/onflow/go-ethereum in go.mod. If not already addressed in this commit, please tidy modules and ensure no references remain.

Run:

#!/bin/bash
set -euo pipefail

echo "🔎 Scanning code for old fork imports..."
rg -n --glob '!**/vendor/**' 'github.com/onflow/go-ethereum' || echo "✅ No stale onflow/go-ethereum imports in code"

echo "🔎 Checking go.mod files..."
for f in go.mod tests/go.mod; do
  if [[ -f "$f" ]]; then
    echo "File: $f"
    grep -n 'onflow/go-ethereum' "$f" || echo "$f clean"
  fi
done
services/ingestion/event_subscriber_test.go (1)

151-159: Replace common.Hash.Cmp with direct equality (upstream geth removed Cmp)

Upstream geth’s common.Hash is a fixed-size array and does not expose Cmp. Use Go’s == and short-circuit when found. This was flagged earlier as well.

Apply:

-            for i, h := range missingHashes {
+            for i, h := range missingHashes {
                 found := false
                 for _, tx := range ev.Events.Transactions() {
-                    if h.Cmp(tx.Hash()) == 0 {
-                        found = true
-                    }
+                    if h == tx.Hash() {
+                        found = true
+                        break
+                    }
                 }
                 require.True(t, found, fmt.Sprintf("required hash not found at index %d %s", i, h.String()))
             }
tests/go.mod (2)

14-14: Bump flow-go to the commit that merged PR 7676 (to avoid reintroducing the fork).

The pinned pseudo-version should include the upstream-geth switch from flow-go PR #7676. Please bump to that merge commit (or a later one) and verify the module graph no longer pulls github.com/onflow/go-ethereum.

Run inside tests/:

#!/bin/bash
set -euo pipefail
echo "Pinned flow-go version:"
rg -nP '^\s*github\.com/onflow/flow-go\s' go.mod
echo "Module graph entries referencing onflow/go-ethereum before bump:"
go mod graph | rg 'onflow/go-ethereum' || true

168-168: Fork still present as an indirect dep in tests; override or remove.

To complete the migration, ensure the fork disappears from the tests module graph. If a downstream dep still references it, add a replace to force upstream geth and tidy.

@@
 require (
   github.com/onflow/flow/protobuf/go/flow v0.4.10 // indirect
-  github.com/onflow/go-ethereum v1.16.2 // indirect
   github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 // indirect
@@
 )
 
 replace github.com/onflow/flow-evm-gateway => ../
+replace github.com/onflow/go-ethereum => github.com/ethereum/go-ethereum v1.16.2

Then:

#!/bin/bash
set -euo pipefail
cd tests
go mod tidy
echo "Confirm fork is gone:"
go mod graph | rg 'onflow/go-ethereum' || echo "OK: no fork in graph"
🧹 Nitpick comments (1)
api/stream.go (1)

199-201: Nit: make the subscription log message generic or parameterized.

This helper is used for heads, pending txs, and logs; “new heads subscription created” is misleading outside heads.

- l.Info().Msg("new heads subscription created")
+ l.Info().Msg("subscription created")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a3fd787 and 9ee037e.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (58)
  • api/api.go (1 hunks)
  • api/debug.go (2 hunks)
  • api/net.go (1 hunks)
  • api/pool.go (1 hunks)
  • api/pull.go (1 hunks)
  • api/pull_test.go (1 hunks)
  • api/rate_limiter.go (1 hunks)
  • api/server.go (1 hunks)
  • api/stream.go (1 hunks)
  • api/utils.go (1 hunks)
  • api/wallet.go (1 hunks)
  • api/web3.go (1 hunks)
  • bootstrap/bootstrap.go (1 hunks)
  • cmd/run/cmd.go (1 hunks)
  • config/config.go (1 hunks)
  • eth/types/types.go (2 hunks)
  • eth/types/types_test.go (1 hunks)
  • go.mod (2 hunks)
  • models/block.go (1 hunks)
  • models/block_test.go (1 hunks)
  • models/errors/errors.go (1 hunks)
  • models/events_test.go (1 hunks)
  • models/receipt.go (1 hunks)
  • models/transaction.go (2 hunks)
  • models/transaction_test.go (1 hunks)
  • services/evm/executor.go (1 hunks)
  • services/ingestion/engine.go (1 hunks)
  • services/ingestion/engine_test.go (1 hunks)
  • services/ingestion/event_subscriber_test.go (1 hunks)
  • services/logs/filter.go (1 hunks)
  • services/logs/filter_test.go (1 hunks)
  • services/replayer/blocks_provider.go (1 hunks)
  • services/replayer/blocks_provider_test.go (2 hunks)
  • services/replayer/call_tracer_collector.go (1 hunks)
  • services/requester/batch_tx_pool.go (1 hunks)
  • services/requester/overridable_blocks_provider.go (1 hunks)
  • services/requester/remote_cadence_arch.go (1 hunks)
  • services/requester/requester.go (2 hunks)
  • services/requester/single_tx_pool.go (1 hunks)
  • services/requester/tx_pool.go (1 hunks)
  • storage/index.go (1 hunks)
  • storage/index_test.go (1 hunks)
  • storage/mocks/BlockIndexer.go (1 hunks)
  • storage/mocks/ReceiptIndexer.go (1 hunks)
  • storage/mocks/TraceIndexer.go (1 hunks)
  • storage/mocks/TransactionIndexer.go (1 hunks)
  • storage/mocks/mocks.go (1 hunks)
  • storage/pebble/blocks.go (1 hunks)
  • storage/pebble/receipts.go (1 hunks)
  • storage/pebble/storage_test.go (1 hunks)
  • storage/pebble/traces.go (1 hunks)
  • storage/pebble/transactions.go (1 hunks)
  • tests/e2e_web3js_test.go (1 hunks)
  • tests/go.mod (2 hunks)
  • tests/helpers.go (1 hunks)
  • tests/integration_test.go (1 hunks)
  • tests/key_store_release_test.go (1 hunks)
  • tests/tx_batching_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • storage/mocks/TransactionIndexer.go
🚧 Files skipped from review as they are similar to previous changes (48)
  • models/block_test.go
  • storage/mocks/ReceiptIndexer.go
  • api/utils.go
  • tests/tx_batching_test.go
  • storage/mocks/TraceIndexer.go
  • eth/types/types_test.go
  • api/net.go
  • api/web3.go
  • cmd/run/cmd.go
  • services/replayer/call_tracer_collector.go
  • services/requester/single_tx_pool.go
  • models/transaction_test.go
  • services/requester/overridable_blocks_provider.go
  • services/logs/filter_test.go
  • services/requester/batch_tx_pool.go
  • services/ingestion/engine_test.go
  • storage/pebble/blocks.go
  • eth/types/types.go
  • tests/key_store_release_test.go
  • api/api.go
  • api/pull.go
  • bootstrap/bootstrap.go
  • storage/pebble/storage_test.go
  • storage/pebble/receipts.go
  • storage/mocks/mocks.go
  • models/errors/errors.go
  • tests/e2e_web3js_test.go
  • services/evm/executor.go
  • storage/index_test.go
  • services/requester/requester.go
  • api/rate_limiter.go
  • models/block.go
  • api/server.go
  • models/receipt.go
  • services/requester/tx_pool.go
  • services/ingestion/engine.go
  • storage/pebble/transactions.go
  • api/pull_test.go
  • config/config.go
  • tests/integration_test.go
  • services/requester/remote_cadence_arch.go
  • storage/pebble/traces.go
  • api/debug.go
  • services/replayer/blocks_provider_test.go
  • storage/index.go
  • go.mod
  • models/events_test.go
  • services/logs/filter.go
🔇 Additional comments (9)
storage/mocks/BlockIndexer.go (1)

6-6: LGTM: import switched to upstream geth/common

The alias and usage remain identical; no behavioral impact for the generated mock.

api/pool.go (1)

4-5: LGTM: import path migration only

Switched to github.com/ethereum/go-ethereum for common and hexutil; API and return types are unchanged.

api/wallet.go (1)

8-14: LGTM: upstream geth imports

All Ethereum-related imports correctly migrated to github.com/ethereum/go-ethereum. Sign/Tx construction logic remains unaffected.

tests/helpers.go (1)

24-27: LGTM: tests updated to upstream geth imports

The test helpers now use upstream common/hexutil/types. Helper behaviors and encodings remain the same.

services/ingestion/event_subscriber_test.go (1)

9-9: LGTM: import switched to upstream geth/common with alias

Alias usage is consistent across the file.

api/stream.go (1)

7-10: Imports migrated to upstream geth — looks good.

Swapping to github.com/ethereum/go-ethereum for hexutil, core/types, filters, and rpc is correct and aligns with the PR objective.

models/transaction.go (1)

9-12: Imports migrated to upstream geth — looks good.

Switch to github.com/ethereum/go-ethereum/common, core/txpool, core/types, and rlp is consistent with the repo-wide change.

services/replayer/blocks_provider.go (1)

6-7: Tracer/common imports migrated to upstream geth — looks good.

The aliases and package paths match upstream (common, eth/tracers).

tests/go.mod (1)

8-8: Direct dependency on upstream geth — good call.

Declaring github.com/ethereum/go-ethereum v1.16.2 directly is aligned with the migration.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
go.mod (1)

7-31: Transitive onflow/go-ethereum fork still present – override with upstream geth

The module graph shows several downstream packages still pulling in github.com/onflow/go-ethereum@v1.13.4, even though there are no direct imports in our code. To prevent duplicate type definitions, we must force those transitive dependencies onto the upstream v1.16.2:

• Transitive references found:

  • github.com/onflow/flow-core-contracts/lib/go/contracts@v1.7.3 → github.com/onflow/go-ethereum@v1.13.4
  • github.com/onflow/flow-core-contracts/lib/go/templates@v1.7.1 → github.com/onflow/go-ethereum@v1.13.4
  • github.com/onflow/flow-evm-bridge@v0.1.0 → github.com/onflow/go-ethereum@v1.13.4
  • github.com/onflow/flow-nft/lib/go/contracts@v1.2.4 → github.com/onflow/go-ethereum@v1.13.4
  • github.com/onflow/flow-nft/lib/go/templates@v1.2.1 → github.com/onflow/go-ethereum@v1.13.4

• No direct imports of the fork remain in our codebase.

Next steps:

  1. Add a replace directive in go.mod to force the upstream geth for all consumers:
    // go.mod
    require (
      github.com/ethereum/go-ethereum v1.16.2
      …
    )
    replace github.com/onflow/go-ethereum => github.com/ethereum/go-ethereum v1.16.2
  2. Re-run go mod tidy and go mod graph to confirm no references to github.com/onflow/go-ethereum remain.
  3. If any dependent onflow modules still break, coordinate with their maintainers or fork updates to remove the onflow/go-ethereum requirement.
♻️ Duplicate comments (4)
tests/go.mod (2)

14-16: Confirm the pinned flow-go includes PR 7676 (upstream geth) and doesn’t reintroduce the fork.

The pseudoversion v0.42.3-util-fix.0.20250819165158-ea886bab7c19 likely contains the migration, but please verify to avoid diamond geth types at build time.

Use:

#!/bin/bash
set -euo pipefail
VER=github.com/onflow/flow-go@v0.42.3-util-fix.0.20250819165158-ea886bab7c19
go mod download "$VER"
DIR=$(go env GOPATH)/pkg/mod/$(echo $VER | sed 's/@.*//; s#/#\\/#g')
MODDIR=$(go env GOPATH)/pkg/mod/github.com/onflow/flow-go@$(go list -m -f '{{.Version}}' $VER)
echo "==> replace directives in flow-go/go.mod"
grep -E '^replace' "$MODDIR/go.mod" || echo "  (none)"
echo "==> imports of fork vs upstream inside flow-go"
grep -R "github\.com/onflow/go-ethereum" "$MODDIR" || echo "  (no fork imports)"
grep -R "github\.com/ethereum/go-ethereum" "$MODDIR" || true

7-19: Belt-and-suspenders: add a temporary replace if the fork still appears transitively.

Only if the verification script still shows github.com/onflow/go-ethereum in the graph, force-map it to the upstream to avoid type duplication until all deps are fully migrated.

If needed, apply:

@@
 module github.com/onflow/flow-evm-gateway/integration
@@
 replace github.com/onflow/flow-evm-gateway => ../
+// Temporary guard to ensure no transitive fork leaks in:
+replace github.com/onflow/go-ethereum => github.com/ethereum/go-ethereum v1.16.2

Then:

cd tests && go mod tidy && go mod graph | rg 'onflow/go-ethereum' || echo "✅ fork removed"
go.mod (2)

15-17: Double-check the chosen flow-go commit includes the upstream geth migration (PR 7676).

Same rationale as tests module. Verifying avoids mixed geth types across packages.

Use:

#!/bin/bash
set -euo pipefail
VER=github.com/onflow/flow-go@v0.42.3-util-fix.0.20250819165158-ea886bab7c19
go mod download "$VER"
MODDIR=$(go env GOPATH)/pkg/mod/github.com/onflow/flow-go@$(go list -m -f '{{.Version}}' $VER)
grep -R "github\.com/onflow/go-ethereum" "$MODDIR" || echo "  (no fork imports)"
grep -R "github\.com/ethereum/go-ethereum" "$MODDIR" || true

7-31: Optional hard guard: add a replace to remap any lingering forked deps to upstream.

If your graph check still shows the fork (transitively), add the replace below as a temporary guard.

Apply:

@@
 require (
@@
 )
+
+// Temporary guard to prevent the fork from entering via transitive deps:
+replace github.com/onflow/go-ethereum => github.com/ethereum/go-ethereum v1.16.2

And verify:

go mod tidy && go mod graph | rg 'onflow/go-ethereum' || echo "✅ fork removed"
🧹 Nitpick comments (2)
tests/go.mod (1)

223-227: Otel core is 1.36.0 but exporters are 1.31.0 — align versions to avoid subtle incompatibilities.

While Otel modules often maintain compatibility, keeping minor versions aligned is safer. Suggest bumping exporters to 1.36.0.

Apply and tidy:

-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0 // indirect

Then:

cd tests && go mod tidy
go.mod (1)

198-207: Otel core libs at 1.36.0 vs OTLP exporters at 1.31.0 — consider aligning.

Recommend bumping exporters to 1.36.0 to match core/sdk/trace/metric and reduce risk of API drift.

Proposed change:

-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0 // indirect

Then:

go mod tidy
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee037e and 56427f2.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod (5 hunks)
  • tests/go.mod (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Lint
  • GitHub Check: Test
🔇 Additional comments (1)
tests/go.mod (1)

262-263: Ensure the replace stays local to tests/go.mod and is excluded from published modules

  • The replace github.com/onflow/flow-evm-gateway => ../ directive is present only in tests/go.mod (line 262) and does not appear in the root go.mod.
  • This setup is acceptable for integration tests, but you must verify that your release or packaging workflow does not include tests/go.mod (and thus this local replace) in any published artifacts.

Comment thread tests/go.mod
@m-Peter m-Peter merged commit 84dd9bd into main Aug 21, 2025
2 checks passed
@m-Peter m-Peter deleted the mpeter/replace-geth-fork branch August 21, 2025 08:49
@coderabbitai coderabbitai Bot mentioned this pull request Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants