Skip to content

[DONOT MERGE]: Hotfix hoodi submitter blob fee calculate#793

Closed
Kukoomomo wants to merge 5 commits intomainfrom
hotfix/submitter_blob_hoodi
Closed

[DONOT MERGE]: Hotfix hoodi submitter blob fee calculate#793
Kukoomomo wants to merge 5 commits intomainfrom
hotfix/submitter_blob_hoodi

Conversation

@Kukoomomo
Copy link
Contributor

@Kukoomomo Kukoomomo commented Oct 30, 2025

Summary by CodeRabbit

  • Chores
    • Upgraded Go runtime to 1.24.0 and refreshed many dependency versions for stability and security.
  • Improvements
    • Refined retry behavior for more robust operation.
    • Adjusted fee estimation logic and logging for more accurate gas/blob fee reporting and clearer diagnostics.

@Kukoomomo Kukoomomo requested a review from a team as a code owner October 30, 2025 09:03
@Kukoomomo Kukoomomo requested review from twcctop and removed request for a team October 30, 2025 09:03
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

Walkthrough

Go module dependency versions updated (toolchain to Go 1.24.0 and multiple direct/indirect bumps) and rollup service logic adjusted: loop form changed, logging labels revised, excess blob gas handling added, and blob-fee computation replaced with a new Taylor-approximation helper plus a 3× multiplier.

Changes

