Skip to content

Conversation

@m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented Oct 27, 2025

Closes: #912
Depends on: onflow/flow-go#8085

Description

Updates the flow-go version to onflow/flow-go#8085, which enables the Fusaka hard-fork for PreviewNet (a.k.a Emulator) & Testnet networks.


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
    • Updated many direct and transitive dependencies to newer patch/minor versions for compatibility and stability.
  • Bug Fix / Behavioral Change
    • Estimation now enforces the Osaka (EIP-7825) gas cap when applicable, clamping excessive gas limits and updating related error messaging; a legacy specific gas-limit error was removed.
  • Tests
    • Added and adjusted tests to validate behavior around high gas limits and relaxed some block transaction-count assertions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

Updated module dependencies in go.mod and tests/go.mod; removed a public error constructor; moved Osaka (EIP‑7825) gas-cap enforcement from transaction submission to an Osaka-aware clamp inside EstimateGas in services/requester/requester.go; added/updated tests for high gas-limit scenarios. No exported API signatures changed.

Changes

Cohort / File(s) Summary
Dependency bumps (main module)
go.mod
Updated direct and transitive dependencies (e.g., ethereum/go-ethereum v1.16.5→v1.16.7, onflow/flow-go → v0.44.0-experimental..., added indirect Ziren runtime, and various indirect bumps). No code changes.
Dependency bumps (test module)
tests/go.mod
Updated test-only dependencies (e.g., go-ethereum, flow-emulator, flow-go) and indirect modules. No code changes.
EstimateGas Osaka-aware clamp
services/requester/requester.go
Removed the prior unexported txMaxGasLimit check in SendRawTransaction. In EstimateGas, if proposed passingGasLimit > gethParams.MaxTxGas, fetch target block (respecting blockOverrides), construct emulator chain config, detect Osaka, and clamp passingGasLimit to MaxTxGas when Osaka applies; otherwise proceed unchanged. Errors from height/block fetch propagate.
Removed exported error constructor
models/errors/errors.go
Deleted NewTxGasLimitTooHighError(maxGasLimit uint64) error, removing that specific exported error constructor.
Transaction validation test
models/transaction_test.go
Added test "tx limit above gas limit cap" asserting validation fails when Gas > MaxTxGas.
Web3 JS tests added/updated
tests/web3js/estimate_gas_overrides_test.js, tests/web3js/eth_failure_handling_test.js
Added/adjusted tests: verify eth_estimateGas behavior with high gas-limit inputs and updated error expectation message to the new Osaka-cap wording.
Relaxed tx batching assertions
tests/tx_batching_test.go
Relaxed assertions from exact count to len(txResults) >= 1 across multiple tests.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Requester
  participant FlowNode as Flow node / emulator

  Note over Client,Requester: eth_estimateGas request
  Client->>Requester: eth_estimateGas(tx, blockOverrides?)
  Requester->>Requester: compute initial passingGasLimit
  alt passingGasLimit > gethParams.MaxTxGas
    Requester->>FlowNode: GetLatestEVMHeight()
    FlowNode-->>Requester: height / error
    Requester->>FlowNode: GetBlockByHeight(height)
    FlowNode-->>Requester: block / error
    Requester->>Requester: build emulator config (apply blockOverrides)
    alt emulatorConfig indicates Osaka
      Requester->>Requester: clamp passingGasLimit := gethParams.MaxTxGas
      Note right of Requester `#DFF2E1`: Osaka cap applied (EIP‑7825)
    else
      Note right of Requester `#FFF4D1`: no clamp
    end
  end
  Requester->>Requester: run simulation with passingGasLimit
  Requester-->>Client: return estimate or error
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay extra attention to services/requester/requester.go (height/block fetch, application of blockOverrides, emulator chain-config construction, Osaka detection logic, and exact clamp placement).
  • Verify removal of NewTxGasLimitTooHighError doesn't leave callers or tests referencing it.
  • Run unit tests and web3js tests after dependency upgrades to catch transitive breakages.

Possibly related PRs

Suggested labels

Dependencies

Suggested reviewers

  • j1010001
  • peterargue

Poem

🐰 I hopped through modules, nudged a cap so slight,
Osaka whispered limits in the soft moonlight.
Tests nibble carrots, assertions kept neat,
A tiny clamp, a CI smile — carrot cake for this feat.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Enable EVM Fusaka hard-fork' directly and clearly describes the main objective of the pull request - enabling Fusaka hard-fork support.
Linked Issues check ✅ Passed The PR addresses the primary coding requirements from issue #912: updating dependencies to enable Fusaka hard-fork, implementing EIP-7825 gas cap (16M), and validating the changes work correctly.
Out of Scope Changes check ✅ Passed All changes are directly related to Fusaka enablement: dependency updates, gas limit cap implementation, test updates for new behavior, and error handling adjustments align with PR objectives.
✨ 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 mpeter/enable-fusaka-hard-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

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

@m-Peter m-Peter force-pushed the mpeter/enable-fusaka-hard-fork branch 2 times, most recently from d24234e to d55cd8a Compare October 29, 2025 10:43
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 d24234e and d55cd8a.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • go.mod (5 hunks)
  • models/transaction_test.go (1 hunks)
  • services/requester/requester.go (1 hunks)
  • tests/go.mod (5 hunks)
  • tests/web3js/estimate_gas_overrides_test.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • models/transaction_test.go
