Skip to content

feat(rpc): propagate TransactionOrigin through send_transaction and batcher#21969

Merged
mattsse merged 6 commits intomainfrom
klkvr/send-transaction-origin
Feb 9, 2026
Merged

feat(rpc): propagate TransactionOrigin through send_transaction and batcher#21969
mattsse merged 6 commits intomainfrom
klkvr/send-transaction-origin

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 8, 2026

Summary

Adds TransactionOrigin as a parameter to EthTransactions::send_transaction and propagates it all the way down to the BatchTxProcessor, which previously hardcoded TransactionOrigin::Local.

This allows downstream implementations (e.g. custom eth_sendRawTransactionPrivate endpoints) to submit transactions with TransactionOrigin::Private through the same batcher pipeline.

Changes

  • BatchTxRequest: add origin: TransactionOrigin field
  • BatchTxProcessor::process_batch: group requests by origin before calling add_transactions
  • EthApiInner::add_pool_transaction: accept origin parameter
  • EthTransactions::send_transaction: accept origin parameter
  • EthApi::send_transaction impl: forward origin to add_pool_transaction
  • Derive PartialOrd, Ord on TransactionOrigin for grouping
  • Existing callers (send_raw_transaction, send_transaction_request) continue to use Local

Testing

cargo test -p reth-transaction-pool --lib batcher — 4/4 pass
cargo clippy -p reth-rpc -p reth-rpc-eth-api -p reth-transaction-pool — clean

…atcher

- Add `origin` field to `BatchTxRequest` so the batcher respects the
  caller-specified origin instead of hardcoding `TransactionOrigin::Local`
- Add `origin` parameter to `EthTransactions::send_transaction` trait method
- Update `EthApiInner::add_pool_transaction` to accept and forward origin
- `BatchTxProcessor::process_batch` groups requests by origin before batch
  insertion via `add_transactions`
- Derive `PartialOrd, Ord` on `TransactionOrigin` for `BTreeMap` grouping
- Existing callers (`send_raw_transaction`, `send_transaction_request`) continue
  to use `TransactionOrigin::Local`

Co-authored-by: klkvr <klkvr@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c3f5c-0c1c-703a-9da7-c46be75e7acf
Co-authored-by: Amp <amp@ampcode.com>
@gakonst gakonst added the A-rpc Related to the RPC implementation label Feb 8, 2026
@gakonst gakonst added the A-rpc Related to the RPC implementation label Feb 8, 2026
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Feb 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
reth-rpc: minor
reth-rpc-eth-api: minor
reth-transaction-pool: minor
---

Added per-transaction origin tracking to the transaction pool batch insertion system. The `send_transaction` and `add_transactions` APIs now support specifying individual `TransactionOrigin` values for each transaction, enabling proper differentiation between local and external transactions in batch operations.

Add changelog to commit this to your branch.

@gakonst gakonst force-pushed the klkvr/send-transaction-origin branch 2 times, most recently from e0ce4f1 to e1e6e3f Compare February 9, 2026 12:08
…atcher

- Add `origin` field to `BatchTxRequest`
- Add `TransactionOrigin` parameter to `EthTransactions::send_transaction`
- Add `TransactionPool::add_transactions_with_origins` accepting per-tx origins
  via `Vec<(TransactionOrigin, Transaction)>`
- Make `TransactionPool::add_transactions` a default method delegating to
  `add_transactions_with_origins`
- Inner `Pool::add_transactions` delegates to `Pool::add_transactions_with_origins`
- `BatchTxProcessor::process_batch` uses `add_transactions_with_origins` directly
- Existing callers (`send_raw_transaction`, `send_transaction_request`) continue
  to use `TransactionOrigin::Local`

