Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Sparse merkle tree multiproofs#104

Merged
hackfisher merged 13 commits into
masterfrom
merkle-multi-queries
Dec 20, 2021
Merged

Sparse merkle tree multiproofs#104
hackfisher merged 13 commits into
masterfrom
merkle-multi-queries

Conversation

@hujw77
Copy link
Copy Markdown
Collaborator

@hujw77 hujw77 commented Dec 8, 2021

We define a Merkle multiproof as a minimal subset of nodes in a Merkle tree needed to fully authenticate that a set of nodes actually are part of a Merkle tree with some specified root, at a particular set of generalized indices. For example, here is the Merkle multiproof for positions 0, 1, 6 in an 8-node Sparse merkle tree (i.e. generalized indices 8, 9, 14):

       .
   .       .
 .   *   *   .
x x . . . . x *

. are unused nodes, * are used nodes, x are the values we are trying to prove.

@hujw77
Copy link
Copy Markdown
Collaborator Author

hujw77 commented Dec 13, 2021

Single proof test
yarn test test/v1/2_test_light_client_gas.js

·-----------------------------------------------------|---------------------------|----------------|-----------------------------·
|                 Solc version: 0.6.7                 ·  Optimizer enabled: true  ·  Runs: 999999  ·  Block limit: 12450000 gas  │
······················································|···························|················|······························
|  Methods                                                                                                                       │
······················|·······························|·············|·············|················|···············|··············
|  Contract           ·  Method                       ·  Min        ·  Max        ·  Avg           ·  # calls      ·  eur (avg)  │
······················|·······························|·············|·············|················|···············|··············
|  LightClientBridge  ·  completeSignatureCommitment  ·     185698  ·     585617  ·        458868  ·           30  ·          -  │
······················|·······························|·············|·············|················|···············|··············
|  LightClientBridge  ·  newSignatureCommitment       ·     174380  ·     344521  ·        205544  ·           30  ·          -  │
······················|·······························|·············|·············|················|···············|··············
|  Deployments                                        ·                                            ·  % of limit   ·             │
······················································|·············|·············|················|···············|··············
|  LightClientBridge                                  ·    4607902  ·    4607950  ·       4607939  ·         37 %  ·          -  │
·-----------------------------------------------------|-------------|-------------|----------------|---------------|-------------·

@hujw77
Copy link
Copy Markdown
Collaborator Author

hujw77 commented Dec 13, 2021

Multi proof test
yarn test test/v2/test_beefy_light_client.js

·-------------------------------------------------------|---------------------------|----------------|-----------------------------·
|                  Solc version: 0.6.7                  ·  Optimizer enabled: true  ·  Runs: 999999  ·  Block limit: 12450000 gas  │
························································|···························|················|······························
|  Methods                                                                                                                         │
························|·······························|·············|·············|················|···············|··············
|  Contract             ·  Method                       ·  Min        ·  Max        ·  Avg           ·  # calls      ·  eur (avg)  │
························|·······························|·············|·············|················|···············|··············
|  DarwiniaLightClient  ·  completeSignatureCommitment  ·     182044  ·     464983  ·        344858  ·           30  ·          -  │
························|·······························|·············|·············|················|···············|··············
|  DarwiniaLightClient  ·  newSignatureCommitment       ·     174898  ·     345754  ·        206488  ·           30  ·          -  │
························|·······························|·············|·············|················|···············|··············
|  Deployments                                          ·                                            ·  % of limit   ·             │
························································|·············|·············|················|···············|··············
|  DarwiniaLightClient                                  ·    4551572  ·    4551620  ·       4551606  ·       36.6 %  ·          -  │
·-------------------------------------------------------|-------------|-------------|----------------|---------------|-------------·

@hujw77 hujw77 marked this pull request as ready for review December 13, 2021 11:31
@hackfisher hackfisher added the C1-neeedaudit Need audit label Dec 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

C1-neeedaudit Need audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants