This repository was archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
feat: revised model, detection schemes and more #59
Open
mattsse
wants to merge
58
commits into
flashbots:master
Choose a base branch
from
mattsse:new-database-model-and-inspect-reduce-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: revised model, detection schemes and more #59
mattsse
wants to merge
58
commits into
flashbots:master
from
mattsse:new-database-model-and-inspect-reduce-api
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This is a big one -.-
First of all, I don't expect everything to be included at once, or even at all. I rather chalk this up to personal research of the various protocols and MEV in general. If some parts of it are useful, I will gladly split it up and submit it separately or revise portions of it as well.
Solution
what I have changed:
Inspectionstrcut is replaced byTransactionData, which is a complete representation of a transaction with internal calls and all events.DefiProtocoltrait that essential serves as the oldInspectortrait and more.DefiProtocol::classify) in order, based on the call input. Then an attempt is made to decode the action of the call (DefiProtocol::decode_call_action). (perhaps this is a bit unintuitive, especially because both only take references and not mut, that's due to the design of the newTransactionData, to make this process a bit more ergonomic, theInternalCallwould need to be separated from the parentTransactionData. )decode_call_actionhas access to the corresponding events of the call and can decode those using theethers-rsabigenevents. If a decodedActionreferences logs, they are marked and filtered out for upcoming protocols.ReduceTxtrait which is the same as theReducetrait but now forTransactionDataERC20DefiProtocolshould inspect last, because it should only pick upTransferevents that are not part of anyDefiProtocolinspections that are executed before.LiquidationReducershould run after theTradeRecuder, which bundles alls the various swaps.MevDBclient can now also store all, none, or only those events+calls used bydecode_call_actionin the database