Skip to content

internal/ethapi: route SendRawTransaction through private path when enabled#2202

Closed
cffls wants to merge 4 commits intomasterfrom
priv_ep_fix
Closed

internal/ethapi: route SendRawTransaction through private path when enabled#2202
cffls wants to merge 4 commits intomasterfrom
priv_ep_fix

Conversation

@cffls
Copy link
Copy Markdown
Contributor

@cffls cffls commented Apr 29, 2026

Description

On a private-tx-enabled node, SendRawTransaction and SendRawTransactionSync now behave like SendRawTransactionPrivate so transactions are never gossiped on the public mempool, regardless of which endpoint the client uses.

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Nodes audience

In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on amoy
  • I have created new e2e tests into express-cli

Manual tests

Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

…nabled

On a private-tx-enabled node, SendRawTransaction and SendRawTransactionSync
now behave like SendRawTransactionPrivate so transactions are never gossiped
on the public mempool, regardless of which endpoint the client uses.
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.

@claude
Copy link
Copy Markdown

claude Bot commented Apr 29, 2026

Code review

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

@cffls cffls changed the base branch from develop to master April 29, 2026 04:53
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.25%. Comparing base (ad2d891) to head (b58e019).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2202      +/-   ##
==========================================
+ Coverage   52.21%   52.25%   +0.03%     
==========================================
  Files         884      884              
  Lines      155479   155586     +107     
==========================================
+ Hits        81190    81304     +114     
+ Misses      69060    69050      -10     
- Partials     5229     5232       +3     
Files with missing lines Coverage Δ
internal/ethapi/api.go 41.92% <100.00%> (+0.61%) ⬆️
params/version.go 23.68% <ø> (ø)

... and 34 files with indirect coverage changes

Files with missing lines Coverage Δ
internal/ethapi/api.go 41.92% <100.00%> (+0.61%) ⬆️
params/version.go 23.68% <ø> (ø)

... and 34 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@claude
Copy link
Copy Markdown

claude Bot commented Apr 29, 2026

Re: internal/ethapi/api.go line 2377

Bug: SubmitTxForPreconf is called unconditionally without checking whether SubmitTransaction succeeded. If SubmitTransaction fails (invalid nonce, pool full, etc.), the rejected transaction is still forwarded to block producers for preconfirmation. The log message "Transaction accepted locally" is also misleading when local submission failed.

Compare with SendRawTransactionForPreconf which correctly guards on the SubmitTransaction error before proceeding.

Suggested fix:

	hash, err := SubmitTransaction(ctx, api.b, tx)
	if err != nil {
		return common.Hash{}, err
	}

	// Submit tx directly to BP. Preconf processing mostly happens in background so don't
	// float the error back to the user.
	if err := api.b.SubmitTxForPreconf(tx); err != nil {

@cffls
Copy link
Copy Markdown
Contributor Author

cffls commented Apr 30, 2026

Canceling in favor of #2203

@cffls cffls closed this Apr 30, 2026
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