Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"mev_simBundle" rpc method for enhanced transaction simulation #9472

Open
zently opened this issue Jul 12, 2024 · 9 comments
Open

"mev_simBundle" rpc method for enhanced transaction simulation #9472

zently opened this issue Jul 12, 2024 · 9 comments
Assignees
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@zently
Copy link

zently commented Jul 12, 2024

Describe the feature

mev_simBundle is a rpc endpoint spec used for simulating a bundle in the virtual environment.
First introduced by the flashbot, it is widely recognized as THE BEST way to simulate a bundle (possibly multiple tx)

Currently eth_callBundle works well for similar purpose but mev_simBundle is better in that,
it returns transaction logs of the simulated transaction.

Having transaction logs is critical in multiple occasions such as,

  • Pre-validating transaction before sending real transaction (for protection, test)
  • Test / debugging contract
  • Searchers checking whether specific pending transaction yields specific action (e.g. token transfer, swap)

Currently, within "mev.rs" struct for the mev_simBundle is already defined fully,
while its implementation is missing in the "bundle.rs".

Additional context

Flashbots document

@zently zently added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Jul 12, 2024
@mattsse
Copy link
Collaborator

mattsse commented Jul 12, 2024

not opposed to this because I see this being useful and only does simulation
I think the reference impl is

https://github.com/flashbots/builder/blob/df9c765067d57ab4b2d0ad39dbb156cbe4965778/internal/ethapi/sbundle_api.go#L205

https://github.com/flashbots/builder/blob/df9c765067d57ab4b2d0ad39dbb156cbe4965778/core/sbundle_sim.go#L58

TODO

  • add new mev namespace
  • port simBundle function

@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started A-rpc Related to the RPC implementation and removed S-needs-triage This issue needs to be labelled labels Jul 12, 2024
@kien6034
Copy link
Contributor

hello, can i work on this issue?

@mattsse
Copy link
Collaborator

mattsse commented Jul 12, 2024

yes please,

for ref ptal at the call_bundle impl:

pub async fn call_bundle(&self, bundle: EthCallBundle) -> EthResult<EthCallBundleResponse> {

@kien6034
Copy link
Contributor

@mattsse
thank you sir

@jekkos
Copy link

jekkos commented Jul 21, 2024

Any progress on this? It would be nice to have the tx logs in the callbundle result. This used to be possible in a patched version of mev-geth as well.

@SkandaBhat
Copy link
Contributor

@mattsse if there have been no updates on this, I would like to pick this up. Could you please assign this to me?

@mattsse
Copy link
Collaborator

mattsse commented Sep 25, 2024

cool @SkandaBhat this should be similar to ethcallBundle impl, so please follow that impl and we can also do this in incremental steps, like first add the type and a basic impl, then port the existing go impl 1:1

@SkandaBhat
Copy link
Contributor

Working on the impl, will share a draft soon!

@SkandaBhat
Copy link
Contributor

SkandaBhat commented Oct 2, 2024

@mattsse We need to implement Bundle inside BundleItem in https://github.com/alloy-rs/alloy/blob/8d99c28da17232a26afe7af0251fde2cd00a89fe/crates/rpc-types-mev/src/mev_calls.rs#L83. I can implement and raise a PR over there

Issue created: alloy-rs/alloy#1416

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-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Status: Todo
Development

No branches or pull requests

5 participants