(This is an update on my Ethereum Protocol Fellowship. More updates can be found here ).

[2022.10.18] Initial note

Initial idea: discuss the usage of the Open Game engine with Barnabé Monnot. A demo is presented from 3:51 on here.

Relevant background material:

[2022.10.20] First meeting

  • Had first discussion with Barnabé Monnot
  • More precise plan: What do MEV strategies look like in the open games framework, and how do they interact. That is: given an open game description of a contract, how should we think about the strategies of the users and block builders. I could start with a simple toy system and see where that leads me.

    Challenges
  • How to go from smart contract to open game? The Clockwork Finance framework seems like a nice approach:
  • Who are the players in this game?
    • Users: send transactions that can lead to MEV opportunities
    • Builders: Have the power to extract MEV
    • Contracts: also have ‘strategies’–can respond to states and contexts
    • The MEV calculator/searcher? Or should I assume the existence of an MEV oracle?
    • Can all of these be abstracted into “Accounts”?
  • What do MEV strategies actually look like in practice?
  • Install Haskell and the Open Game engine



[2022.10.24] First test with the open-games-hs engine

In addition, I opened an interactive ghci session, and tested the simplest case: a single decision game where the optimum is choosing the number 5, with a squared error utility loss. This worked as it should:

> λ: isOptimalSingleDecisionVerbose (pureIdentity 2)
----Analytics begin----
 Strategies are NOT in equilibrium. Consider the following profitable deviations:

Player: player1
Optimal Move: 5.0
Current Strategy: fromFreqs [(2.0,1.0)]
Optimal Payoff: 0.0
Current Payoff: -9.0
Observable State: ()
Unobservable State: "((),())"
 --other game--
 --No more information--
 NEWGAME:
----Analytics end----

> λ: isOptimalSingleDecisionVerbose (pureIdentity 5)
----Analytics begin----
 Strategies are in equilibrium
 NEWGAME:
----Analytics end----



As a sanity check, changing the payoff function to the constant 0-function by setting payoffFunction peak dec = - 0*(peak - dec)**2 in Decision.hs results in every strategy being an equilibrium:

> λ: isOptimalSingleDecisionVerbose (pureIdentity 5)
----Analytics begin----
 Strategies are in equilibrium
 NEWGAME:
----Analytics end----

> λ: isOptimalSingleDecisionVerbose (pureIdentity 2)
----Analytics begin----
 Strategies are in equilibrium
 NEWGAME:
----Analytics end----

> λ: isOptimalSingleDecisionVerbose (pureIdentity 1)
----Analytics begin----
 Strategies are in equilibrium
 NEWGAME:
----Analytics end----

> λ: isOptimalSingleDecisionVerbose (pureIdentity 0)
----Analytics begin----
 Strategies are in equilibrium
 NEWGAME:
----Analytics end----

Next steps

  • Read Clockwork Finance paper
  • Understand MEV strategies
  • Implement simple system in Open Game engine myself



[2022.10.26] Meeting notes

Had meeting with Barnabé, Philipp, and Fabrizio to discuss scope, relevance, and ideas.

Some takeaways

  • Relevance: The ultimate dream is to have fully automated (de)compiling of EVM bytecode to OG engine DSL, where MEV strategy compositionality can be immediately verified. That is a long-term vision, but finding the ‘right’ way to model contracts with OGs is an important step.
  • Central challenge: at which level to model the games; who are the agents? How ‘intelligent’ are they? Can they reason about other agents? What are the types at the wires? TXs, EVM states, contracts?
  • Options:
    1. Composing games means composing contracts through transactions -> games are contracts, strategies are essentially the contract code.
    2. The strategies are different choices of block composition, so games are choices of block construction -> composition is chain construction(?)
    3. (speculative) ‘smart transactions’ are the games, and composition is block construction.
  • One advantage: mempool is public, so not much private information reasoning.
  • Concensus and execution should be kept completely separate for now
  • They have draft implementations in the Open Game engine of the model contracts presented in the Clockword Finance framework
    • Uniswap
    • Maker
    • Bet

Background questions

  • What is MEV really?
    • How much MEV can be extracted form a blockchain with 1 tx per block?
    • Once we have the right formalism for treating MEV strats as games, can we define MEV in a precise way, as a fundamental property of the formalism (e.g. categorified MEV?)
    • This is MEV
    • This is not MEV
  • So far we’ve only discussed sequential composition. What about parallel? e.g. bots competing for attacks at the same timea.
  • Does the compositionality show new structure? E.g. Is doing a bunch of arbitrages on different AMMs equivalent to a standard arbitrage on a composed AMM (see here? Is this ‘obvious’ from the string diagrams?

TODO

  • Dive in the examples that are implemented. Do I understand what is happening? Can I run the standard analysis? Can I draw the string diagrams?
  • Probably start with the simplest: a single uniswap call. ref1 ref2