Skip to content

Backmerge v2.7.2 to develop#2197

Merged
manav2401 merged 7 commits intodevelopfrom
master-v2.7.2-backmerge
Apr 24, 2026
Merged

Backmerge v2.7.2 to develop#2197
manav2401 merged 7 commits intodevelopfrom
master-v2.7.2-backmerge

Conversation

@manav2401
Copy link
Copy Markdown
Member

No description provided.

marcello33 and others added 7 commits April 23, 2026 19:57
…eth_simulateV1 (#1)

* re-enable eth_simulateV1 with fixes

* add ctx cancel errors on some rpc functions

* use private runner for kurtosis e2e tests

* bump golang and golangci-lint
…system txs (#3)

* internal/ethapi, consensus/bor: only bypass rpc gas cap for internal system txs

* internal/ethapi: update comments
)

* consensus/bor: refactor Finalize to add better checks for state-sync

* consensus/bor: refactor tests

* consensus/bor: resolve small comment for test

* consensus/bor: type check before setting state-syncs
Copilot AI review requested due to automatic review settings April 24, 2026 07:08
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@manav2401 manav2401 added the do not squash and merge This PR will be NOT be squashed and merged label Apr 24, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@manav2401 manav2401 merged commit 1a5510f into develop Apr 24, 2026
23 of 25 checks passed
@manav2401 manav2401 deleted the master-v2.7.2-backmerge branch April 24, 2026 07:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backmerge of v2.7.2 changes into develop, including consensus finalization error propagation, stricter Bor state-sync validation, and RPC-level protections/behavior updates (simulate v1, gas cap bypass, cancellation handling).

Changes:

  • Update consensus Engine.Finalize to return ([]*types.Receipt, error) and propagate failures through state processors and engines.
  • Strengthen Bor state-sync handling post-Madhugiri with clearer error separation (ErrStateSyncProcessing vs ErrStateSyncMismatch) and new tests.
  • Re-enable/extend eth_simulateV1 on Bor with call-count limits and a cross-block gas budget; tighten RPC gas-cap bypass to internal-consensus calls only; add context-cancellation checks for log scans/replay.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/bor/bor_test.go Adjust expected error for invalid state-sync tx in block body.
params/version.go Bump patch version to 2.7.2.
internal/ethapi/simulate_test.go Initialize simulator with new gas budget in tests.
internal/ethapi/simulate.go Add call-count caps, cross-block gas budget, and return maxUsedGas in simulate results.
internal/ethapi/bor_api_test.go Add tests for context cancellation during log scans and for RPC gas-cap bypass rules.
internal/ethapi/bor_api.go Introduce WithBorInternalCall context marker; make GetLogs/GetLatestLogs respect cancellation.
internal/ethapi/api_test.go Unskip/enable simulate tests; add cancellation test for AccountAt; update simulator wiring.
internal/ethapi/api.go Restrict RPC gas-cap bypass to internal consensus calls; re-enable SimulateV1 with limits and gas budgeting; add cancellation checks in AccountAt.
ethclient/ethclient_test.go Unskip simulate-v1 integration tests.
eth/tracers/data.csv Minor data adjustment/line normalization.
core/state_processor.go Handle errors returned from consensus finalization; refine state-sync mismatch error.
core/parallel_state_processor.go Same as above for parallel processor.
core/error.go Split Bor state-sync errors into processing vs mismatch categories.
consensus/consensus.go Update Engine interface Finalize signature to include error.
consensus/ethash/consensus.go Adapt ethash finalization to new signature and propagate errors.
consensus/clique/clique.go Adapt clique finalization to new signature and propagate errors.
consensus/beacon/consensus.go Adapt beacon finalization to new signature and propagate errors.
consensus/bor/heimdall/span/spanner.go Mark internal consensus contract calls to bypass RPC gas cap safely.
consensus/bor/contract/client.go Mark internal consensus contract calls to bypass RPC gas cap safely.
consensus/bor/bor.go Make Bor finalization return errors; validate state-sync tx presence/hash post-Madhugiri.
consensus/bor/bor_test.go Update Bor finalize tests for new error-returning behavior; add state-sync mismatch/processing coverage.
cmd/keeper/go.sum Dependency checksum updates.
Makefile Update golangci-lint install version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +373 to +374
// Enforce the cross-block gas budget.
if err := sim.budget.consume(result.UsedGas); err != nil {
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

The cross-block gas budget is consumed using result.UsedGas, which is after refunds (see core.ExecutionResult.MaxUsedGas comment). This allows a simulation to perform high-cost execution and reclaim part of it via refunds while only decrementing the budget by the discounted amount, weakening the DoS protection. Consider consuming result.MaxUsedGas instead (and keep GasUsed/header gas accounting on UsedGas for receipt correctness).

Suggested change
// Enforce the cross-block gas budget.
if err := sim.budget.consume(result.UsedGas); err != nil {
// Enforce the cross-block gas budget using pre-refund gas to avoid
// undercharging simulations that reclaim part of the execution cost.
if err := sim.budget.consume(result.MaxUsedGas); err != nil {

Copilot uses AI. Check for mistakes.
Comment on lines +459 to +469
remaining := gp.Gas()
if call.Gas == nil {
remaining := blockContext.GasLimit - *gasUsed
call.Gas = (*hexutil.Uint64)(&remaining)
}
if *gasUsed+uint64(*call.Gas) > blockContext.GasLimit {
return &blockGasLimitReachedError{fmt.Sprintf("block gas limit reached: %d >= %d", gasUsed, blockContext.GasLimit)}
}
if err := call.CallDefaults(sim.gp.Gas(), header.BaseFee, sim.chainConfig.ChainID); err != nil {
return err
if remaining < uint64(*call.Gas) {
return false, &blockGasLimitReachedError{fmt.Sprintf("block gas limit reached: remaining: %d, required: %d", remaining, *call.Gas)}
}
return nil
// Clamp to the cross-block gas budget.
gas := sim.budget.cap(uint64(*call.Gas))
gasCapped := gas < uint64(*call.Gas)
call.Gas = (*hexutil.Uint64)(&gas)
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

sanitizeCall checks remaining < *call.Gas before applying the RPC/global gas cap via sim.budget.cap(...). If a caller supplies a very large gas value that would be capped down below the block's remaining gas, this currently errors with block gas limit reached instead of proceeding with the capped value. Apply the budget clamp first (or clamp to min(requested, remaining, budgetRemaining)) and then validate against the per-block remaining gas.

Copilot uses AI. Check for mistakes.
@claude
Copy link
Copy Markdown

claude Bot commented Apr 24, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not squash and merge This PR will be NOT be squashed and merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants