summa
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • 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
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control 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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Summa V3 variations analysis ## Introduction This technical report explores the advancements in the third major iteration of Summa, known as Version 3 (V3), which aims to enhance performance over its predecessors. The previous version, V2, retained the underlying architecture of Halo2's Plonk, which presented bottlenecks, particularly during the discrete Fourier Transform (dFT) process, where polynomial coefficients are transformed into evaluation points. To address these inefficiencies, we transitioned to using the HyperPlonk backend, a shift necessary to improve performance by avoiding the use of dFT. However, this adaptation also uncovered a new vulnerability known as the "rebalancing attack" while optimizing circuit design in V3. In response to this challenge, we developed variations of V3 to provide solutions for safety concerns: - **V3-A** is the initial version using HyperPlonk, focusing on integrating and assessing the capabilities of this new backend. It includes additional columns for the running sum compared to the V2 circuit. - **V3-B** addresses scalability of **V3-C** by concatenating balances into a single balance column, thereby avoiding a newly discovered attacking vector(referred to as the "rebalancing attack") on the modified HyperPlonk backend. - **V3-C** modifies the circuit structure to exclude the running sum column from **V3-A**, safely handling a single currency and avoiding the newly discovered attacking vector(referred to as the "rebalancing attack") on the modified HyperPlonk backend. This report will detail the technical developments, implementation experiences, and performance evaluations of these three variants. ## V3 Implementations ### V3-A: Transition to HyperPlonk In the initial implementation of Version 3, known as V3-A, our team addressed the challenge of transitioning the backend from Plonk, as used in Halo2, to HyperPlonk. A crucial adaptation in V3-A was the introduction of additional columns specifically for the running sum. Unlike in V2, where the V2 implementation could directly obtain total balances that met constraints through special feature, HyperPlonk required a different approach. To maintain functionality and ensure the accurate computation of total balances under the constraints defined by the HyperPlonk, these additional columns became essential. The circuit of V3-A looks would be look like: | username | balance_A | balance_B | sum_A | sum_B | | -------- | --------- | --------- | -------:| ------:| | dxGaEAii | 1,000 | 100 | 1,000 | 100 | | MBlfbBGI | 2,000 | 200 | 3,000 | 300 | | ... | ... | ... | ... | | | AtwIxZHo | 100 | 0 | 783,100 | 38,000 | When we want to add more currencies in a single proof, it requires adding another column for the running sum, such as "Sum_A". This makes the commitment size almost double compared to V2. Therefore, Alex brought forward the idea of handling total balances without using the running sum column(s). ### Introducing Non-Zero Constraints Following the development of V3-A, the team aimed to refine the design further by addressing the increase in proof size due to the additional running sum columns. To achieve this, a key modification was made to the HyperPlonk backend through the introduction of the non-zero constraint feature[^pr_1], which Alex played a significant role in developing. This adjustment enables the inclusion of an extra row within the circuit design at the end of user balances during the sumcheck process. While it is possible to add an extra row without the non-zero constraint feature, this implementation ensures that such additions are effectively incorporated, guaranteeing that all balances are accurately computed in accordance with the non-zero constraint. We might structure the circuit as follows: | username | balance_A | balance_B | | -------- | -----------:| ----------:| | dxGaEAii | 1,000 | 100 | | MBlfbBGI | 2,000 | 200 | | ... | ... | ... | | AtwIxZHo | 100 | 0 | | | **783,100** | **38,000** | This configuration ensure that when balances are summed like an example: $$ 1,000 + 2,000 + ... + 100 - 783,100 + 100 + 200 + ... + 0 - 38,000 = 0$$ However, it introduces an attack vector that allows the prover to understate one asset balance and overstate another by the same amount. For example, inputting a total balance of 821,100 for Sum of `balance_A` and 0 for Sum of `balance_B` would still appear valid: | username | balance_A | balance_B | | -------- | -----------:| ---------:| | dxGaEAii | 1,000 | 100 | | MBlfbBGI | 2,000 | 200 | | ... | ... | ... | | AtwIxZHo | 100 | 0 | | | **821,100** | **0** | We named this attacking vector as "rebalancing attack". and We have to mitigate this. ### V3-C: Handling a Single Currency One straightforward approach to avoid the rebalancing attack is to handle only a single currency, utilizing the non-zero constraint feature. While this method is safe, it offers less scalability. The circuit might be structured as follows: | username | balance | | -------- | ---------:| | dxGaEAii | 1,000 | | MBlfbBGI | 2,000 | | ... | ... | | AtwIxZHo | 100 | | | 783,100 | In this configuration, there is no incentive to manipulate the total balance when only one currency is handled. ### V3-B: Scaling with Concatenating balance Like in **V3-C**, where it is safe to use only one column for the non-zero constraint feature, we sought to enhance scalability. In V3-B, we achieve this by encoding multiple balance values within a single column. Unfortunately, each cell in the finite field Bn254 can encode a value up to 254 bits, and the balance value is limited to 64 bits due to the range check chip allowance. Thus, we can split one cell to accommodate up to three currencies (84 * 3 = 252, which is less than 254). The concatenated balance for three currencies would appear as follows in a single cell: 0x00000000000003FFFFFFF00000000000002FFFFFFF00000000000001FFFFFFF This format concatenates the three values: A: 0x3FFFFFFF B: 0x2FFFFFFF C: 0x1FFFFFFF Through this concatenated balance column, V3-B can handle up to three currencies using a single column with the non-zero constraint. Each balance is allocated 84 bits within the finite field Bn254, totaling 252 bits for three currencies. Furthermore, this concatenated balance also sums up each row using a non-zero constraint. This means that the 20 bits (20 = 84 - 64 bits) can be used for separation and summation of all balances. For example, if all users hold `balance_A` at the value of 0xFFFFFFFF, which is the maximum value for 64 bits, the 20 bits of the concatenated balance would be used as a running sum for one currency. This implies that the user base cannot exceed $2^{20}$. If the prover uses this for over $2^{20}$ users, it could potentially affect the totals of subsequent currencies in the concatenated balance. Moreover, it's crucial to understand that when multiple balances, such as balance_A and balance_B, are combined into one field, the concatenated balance naturally exceeds 64 bits. This necessitates the establishment of a new constraint for unconcatenated values to ensure that each balance within the concatenated field is verified accurately during the range checking process. The circuit would look like: | username | concatenated balance | balance_A | balance_B | |----------|----------------------|-----------|-----------| | dxGaEAii | 0x0000..03e8..0064 | 0x3e8 | 0x64 | | MBlfbBGI | 0x0000..07d0..00c8 | 0x7d0 | 0xc8 | | ... | ... | ... | ... | | AtwIxZHo | 0x0000..00c8..0000 | 0xc8 | 0 | | | 0x000..bf2fc..9470 | | | `balance_A` and `balance_B` are used not only for range checks but also to verify that they are consistent with the concatenated balance. ## Performance Comparison by V3x Comparing the V3 variations to each other is challenging due to the limited number of currencies in `V3-B` and `V3-C`. However, we can examine cases with either three or one currency. `V3-B` can be compared with `V3-A` in a three-currency configuration, and `V3-C` can be compared with `V3-A` in a one-currency setup. **V3-A and V3-B performances with three currencies** | Version | Commitment generation time | Inclusion generation time | |:-------:| -----------------------------:| -----------------------------:| | V3-A | 16,219.3 ms | 124.0 ms | | V3-B | 16,254.2 ms | 114.5 ms | - V3-B improved the inclusion generation time by 7.6% (a reduction of 9.5 ms) while showing a 0.2% increase in commitment generation time, adding 34.85 ms. Reducing inclusion time is more critical than commitment time because it is a key factor in shortening the intervals between rounds if the custodian generates all inclusion proofs for users. **V3-A and V3-C performance with one currency** | Version | Commitment generation time | Inclusion generation time | |:-------:| -----------------------------:| -----------------------------:| | V3-A | 5,703.4 ms | 111.2 ms | | V3-C | 5,506.4 ms | 109.25 ms | - With one currency, V3-C decreased the commitment generation time by 3% (a reduction of 197.1 ms), which is an improvement over V3-A. However, the gain in the inclusion proof generation time is minimal at 0.17% (a reduction of 1.95 ms). - The results indicate that `V3-C` does not offer significant benefits when the custodian generates proofs for more than one currency, compared to `V3-A`. This is because `V3-A` can generate inclusion proofs in less than 200 ms for 100 currencies case - [Performance Comparison - Inclusion proof(V3a)](https://hackmd.io/wt4NkeUWSWi2ym6DNcsT-Q?view#Performance-Comparison-by-Summa-versions). ## Conclusion This report has detailed the advancements in Summa’s Version 3, focusing particularly on the unique attributes of **V3-B** and **V3-C**. These versions are optimized for specific use cases involving a limited number of currencies. **V3-B** excels when operating with up to three currencies, effectively balancing the trade-offs between the number of balance columns required and the constraints involved. This balance is achieved through the use of concatenated balances, which allow for efficient processing while maintaining security. In operational scenarios requiring the handling of three or fewer currencies, **V3-B** optimizes the circuit's efficiency by eliminating the need for running sum columns and introducing more specific constraints, avoiding additional circuit complexity. For custodians managing just one currency, **V3-C** offers a slight performance gain and is the optimal choice due to its streamlined circuit design. This design simplifies the constraints and enhances performance, making it well-suited for simpler setups where a single currency is involved. [^pr_1]: https://github.com/summa-dev/plonkish/pull/2

    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