(This is an update on my Ethereum Protocol Fellowship. More updates can be found here ).
[2022.10.18] Initial note
Relevant background material:
- Bayesian Open Games,
- Composing games into complex institutions
- Compositional Game Theory
- There seem to be some examples based on staking here, but I do not really know what they implement.
[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.
- 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
- Installed Haskell Tool Stack
- Forked the open game engine from https://github.com/philipp-zahn/open-games-hs
- There seems to be a bug in the Haskell tool stack that made
stack runexecute the wrong code. I submitted a PR to fix this here. With this fix, all seems to run as it should.
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----
- 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.
- 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?
- Composing games means composing contracts through transactions -> games are contracts, strategies are essentially the contract code.
- The strategies are different choices of block composition, so games are choices of block construction -> composition is chain construction(?)
- (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
- What is MEV really?
- 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?