⏰ 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: Test
  • GitHub Check: Lint
🔇 Additional comments (3)
tests/web3js/estimate_gas_overrides_test.js (1)

104-122: LGTM! Good test coverage for Osaka gas cap handling.

The test validates that eth_estimateGas continues to work correctly when provided with gas limits exceeding the EIP-7825 cap (16,777,216), ensuring the new capping logic in the gateway doesn't break estimation behavior.

go.mod (1)

7-7: LGTM! Dependency updates align with Fusaka hard-fork enablement.

The dependency bumps, particularly ethereum/go-ethereum to v1.16.5 and the updated onflow/flow-go commit, provide the necessary Osaka/Fusaka hard-fork support for PreviewNet and Testnet.

Also applies to: 13-15, 37-37, 43-43, 92-92, 149-150, 222-223

tests/go.mod (1)

6-6: LGTM! Test dependency updates maintain consistency with main module.

The test module dependencies are properly synchronized with the main go.mod, ensuring the test environment has the necessary Osaka/Fusaka support.

Also applies to: 8-8, 10-10, 12-13, 25-25, 31-31, 91-91, 160-161, 248-250

Comment on lines +358 to +356
blockNumber = blockOverrides.Number.ToInt()
}
if blockOverrides.Time != nil {
blockTime = uint64(*blockOverrides.Time)
Copy link
Member

@zhangchiqing zhangchiqing Nov 6, 2025

Choose a reason for hiding this comment

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

if blockNumber and blockTime are updated here, do we need to update the configs at Line 352 and 353?

			emulator.WithBlockNumber(blockNumber),
			emulator.WithBlockTime(blockTime),

Copy link
Collaborator Author

@m-Peter m-Peter Nov 6, 2025

Choose a reason for hiding this comment

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

Nice catch @zhangchiqing 👏

This part was a bit confusing, so I simplified the creation of the ChainConfig in ee75cc9 .

For reference, the config for the activation of each hard-fork, is actually hard-coded here: https://github.com/onflow/flow-go/blob/master/fvm/evm/emulator/config.go#L86-L123 . And this isn't something that depends on the block overrides that a user supplies for gas estimation.

The configs at Line 352 and 353:

emulator.WithBlockNumber(blockNumber),
emulator.WithBlockTime(blockTime),

only control the returned values of:

block.number;
block.timestamp;

in a Solidity contract function execution. And this part is already handled else-where: https://github.com/onflow/flow-evm-gateway/blob/main/services/requester/overridable_blocks_provider.go#L49-L55 .

@m-Peter m-Peter changed the title Enable EVM Fusaka hard-fork for PreviewNet & Testnet Enable EVM Fusaka hard-fork Nov 7, 2025
@m-Peter m-Peter force-pushed the mpeter/enable-fusaka-hard-fork branch from ee75cc9 to f9e2865 Compare November 7, 2025 11:34
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 ee75cc9 and f9e2865.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • go.mod (4 hunks)
  • models/errors/errors.go (0 hunks)
  • models/transaction_test.go (1 hunks)
  • services/requester/requester.go (1 hunks)
  • tests/go.mod (4 hunks)
  • tests/tx_batching_test.go (6 hunks)
  • tests/web3js/estimate_gas_overrides_test.js (1 hunks)
  • tests/web3js/eth_failure_handling_test.js (1 hunks)
💤 Files with no reviewable changes (1)
  • models/errors/errors.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • go.mod
  • tests/go.mod
  • services/requester/requester.go
  • models/transaction_test.go
🧰 Additional context used
🧬 Code graph analysis (1)
tests/web3js/eth_failure_handling_test.js (1)
tests/e2e-network/e2e_test.js (1)
  • assert (3-3)
⏰ 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). (1)
  • GitHub Check: Test
🔇 Additional comments (3)
tests/web3js/estimate_gas_overrides_test.js (1)

104-122: LGTM! Well-structured test for gas estimation above the Fusaka cap.

The test validates that eth_estimateGas correctly handles gas limits exceeding the EIP-7825 cap (16,777,216) and still returns accurate estimates. This aligns with the PR's objective of moving gas cap enforcement from transaction submission to the estimation layer.

tests/web3js/eth_failure_handling_test.js (2)

15-15: LGTM! Comment accurately reflects the Fusaka gas cap.

The updated comment correctly specifies the EIP-7825 gas limit of 16,777,216 and provides helpful context by mentioning the Fusaka hard-fork.


18-18: LGTM! Error message assertion updated for Fusaka cap.

The updated error message assertion reflects the new gas cap (16,777,216) and provides more detailed information by showing both the cap and the transaction's gas limit. This improves the error message quality.

@j1010001 j1010001 merged commit dd10cb6 into main Nov 7, 2025
2 checks passed
@j1010001 j1010001 deleted the mpeter/enable-fusaka-hard-fork branch November 7, 2025 16:11
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.

Ethereum Fusaka Update

5 participants