Co-authored-by: klkvr <klkvr@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c3f5c-0c1c-703a-9da7-c46be75e7acf
@gakonst gakonst force-pushed the klkvr/send-transaction-origin branch from e1e6e3f to 44e9a2e Compare February 9, 2026 12:23
@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Feb 9, 2026
@mattsse mattsse enabled auto-merge February 9, 2026 19:41
klkvr and others added 2 commits February 10, 2026 00:18
- task.rs: collect mapped iterator into Vec before passing to
  validate_transactions, fixing Send bound error
- transaction.rs: change send_raw_transaction to use
  TransactionOrigin::External instead of Local

Amp-Thread-ID: https://ampcode.com/threads/T-019c4401-f497-7668-a25e-64c6fe49d873
Co-authored-by: Amp <amp@ampcode.com>
@mattsse mattsse added this pull request to the merge queue Feb 9, 2026
@gakonst
Copy link
Member Author

gakonst commented Feb 9, 2026

The PR is in the merge queue so I can't push arsenii's suggestion directly. The current fix (Vec collect) works but is suboptimal. A follow-up can replace it by adding IntoIter: Send bounds to validate_transactions and validate_transactions_with_origin signatures, which avoids the allocation entirely.

Merged via the queue into main with commit 32466fe Feb 9, 2026
41 checks passed
@mattsse mattsse deleted the klkvr/send-transaction-origin branch February 9, 2026 20:43
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Feb 9, 2026
CarlBeek added a commit to CarlBeek/reth that referenced this pull request Feb 10, 2026
* paradigmxyz/main: (144 commits)
  feat(engine): add getPayloadBodiesV2 endpoints for EIP-7928 BAL support (paradigmxyz#21774)
  ci: skip scheduled workflows on forks (paradigmxyz#22022)
  chore: rm random log file (paradigmxyz#22023)
  chore: remove base.reth.rs public endpoint references (paradigmxyz#22019)
  feat(rpc): add `subscribeFinalizedChainNotifications` endpoint (paradigmxyz#22011)
  feat(trie): remove `SerialSparseTrie` (paradigmxyz#21808)
  fix(rocksdb): set max_open_files to prevent fd exhaustion (paradigmxyz#22005)
  refactor(txpool): rename and document validation methods (paradigmxyz#22008)
  feat(engine): prefetch withdrawal addresses in pre-warming (paradigmxyz#21966)
  refactor(pool): add IntoIter: Send bounds to avoid unnecessary Vec collect (paradigmxyz#22001)
  fix(rpc): enforce blockHash constraint in append_matching_block_logs (paradigmxyz#22007)
  chore: move Kurtosis failures to the hive slack channel  (paradigmxyz#21983)
  feat(rpc): propagate TransactionOrigin through send_transaction and batcher (paradigmxyz#21969)
  feat(engine): reorg depth commitment metric (paradigmxyz#21992)
  feat(storage): add use_hashed_state storage setting (paradigmxyz#21997)
  perf: better scheduling for storage roots computation (paradigmxyz#21987)
  chore(deps): bump alloy 1.6.2 -> 1.6.3 (paradigmxyz#21986)
  fix(stages): skip sender unwind when fully pruned (paradigmxyz#21988)
  chore(net): remove OP stack bootnodes (paradigmxyz#21984)
  ci: use depot for hive and kurtosis image builds, run daily (paradigmxyz#21976)
  ...

# Conflicts:
#	.github/workflows/compact.yml
#	.github/workflows/dependencies.yml
#	.github/workflows/docker-tag-latest.yml
#	.github/workflows/docker.yml
#	.github/workflows/e2e.yml
#	.github/workflows/hive.yml
#	.github/workflows/integration.yml
#	.github/workflows/kurtosis.yml
#	.github/workflows/lint.yml
#	.github/workflows/release.yml
#	.github/workflows/reproducible-build.yml
#	.github/workflows/stale.yml
#	.github/workflows/sync-era.yml
#	.github/workflows/sync.yml
#	.github/workflows/unit.yml
#	bin/reth/Cargo.toml
#	crates/cli/commands/src/node.rs
#	crates/node/core/src/node_config.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rpc Related to the RPC implementation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants