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

fix: types inside mev_calls.rs #1435

Merged
merged 12 commits into from
Oct 15, 2024

Conversation

SkandaBhat
Copy link
Contributor

@SkandaBhat SkandaBhat commented Oct 5, 2024

Motivation

ref: paradigmxyz/reth#9472
Some types in mev_calls.rs are wrong

Solution

Updated types according to flashbots builder implementation: https://github.com/flashbots/builder/blob/df9c765067d57ab4b2d0ad39dbb156cbe4965778/core/sbundle_sim.go#L26

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

crates/rpc-types-mev/src/mev_calls.rs Outdated Show resolved Hide resolved
crates/rpc-types-mev/src/mev_calls.rs Show resolved Hide resolved
crates/rpc-types-mev/src/mev_calls.rs Outdated Show resolved Hide resolved
crates/rpc-types-mev/src/mev_calls.rs Outdated Show resolved Hide resolved
@@ -125,7 +125,7 @@ pub struct SimBundleOverrides {
pub gas_limit: Option<u64>,
/// Base fee used for simulation, defaults to parentBlock.baseFeePerGas
#[serde(default, with = "alloy_serde::quantity::opt", skip_serializing_if = "Option::is_none")]
pub base_fee: Option<u64>,
pub base_fee: Option<u128>,
Copy link
Member

Choose a reason for hiding this comment

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

I think we can keep u64 here tbh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried to keep it consistent with

pub base_fee: Option<u128>,
but going thru the codebase seems like both u64 and u128 is used

Comment on lines 149 to 150
#[serde(rename = "profit")]
pub total_profit: U256,
Copy link
Member

Choose a reason for hiding this comment

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

I don't see the json marshalling impl of this so I really have no ideal what the field is supposed to be called.

this change is now pretty redundant because this will still serializes as profit, but I really don't know if this is correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mev_share docs mentions "profit" in the rpc response(https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#mev_simbundle), and the golang implementation also renames TotalProfit to profit: https://github.com/flashbots/builder/blob/df9c765067d57ab4b2d0ad39dbb156cbe4965778/internal/ethapi/sbundle_api.go#L285

Maybe we can just call it profit because there doesnt seem to be any major difference semantically between the two and the bundle spec requires "profit"

@SkandaBhat
Copy link
Contributor Author

@mattsse also added revert and exec_error into the response, as per golang impl: https://github.com/flashbots/builder/blob/df9c765067d57ab4b2d0ad39dbb156cbe4965778/core/sbundle_sim.go#L26

@mattsse mattsse merged commit ff07988 into alloy-rs:main Oct 15, 2024
26 checks passed
@SkandaBhat SkandaBhat deleted the fix/bundle_response_types branch October 15, 2024 16:53
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.

2 participants