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

feat: Add Bundle Validate methods #4

Merged
merged 3 commits into from
Oct 23, 2024
Merged

feat: Add Bundle Validate methods #4

merged 3 commits into from
Oct 23, 2024

Conversation

ryanschneider
Copy link
Contributor

📝 Summary

This adds Validate methods to EthSendBundleArgs and MevSendBundleArgs which return the canonical hash (and UUID for the case of bundles, not sure if we need this for mev-share bundles yet) or an error if the payload fails validation. Currently the validation isn't exhaustive, I wanted to get your feedback on this overall approach before going further, and of course I'd like to add unit tests to make sure that the generated hashes match our existing codebases.

⛱ Motivation and Context

When processing these args on the backend we need to have the canonical hashes and UUIDs, it seems like a good idea to generate these in one spot.

📚 References


✅ I have run these commands

  • make lint
  • make test
  • go mod tidy

Copy link
Collaborator

@dvush dvush left a comment

Choose a reason for hiding this comment

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

LGTM

I think the approach is good. We can have some basic validate functions here while mev share / bundle relay backend can have their own where they validate tx signature too

proxy/types.go Outdated
return common.BytesToHash(hash.Sum(nil)), nil
}

func hashMevSendBundle(b *MevSendBundleArgs, hash hash.Hash) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets add depth validation here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 0bbba62

@dvush
Copy link
Collaborator

dvush commented Oct 22, 2024

In case you need tests for bundle uuid, here are some of them https://github.com/flashbots/rbuilder/blob/develop/crates/rbuilder/src/primitives/serialize.rs#L607 There are also tests for mev share bundle there

@ryanschneider ryanschneider marked this pull request as ready for review October 22, 2024 21:41
@dvush dvush merged commit 7d86ae6 into main Oct 23, 2024
2 checks passed
@dvush dvush deleted the bundle-validation branch October 23, 2024 12:54
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