Cohort / File(s) Summary
Dependency Version Updates
tx-submitter/go.mod
Bumped Go toolchain to go 1.24.0; updated direct deps including github.com/morph-l2/go-ethereum and github.com/stretchr/testify (v1.9.0→v1.10.0); multiple indirect dependency version bumps (bits-and-blooms/bitset, consensys packages, gnark-crypto, supranational/blst, golang.org/x/*, addition of github.com/ethereum/c-kzg-4844/bindings/go, removal of github.com/fjl/memsize), and a replace entry for Tendermint to morph-l2/tendermint v0.3.2.
Rollup Service Logic Updates
tx-submitter/services/rollup.go
Refactored retry loop in detectReorgWithRetry to for i := 0; i < 3; i++; adjusted logging labels in GetGasTipAndCap (base/tip/blob fee messages) and added log for excess blob gas; replaced eip4844.CalcBlobFee usage when head.ExcessBlobGas != nil with fakeExponential(minBlobGasPrice, head.ExcessBlobGas, 5007716) then applied existing * 3 multiplier; added new helper fakeExponential(factor, numerator, denominator) implementing a Taylor-approximation for exponentials.

Sequence Diagram(s)

sequenceDiagram
    participant RollupSvc as RollupService
    participant Head as HeadInfo
    participant FeeCalc as FeeCalculator

    Note over RollupSvc: GetGasTipAndCap flow
    RollupSvc->>Head: read BaseFee, Tip, ExcessBlobGas
    alt ExcessBlobGas == nil
        RollupSvc->>FeeCalc: use existing calc (eip4844.CalcBlobFee)
        FeeCalc-->>RollupSvc: blobFee
    else ExcessBlobGas != nil
        RollupSvc->>FeeCalc: fakeExponential(minBlobGasPrice, ExcessBlobGas, 5007716)
        FeeCalc-->>RollupSvc: approxBlobFee
        RollupSvc->>RollupSvc: apply multiplier (*3)
    end
    RollupSvc-->>Caller: return baseFee, tip, blobFee
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Files needing extra attention:
    • tx-submitter/go.mod — ensure dependency replacements and indirect bumps do not introduce import path or compatibility issues.
    • tx-submitter/services/rollup.go — verify numeric correctness and stability of fakeExponential approximation and the chosen constant 5007716.

Possibly related PRs

Suggested reviewers

  • WorldDogs
  • SecurityLife
  • ryanmorphl2

Poem

🐰
I hopped through modules, bumped a line,
Tweaked blob fees with a Taylor sign,
Logs now say base, tip, and blob,
Loops made tidy — no more slob,
A tiny multiplier multiplies my dine.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title "[DONOT MERGE]: Hotfix hoodi submitter blob fee calculate" contains terminology that creates ambiguity. While it correctly identifies blob fee calculation as part of the changeset—which is indeed a significant focus of the rollup.go changes—the term "hoodi" is unexplained and unclear, making it difficult to understand the intended scope. Additionally, the title doesn't capture other notable changes like the substantial Go module dependency updates or import cleanup, and the "[DONOT MERGE]" prefix suggests the PR is still in draft status. The phrasing is also awkward with "calculate" used as a noun. The author should clarify the meaning of "hoodi" or replace it with descriptive terminology, consider removing the "[DONOT MERGE]" prefix if the PR is ready for review, and refine the title to better reflect the scope of changes such as "Hotfix: Update blob fee calculation logic and dependencies" or provide context about what "hoodi" refers to so reviewers can properly understand the change intent.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 hotfix/submitter_blob_hoodi

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: 3

🧹 Nitpick comments (1)
tx-submitter/services/rollup.go (1)

300-300: Consider reverting to the more concise range syntax.

The change from for i := range 3 to for i := 0; i < 3; i++ is functionally equivalent but less idiomatic for Go 1.22+. The original range-based syntax is more concise.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be68120 and e750b74.

⛔ Files ignored due to path filters (1)
  • tx-submitter/go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • tx-submitter/go.mod (1 hunks)
  • tx-submitter/services/rollup.go (5 hunks)
  • tx-submitter/services/rollup_test.go (2 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). (3)
  • GitHub Check: test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (2)
tx-submitter/services/rollup.go (1)

1248-1248: LGTM - Improved logging clarity.

The updated log messages provide better context for fee-related information.

Also applies to: 1258-1258, 1281-1281

tx-submitter/go.mod (1)

10-10: Verify whether using this development snapshot is intentional.

The version exists and is accessible, but this is a development snapshot created today (2025-10-30), not a stable release. Additionally, the eip4844 refactor in rollup.go was intentional—the code deliberately removed the go-ethereum/consensus/misc/eip4844 import and replaced eip4844.CalcBlobFee() with a custom fakeExponential() implementation. This refactor was not forced by breaking changes from the dependency update.

Confirm whether pinning to a development version from a custom fork is appropriate for production use, or whether a stable tagged release should be used instead.

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: 2

♻️ Duplicate comments (2)
tx-submitter/services/rollup.go (2)

1282-1283: Previous critical issue remains unresolved: incorrect constant in blob fee calculation.

The hardcoded constant 5007716 on line 1283 was flagged in a previous review as incorrect. According to EIP-4844, the target blob gas per block is 393216, not 5007716. This issue was marked as addressed but the code still contains the incorrect value.

The custom fakeExponential calculation may produce results that diverge from the standard eip4844.CalcBlobFee, potentially causing:

  • Transaction rejections if fees are too low
  • Overpayment if fees are too high
  • Network compatibility issues

Required actions:

  1. Replace 5007716 with the correct constant from params (e.g., params.BlobTxTargetBlobGasPerBlock) or document why this specific value is intentional
  2. Consider using the standard eip4844.CalcBlobFee instead of a custom approximation
  3. If the custom calculation must remain, add unit tests comparing it against the standard implementation

1907-1922: Previous major issue remains unresolved: fakeExponential lacks critical safeguards.

The fakeExponential function was previously flagged for lacking safeguards, but the issues remain unaddressed:

  1. Unbounded loop (line 1914): No iteration limit exists. For pathological inputs or precision issues, this could run indefinitely
  2. No overflow protection: Large inputs could cause integer overflow in intermediate multiplications before division
  3. Missing convergence handling: If the loop doesn't converge, there's no error indication or fallback

Required actions:
Add an iteration limit and convergence failure handling:

 func fakeExponential(factor, numerator, denominator *big.Int) *big.Int {
+	const maxIterations = 100 // Safeguard against unbounded loops
 	var (
 		output = new(big.Int)
 		accum  = new(big.Int).Mul(factor, denominator)
 	)
-	for i := 1; accum.Sign() > 0; i++ {
+	for i := 1; accum.Sign() > 0 && i < maxIterations; i++ {
 		output.Add(output, accum)
 
 		accum.Mul(accum, numerator)
 		accum.Div(accum, denominator)
 		accum.Div(accum, big.NewInt(int64(i)))
 	}
+	if accum.Sign() > 0 {
+		log.Warn("fakeExponential failed to converge", "iterations", maxIterations)
+		return big.NewInt(0)
+	}
 	return output.Div(output, denominator)
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c069e17 and c719666.

⛔ Files ignored due to path filters (1)
  • tx-submitter/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • tx-submitter/go.mod (3 hunks)
  • tx-submitter/services/rollup.go (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: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (6)
tx-submitter/services/rollup.go (3)

300-300: Loop syntax update improves Go version compatibility.

The change from for i := range 3 to for i := 0; i < 3; i++ is functionally equivalent and improves compatibility with Go versions prior to 1.22.


1248-1248: Improved logging labels for better observability.

The updated labels distinguish between base fee and tip fee information, making the logs clearer. The addition of .String() for the tip value ensures consistent formatting.

Also applies to: 1258-1258


1281-1281: Good addition for blob fee observability.

Logging the excess blob gas value helps with debugging and understanding blob fee calculations.

tx-submitter/go.mod (3)

12-12: Update testify to v1.10.0.

The update from v1.9.0 to v1.10.0 is a minor version bump and is typically safe. Confirm that the test suite passes with this newer version of testify.


22-22: Dependency updates verified as backwards-compatible; no breaking changes detected.

Go module verification passed with all dependencies successfully resolved and verified. Web search confirms that the major cryptographic library updates contain no breaking changes:

  • consensys/gnark-crypto v0.16.0 lists only performance improvements and fixes with no breaking changes
  • consensys/bavard v0.1.27 is a backwards-compatible feature/patch release
  • golang.org/x/crypto v0.35.0 contains no API breaking changes, with updates primarily addressing security fixes including CVE-2025-22869

The dependency updates are safe to proceed with.


3-3: Verify Go 1.24.0 compatibility through full build and test suite before merging.

Go 1.24.0 is available, but further verification is required:

  • gnark-crypto (v0.16.0): Not explicitly tested for Go 1.24 per project documentation, which states testing against only the last two major releases. This is a compatibility gap that needs confirmation.
  • blst (v0.3.16-0.20250831170142-f48500c1fdbe): The pseudo-version is very recent (2025-08-31) and may include Go 1.24 fixes, but requires testing to confirm.
  • Go 1.24 breaking changes: The upgrade introduces breaking changes in the compiler (cgo-generated type restrictions), runtime (Swiss Tables map implementation, new mutex), and stricter vet analyzers—these can expose latent bugs in code or tests.

Before merging, build and run the full test suite with Go 1.24.0 to ensure no regressions or build failures arise from the toolchain and dependency versions.

module morph-l2/tx-submitter

go 1.22
go 1.24.0
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

Flag: PR marked "[DONOT MERGE]"—do not merge in current state.

This pull request is explicitly marked as not ready for merging. Please confirm whether all intended changes are complete and this is ready for review, or whether additional changes are pending before this should be considered for merge.

🤖 Prompt for AI Agents
In tx-submitter/go.mod around lines 3 to 3, the PR is marked "[DONOT MERGE]"
which blocks merging; confirm whether work is complete and either remove the
"[DONOT MERGE]" marker and update the PR title/description to explicitly state
readiness for review/merge, or keep the marker and update the PR description
with a clear list of remaining tasks and an estimated timeline; ensure CI passes
and any required reviewers are assigned before removing the block label.

github.com/holiman/uint256 v1.2.4
github.com/morph-l2/externalsign v0.3.1
github.com/morph-l2/go-ethereum v1.10.14-0.20251020031512-67087dd3ad49
github.com/morph-l2/go-ethereum v1.10.14-0.20251030090323-25b8e120126f
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 that the go-ethereum dependency commit contains the intended blob fee calculation fix.

Per the PR title and AI summary, the blob-fee computation should be replaced with a Taylor-approximation helper plus a 3× multiplier. This logic resides in the github.com/morph-l2/go-ethereum dependency (updated to v1.10.14-0.20251030090323-25b8e120126f). Confirm that this specific commit contains the intended blob fee changes.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the go-ethereum commit contains blob fee calculation changes.

# Extract the commit hash from the version string
GETH_VERSION="v1.10.14-0.20251030090323-25b8e120126f"
COMMIT_HASH=$(echo "$GETH_VERSION" | grep -oE '[0-9a-f]{12}')

echo "Extracted commit hash: $COMMIT_HASH"

# Check the go-ethereum repository for commits related to blob fees
# This requires access to the morph-l2/go-ethereum repository
curl -s "https://api.github.com/repos/morph-l2/go-ethereum/commits/$COMMIT_HASH" \
  | jq '.commit.message' 2>/dev/null || echo "Unable to fetch commit details; verify manually at https://github.com/morph-l2/go-ethereum/commit/$COMMIT_HASH"

Length of output: 48


I need to correct the commit hash extraction and query the actual commit. The version string format is a Go pseudo-version where the actual commit hash is the last 12 hexadecimal characters (25b8e120126f), not the timestamp portion.


---

🏁 Script executed:

```shell
#!/bin/bash
# Description: Verify blob fee calculation changes in the go-ethereum commit

# Correct extraction of commit hash from pseudo-version
# Format: v<version>-0.<timestamp>-<commit_hash>
GETH_VERSION="v1.10.14-0.20251030090323-25b8e120126f"
COMMIT_HASH="${GETH_VERSION##*-}"

echo "Extracted commit hash: $COMMIT_HASH"

# Fetch commit details from morph-l2/go-ethereum
echo ""
echo "Fetching commit details..."
curl -s "https://api.github.com/repos/morph-l2/go-ethereum/commits/$COMMIT_HASH" \
  | jq -r '.commit.message // "Commit not found"'

Length of output: 124


The referenced go-ethereum commit does not contain blob fee calculation changes.

The commit 25b8e120126f in the dependency version v1.10.14-0.20251030090323-25b8e120126f contains only "Rm memsize import (#217)" — removing the github.com/fjl/memsize dependency. There is no evidence of blob fee calculation fixes, Taylor-approximation helpers, or the 3× multiplier mentioned in the PR title. Verify that the correct commit hash is referenced in tx-submitter/go.mod, or confirm the blob fee changes are addressed in a different dependency or PR.

🤖 Prompt for AI Agents
In tx-submitter/go.mod around line 10, the pinned go-ethereum pseudo-version
(v1.10.14-0.20251030090323-25b8e120126f) points to a commit that only removes
the memsize import and does not include the blob fee calculation,
Taylor-approximation helpers, or 3× multiplier changes referenced in the PR;
verify the correct commit that contains those blob fee changes (or identify the
correct dependency/PR that implements them) and update the go.mod entry to the
proper pseudo-version/commit hash or change the dependency to the package that
actually contains the fixes, then run go mod tidy and go mod download to ensure
the module graph is updated and the lockfile reflects the corrected commit.

@Kukoomomo Kukoomomo closed this Oct 30, 2025
@Kukoomomo Kukoomomo deleted the hotfix/submitter_blob_hoodi branch October 30, 2025 10:41
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