Hello Skippers and Skippettes,
Intents or preferences (or conditionals, or partials…) have been a hot topic recently as they are appearing in many places: Flashbots, DYDX, Anoma, EIP 4337, Skip?.. Intents are supposed to provide users with an alternative, more general way to transact where instead of specifying the exact message calls which is the current norm, they only specify certain preferences for what they want and allow someone to fulfill those preferences on their behalf. It has been proposed that they may prove useful for a few use cases. A notable, broad one is to move complexity off-chain for various applications. This is because instead of running some combinatorial matching algorithm on-chain, the on-chain logic for intents just needs to verify that the preferences of the user were fulfilled.
Bc of their relevance to a lot projects, @barry, @ksk and I were discussing whether there was a reasonable, more formal definition and thought it’d be nice to move the conversation to here instead in case anyone had differing or complimentary thoughts (or questions!).
The way I have been thinking about them is that an intent is a tuple, \iota = (B, E, T) where:
- B is a subset of all possible states Q and represents the supported begin states specified by the intent placer (eg, I don’t want to start with less than 100 $ETH)
- E is a subset of all possible states Q and represents the supported end states specified by the intent placer (eg, I want to end 20 $SHIB)
- T is a set of “preferred” sequences of transactions that is used to bring the begin state to the end state (eg the user may not want sandwich patterns, or txs coming from a specific address)
The state transition function s: Q \times \mathcal{T} \to Q takes a transaction and begin state as input and outputs the resulting state.
An intent is fulfilled if for some begin state q_0, and sequence of transactions t = t_1, ..., t_n, where q_n = s(s(...s(s(q_0, t_0) , t_1), ...) t_n), is the end state, q_0 \in B, q_n \in E, t \in T
This was pretty similar to @ksk (and I think Tarun’s) definition which used “execution trace” to describe the sequence of state transitions and the preferences over them. Although theirs was (expectedly) more concise and polished.
We can expand this definition to describe Intent Clearing or solving. We know that there is only a valid solution for clearing a set of intents \iota_0, ..., \iota_m iff B_0 \cap ... \cap B_m \neq \emptyset, E_0 \cap ... \cap E_m \neq \emptyset, and T_0 \cap ... \cap T_m \neq \emptyset. This is because, a non-empty intersection means there exist preferences in common. We can also combine intents into a single meta-intent \iota' = (B', E', T') with similar logic B_0 \cap ... \cap B_m = B', E_0 \cap ... \cap E_m = E', and T_0 \cap ... \cap T_m = T'
Of course this doesn’t tell us whether or not the sequence of transactions used to fulfill the intents are favorable to the solver though, just that there exists a possible solution (eg the solver giving away all their $ETH fulfills the meta-intent, but they’d probably never want to actually do that - unless they were super charitable? ).
Thoughts?