Skip to content

fix(mev): correct refund calculation in sim_bundle#19991

Merged
mattsse merged 1 commit intoparadigmxyz:mainfrom
zeroprooff:fix-sim-bundle-refund
Nov 28, 2025
Merged

fix(mev): correct refund calculation in sim_bundle#19991
mattsse merged 1 commit intoparadigmxyz:mainfrom
zeroprooff:fix-sim-bundle-refund

Conversation

@zeroprooff
Copy link
Contributor

Fixed a bug where multiple transactions with refund_percent in a bundle were getting incorrect refund amounts.

The problem was that each transaction calculated its refund from the already-reduced refundable_value instead of the original amount. This caused later transactions to receive progressively smaller payouts.

For example, with two txs requesting 50% refund each from 1000 wei:

  • First tx: got 500 wei (correct)
  • Second tx: got 250 wei (50% of remaining 500, wrong - should be 500)

The fix stores the original refundable_value before the loop and uses that for all calculations. This matches the validation logic that ensures the sum of all refund percentages doesn't exceed 100%.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

ah I see, this would always decrease the paylout value

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Nov 28, 2025
@mattsse mattsse added this pull request to the merge queue Nov 28, 2025
@mattsse mattsse added C-bug An unexpected or incorrect behavior A-rpc Related to the RPC implementation labels Nov 28, 2025
Merged via the queue into paradigmxyz:main with commit 36c6280 Nov 28, 2025
44 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Nov 28, 2025
@zeroprooff zeroprooff deleted the fix-sim-bundle-refund branch November 28, 2025 11:14
cwkang1998 added a commit to cwkang1998/reth that referenced this pull request Jan 8, 2026
Accumulates TriesUpdateSorted and batch write at at the end. Prior
benchmark done in paradigmxyz#19739 indicates this should improve batch processing
performance.

Both paradigmxyz#19739 and its succeesor paradigmxyz#19991, contains benchmarks that measures
the performance improvements. I am not really familiar on how to do
that, so if that's something that's required, would appreciate some
help.

Closes paradigmxyz#20611
cwkang1998 added a commit to cwkang1998/reth that referenced this pull request Jan 8, 2026
Accumulates TriesUpdateSorted and batch write at at the end. Prior
benchmark done in paradigmxyz#19739 indicates this should improve batch processing
performance.

Both paradigmxyz#19739 and its succeesor paradigmxyz#19991, contains benchmarks that measures
the performance improvements. I am not really familiar on how to do
that, so if that's something that's required, would appreciate some
help.

Closes paradigmxyz#20611
cwkang1998 added a commit to cwkang1998/reth that referenced this pull request Jan 9, 2026
Accumulates TriesUpdateSorted and batch write at at the end. Prior
benchmark done in paradigmxyz#19739 indicates this should improve batch processing
performance.

Both paradigmxyz#19739 and its succeesor paradigmxyz#19991, contains benchmarks that measures
the performance improvements. I am not really familiar on how to do
that, so if that's something that's required, would appreciate some
help.

Closes paradigmxyz#20611
cwkang1998 added a commit to cwkang1998/reth that referenced this pull request Jan 13, 2026
Accumulates TriesUpdateSorted and batch write at at the end. Prior
benchmark done in paradigmxyz#19739 indicates this should improve batch processing
performance.

Both paradigmxyz#19739 and its succeesor paradigmxyz#19991, contains benchmarks that measures
the performance improvements. I am not really familiar on how to do
that, so if that's something that's required, would appreciate some
help.

Closes paradigmxyz#20611
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 C-bug An unexpected or incorrect behavior

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants