This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 126
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 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:
Inspection
strcut is replaced byTransactionData
, which is a complete representation of a transaction with internal calls and all events.DefiProtocol
trait that essential serves as the oldInspector
trait 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, theInternalCall
would need to be separated from the parentTransactionData
. )decode_call_action
has access to the corresponding events of the call and can decode those using theethers-rs
abigen
events. If a decodedAction
references logs, they are marked and filtered out for upcoming protocols.ReduceTx
trait which is the same as theReduce
trait but now forTransactionData
ERC20
DefiProtocol
should inspect last, because it should only pick upTransfer
events that are not part of anyDefiProtocol
inspections that are executed before.LiquidationReducer
should run after theTradeRecuder
, which bundles alls the various swaps.MevDB
client can now also store all, none, or only those events+calls used bydecode_call_action
in the database