Expert Solidity Bootcamp – Week 4

MEV

Searcher Revenue:

  • Arbitrage Revenue: many protocolos rely on arbitrage and would not function without such actors. But this creates negative externality such as:
    • incentives to centralize
    • incentives to collusion
    • frontrunning of transactions
  • Atomic arbitrage: reduced risk, no timing risk, either you profit or your t fails. Flashloan can be used as collateral
  • Cross domain MEV: more risk bc not possible to do it atomically. Bridges are slow so capital is needed on both chains
  • Sandwich Revenue: now more than arbitrage

Impact:

  • Network congestion, volatile gas prices, failed bids that consume block space

Transaction flow:

  • user: anyone who express intent to change the state of the blockchain
  • walleT: uset interface that translates user intent into a blockchain tx
  • searcher: entities that monitor the mempool

Flashbots auction:

  • Send tx’s directly to the miners, bypassing the mempool
  • Needed a special node (mev-geth) , bundle together the tx’s and relay it

Proposer Builder Separation (PBS)

  • (not implemented yet) split the roles of validators and builders, so builders absord economies of scale, proposers stay decentralized.
  • meanhile, mev boost
  • they have to commit to a build and penalized if changed

MEV Optimisations

  • simulate tx’s to target the same block and simulate locally

on L2 there’s no gas market auctions

Formal Verification

Two approaches to verify the correctness:

  • formal verification
  • programming correctness: respecting the specs that determine how the users can interact with the smart contracts

Look it at the bytecode level, intermediate representation (yul) or high level language solidity

  • function level:
  • contract level: invariant that always holds
  • temporal property: a property that must hold for a sequence of tx to be valid

Symbolic Execution

  • explore different execution paths of a program using symbolic values instead of contrete inputs. Involves tracking symbolic representations of pgram inputs .

Taint Analysis

To track the flow of tainted data through a program. The analysis marks the origin of tainted data and propagates the taint through the program to identify how it flows and interacts with other values or sensitive operations.

Tools

  • solc-verify

Proof of Cat https://proofof.cat/

Storage structures

  • Verkle Trees: merkle claimed Airdrop: airdrop using merkle trees
  • Stateless Ethereum
    • State expiry: remove state that has not been accessed recently, and require witnesses to revive expired state
    • Weak statelessness: only block proposers store state, allow other nodes to verify blocks statelessly. This implies a switch to Verkle trees to reduce witness sizes.
  • Transient storage: EIP1153 – add opcodes for manipulating state that behaves identically to storage but it is discarded after every transaction

Huff

  • Construction of EVM assembly macros (blocks of bytecode that can be rigorously tested and evaluated.
  • It does not have variables, instead directly exposing the EVM program stack to the developer to be directly manipulated

Wormholes

  • Priority Gas Auctions: for front-running / ordering tx’s
  • Artemis: a rust library for writting bots
  • Memexplorer https://explorer.blocknative.com/?v=1.36.14&0=ethereum&1=main
  • Fair Sequencing Service (FSS): i.e. Arbitrum
  • Verkle trees: more efficient in proof size. Replace hash commitments with vector commitments or better still a polynomial commitment

Matter

  • Front-running bot: Generalized front running bots. Copy tx in the mempool and see if they can profit. You don’t even need to know what the tx is doing
  • Listen to the mempool
  • Listen to events (i.e. AddLiquidity)
  • Open Zeppelin Building an NFT merkle airdrop: https://blog.openzeppelin.com/workshop-recap-building-an-nft-merkle-drop

Leave a comment