Skip to content

Conversation

@curryxbo
Copy link
Contributor

@curryxbo curryxbo commented Nov 20, 2025

Summary by CodeRabbit

  • Chores
    • Updated the core Ethereum client dependency across multiple components.
    • Performed a broader dependency refresh (several indirect libraries bumped/added) to improve compatibility, stability, and build consistency.
    • Switched which cryptographic precompile implementation is used by a tooling component to align runtime behavior with the updated client.

✏️ Tip: You can customize this high-level summary in your review settings.

@curryxbo curryxbo requested a review from a team as a code owner November 20, 2025 02:42
@curryxbo curryxbo requested review from r3aker86 and removed request for a team November 20, 2025 02:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Walkthrough

Bumped github.com/morph-l2/go-ethereum pseudo-version across multiple module go.mod files; refreshed several indirect dependencies in contracts/go.mod; replaced BLS precompiled contract references with Emerald precompiled contracts for two operations in ops/tools/bls12381/main.go.

Changes

Cohort / File(s) Change Summary
go-ethereum bump (multiple modules)
node/go.mod, bindings/go.mod, ops/l2-genesis/go.mod, ops/tools/go.mod, oracle/go.mod, tx-submitter/go.mod
Updated github.com/morph-l2/go-ethereum pseudo-version from v1.10.14-0.20251031091135-78b17f183b84v1.10.14-0.20251119080508-d085f8c79a53. No other require entries changed in these files.
Dependency refresh
contracts/go.mod
Multiple indirect dependency version bumps and additions (e.g., fastcache, mmap-go, go-kit/*, google/uuid, gorilla/websocket, prometheus/tsdb, golang.org/x/net, golang.org/x/time, and others). No exported API changes.
Precompile mapping change
ops/tools/bls12381/main.go
Replaced references to vm.PrecompiledContractsBLS with vm.PrecompiledContractsEmerald for G1 map and pairing calls (addresses 17 and 16 respectively), preserving call pattern and gas usage.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as caller
    participant VM as vm
    rect `#E6F7FF`
    Note right of VM: Old flow (pre-change)
    Caller->>VM: call precompiled (BLS) addr(17) for mapG1
    VM-->>Caller: result (mapG1)
    Caller->>VM: call precompiled (BLS) addr(16) for pairing
    VM-->>Caller: result (pairing)
    end
Loading
sequenceDiagram
    participant Caller as caller
    participant VM as vm
    rect `#FFF4E6`
    Note right of VM: New flow (this PR)
    Caller->>VM: call precompiled (Emerald) addr(17) for mapG1
    VM-->>Caller: result (mapG1)
    Caller->>VM: call precompiled (Emerald) addr(16) for pairing
    VM-->>Caller: result (pairing)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Pay extra attention to contracts/go.mod (many indirect bumps may affect transitive builds).
  • Review ops/tools/bls12381/main.go to confirm correct precompile addresses and expected semantics.

Possibly related PRs

Suggested reviewers

  • r3aker86
  • FletcherMan

Poem

🐰 I hopped through modules, quick and spry,
A tiny bump beneath the sky.
Emerald calls now answer me,
Versions tidy — code runs free.
🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: updating the go-ethereum (geth) dependency version across multiple go.mod files throughout the repository.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch node_debug

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de24211 and 6183ecf.

📒 Files selected for processing (1)
  • ops/tools/bls12381/main.go (1 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). (11)
  • GitHub Check: check
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: check
  • GitHub Check: test
  • GitHub Check: check
  • GitHub Check: check
  • GitHub Check: test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
ops/tools/bls12381/main.go (1)

87-120: <!-- [scratchpad_start]
[task review_verification 2/3 - UPDATED]
Verify address 16 mapping for BLS12381 pairing in Emerald precompiled contracts

[observations]

  • Line 87: bls12381Pairing uses vm.PrecompiledContractsEmerald[common.BytesToAddress([]byte{16})]
  • Line 80: bls12381MapG1 uses vm.PrecompiledContractsEmerald[common.BytesToAddress([]byte{17})]
  • Search found NO definition of PrecompiledContractsEmerald in codebase
  • Search found NO reference to PrecompiledContractsBLS anywhere in codebase
  • This means PrecompiledContractsEmerald is from external dependency (not defined locally)
  • Standard Ethereum: address 0x10 (16) = BLS12381 pairing, 0x11 (17) = BLS12381 G1 mapping
  • No git history or version information to determine migration source
  • Cannot verify by scanning codebase since definition is external

[pending]

  • Need to find vm package import source in main.go
  • Need to determine if PrecompiledContractsEmerald is from go-ethereum
  • Check go.mod for morph-l2/go-ethereum version and whether it supports Emerald

[actions]

  1. Search for imports in main.go to find vm package source
  2. Check go.mod for dependencies related to Emerald/go-ethereum
  3. Verify version and address mapping in documentation if available

Comment on lines +80 to 85
bls12381MapG1 := vm.PrecompiledContractsEmerald[common.BytesToAddress([]byte{17})]
messagePointOnCurveBz, err := bls12381MapG1.Run(messageInput)
if err != nil {
panic(err)
}
costGas += bls12381MapG1.RequiredGas(messageInput)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the correct precompiled contract address for BLS12381 map to G1 operation.

The change from vm.PrecompiledContractsBLS to vm.PrecompiledContractsEmerald[address 17] needs verification. Standard Ethereum BLS12381 precompiled contracts typically use address 0x12 (18) for the map to G1 operation, not address 17. Please confirm that:

  1. Address 17 is the correct Emerald precompiled contract address for BLS12381 map to G1
  2. The interface is compatible (Run() and RequiredGas() methods match expectations)
  3. The functional behavior is equivalent to the previous BLS precompiled contract

Run the following script to check for precompiled contract address definitions and any related documentation or tests in the codebase:

Additionally, please verify the correct address mapping in the updated go-ethereum documentation:


🏁 Script executed:

#!/bin/bash
# Search for Emerald precompiled contract address definitions and related constants
rg -nP --type=go 'PrecompiledContractsEmerald|bls12381.*17|MapG1' -A3 -B3

# Search for any other usages of PrecompiledContractsBLS that might need updating
rg -nP --type=go 'PrecompiledContractsBLS' -A2 -B2

# Look for test files that cover BLS operations
fd -e go -e test test | xargs rg -l 'bls12381|MapG1'

Length of output: 1680


🌐 Web query:

github.com/morph-l2/go-ethereum BLS12381 Emerald precompiled contract addresses

💡 Result:

The Emerald (Morph) implementation uses the EIP‑2537 BLS12‑381 precompile addresses:

  • 0x0b — bls12381G1Add. [1][2]
  • 0x0c — bls12381G1MultiExp (G1 MSM). [1][2]
  • 0x0d — bls12381G2Add. [1][2]
  • 0x0e — bls12381G2MultiExp (G2 MSM). [1][2]
  • 0x0f — bls12381Pairing. [1][2]
  • 0x10 — bls12381MapG1. [1][2]
  • 0x11 — bls12381MapG2. [1][2]

Sources: morph-l2/go-ethereum repo and Morph/Emerald docs; EIP‑2537 specification. [1][2][3]

References
[1] github.com/morph-l2/go-ethereum.
[2] EIP-2537: Precompile for BLS12-381 curve operations.
[3] Morph/Emerald precompiles documentation.


Correct the precompiled contract addresses for BLS12381 operations.

The addresses are incorrect and will invoke the wrong precompiled contracts:

  • Line 80: Uses address 17 for bls12381MapG1, but should be address 16 (0x10)
  • Line 87: Uses address 16 for bls12381Pairing, but should be address 15 (0x0f)

Per EIP-2537, the Emerald precompile addresses are: 0x0f (15) for bls12381Pairing and 0x10 (16) for bls12381MapG1. These must be corrected to ensure BLS signature verification works correctly.

🤖 Prompt for AI Agents
In ops/tools/bls12381/main.go around lines 80 to 85 (and the pairing call at
~line 87), the precompile addresses are off by one: change the bls12381MapG1
lookup from common.BytesToAddress([]byte{17}) to
common.BytesToAddress([]byte{16}) (0x10) and change the bls12381Pairing lookup
from common.BytesToAddress([]byte{16}) to common.BytesToAddress([]byte{15})
(0x0f) so they match EIP-2537; keep the rest of the call sites (Run, error
handling, and RequiredGas) the same.

@curryxbo curryxbo merged commit 4866a26 into main Nov 20, 2025
15 of 17 checks passed
@curryxbo curryxbo deleted the node_debug branch November 20, 2025 03:32
@coderabbitai coderabbitai bot mentioned this pull request Nov 21, 2025
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.

3 participants