Filip Široký
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # EPF Week 13 Updates **Topic: PEPC-Boost Research** Two weeks ago we decided that I should focus on implementation of the following specs: ### Objects - `Swap` - `tokenIn`: Number of tokens to swap - `tokenInType`: Can be `X` or `Y` - `minTokenOut`: ~ Slippage rate, minimum amount of token expected to be received after the swap - `AMM` - `reserve_x`: Number of tokens X provided by LPs to the pool - `reserve_y`: Number of tokens Y provided by LPs to the pool - Bonding curve, e.g., `reserve_x * reserve_y == k` for some parameter `k` - Assume no fee to LPs for now, we write the AMM state as $(R_x, R_y)$ = `(reserve_x, reserve_y)` ### Dynamics - Outside price process $P_t$ is available continuously, price of X in Y - e.g., $P_t \sim \text{GBM}(0, \sigma)$, with some initial $P_0$ - User swaps are received randomly throughout the 12 seconds - For slot $i$, draw a random number of transactions $N_i \sim \text{Poisson}(12 \lambda)$, where $\lambda$ is the average number of swaps received per second - Poisson process property: the swaps are uniformly distributed over $[12(i-1), 12i)$ (the duration of slot $i$). So draw $N_i$ samples from $U \sim \text{Uniform}(0, 12)$, one sample per transaction. - Transaction $j$ is drawn for time $t_j$, the price at the time the swap is made is $P_{t_j}$. Assume the user wants to swap $C_j$ tokens, with slippage rate $r_j$, then we set `minTokenOut` to: - $C_j \cdot P_{t_j} \cdot r_j$ if `tokenInType == "X"` - $\frac{C_j}{P_{t_j}} \cdot r_j$ if `tokenInType == "Y"` - This encodes the assumption that the user does not trade at the AMM price (which is stale after the previous block is built), but trades virtually at the price of the continuous exchange. - If we do not like this assumption, we can also replace $P_{t_j}$ with $P_{i-1} = \frac{R_y}{R_x}$. We could try with either one. - Question: How to set $C_j$? Could use historical data of swaps, or just draw from some power law distribution (many small swaps, few big swaps) and draw at random whether the `tokenInType` is X or Y. - Swap execution - Starting from AMM state $(R_x, R_y)$, with user swap $(C_j, r_j)$, we compute $T_o$ (token out) as - $T_o = \frac{R_y \cdot C_j}{R_x + C_j}$ (for `tokenInType == "X"`, inverting $R_x$ and $R_y$ otherwise) - See [this note](https://notes.ethereum.org/IRxkRus6Tou7v2V3e94s1w?view) for formula - If $T_o \leq$ `minTokenOut`, then the trade does not execute and simply reverts - If the swap executes successfully, then update the reserves - $R_x \leftarrow R_x + C_j$ - $R_y \leftarrow R_y - T_o$ - Also inverting if `tokenInType == "Y"` - Block construction - A single ToB searcher makes a swap to arbitrage the AMM against the CEX. They read the price $P_{12 \cdot i}$ (CEX price at the time of the release of block $i$), and make the swap which exactly moves the AMM state to $(R_x, R_y)$ such that $P_{12 \cdot i} = \frac{R_y}{R_x}$, i.e., price in the AMM is the same as the outside price $P_{12 \cdot i}$ - The ToB swap is added to the block, as the first transaction - User swaps are then added as RoB - Question: What should the ordering be? We could just use FCFS for now - Question: Should user swaps be tampered with? e.g., user gets sandwiched by the builder - And if so, should bundles be placed at the top of the RoB? ### Metrics - We measure how many user swaps revert in the RoB I have a working simulation written in Python that I'm going to be presenting next Wednesday on the 25th October on our PEPC meeting with Barnabé, Diego and Bharath. I currently spend time on answering all the related questions to this simulation. **Related materials** * [Why enshrine Proposer-Builder Separation? A viable path to ePBS. [Mike Neuder, Justin Drake] ](https://ethresear.ch/t/why-enshrine-proposer-builder-separation-a-viable-path-to-epbs/15710) * [PEPC FAQ [Barnabé Monnot]](https://efdn.notion.site/PEPC-FAQ-0787ba2f77e14efba771ff2d903d67e4?pvs=4) * [Ethereum PBS Roadmap [Mike Neuder]](https://www.youtube.com/watch?v=7OxDXd9C2SY&ab_channel=Celestia) * [Optimistic relays and where to find them](https://frontier.tech/optimistic-relays-and-where-to-find-them) * [Equivocation attacks on ePBS](https://ethresear.ch/t/equivocation-attacks-in-mev-boost-and-epbs/15338#headlock-in-epbs-8) * [Why unbundling the auction makes sense](https://arxiv.org/abs/2305.19150) * [Some stats around MEV extraction from CEX/DEX arbs](https://frontier.tech/a-tale-of-two-arbitrages) * [Cosmos design for TOB auctions, potentially relevant/good to see how they do it elsewhere/project to track](https://ideas.skip.money/t/x-builder-the-first-sovereign-mev-module-for-protocol-owned-building/57)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully