# Verkle Trees - Proof worst-case scenario
This document tries to show the maximum number of polynomial openings that a block proof might contain.
## Rationale
The logic is the following:
1. Maximum gas per block is 30M (i.e: 15M*ELASTICITY_MULTIPLIER).
2. A freshly accessed _LeafNode_ [incurs in 1900 of gas cost](https://eips.ethereum.org/EIPS/eip-4762#witness-gas-costs).
3. Max storage-slot accesses (approx): 30M/1900 ~= 16k.
4. Assuming a worst-case scenario of storage-slot access being random, that would mean 16k uniquely accessed _LeafNodes_.
5. The number of openings that only involve the relevant _LeafNodes_ is 5 openings:
- 3 openings from the _extension node_ ([see illustration](https://notes.ethereum.org/@vbuterin/verkle_tree_eip#Illustration))
- 1 for position 0 (i.e: `1`)
- 1 for `stem`
- 1 for `C1` or `C2`
- 2 openings for the storage-slot value
- 1 for `value_lower`
- 1 for `value_higher`
6. This means that at _leaf node "levels"_ we have up to 16k*5 ~= 80k openings.
7. We have to also count _internal nodes_ openings, which are ~48k openings (approx):
- Assume the Verkle Tree has a depth of 4 (maybe 5 would be more correct?)
- Level 0: The root node is shared in all 16k _leaf node_ paths, so all of them share a single opening. (See [Comments](#Comments) section for a comment)
- Levels 1, 2, and 3: Each _leaf node_ would add three openings, one for each level. That means 3*16k ~= 48k openings.
8. The total number of openings is: 80k (point 6.) + 48k (point 7.) ~= 128k openings.
### Comments
- At step 7. I mention the root node having to do 256 openings. Despite not changing much the big numbers, could the verifier recompute the commitment instead of verifying the proof?
## Conclusion
In this worst-case scenario, we'd need to create a multiproof of **128k polynomial openings**.

block execution: 99.992976msINFO [07-15|13:10:28.917] Collected key values from base tree count=10000 duration=293.583654ms last account=008f65…483efbINFO [07-15|13:10:29.300] Prepared key values from base tree duration=382.488744msINFO [07-15|13:10:30.000] Inserted key values in overlay tree count=10000 duration=1.083027557smigration took: 1.376893246sfillLevels took 4.422121mscollecting nodes took 56.29µstoFrMultiple took 208.536µsupdating commitments took 3.090994mscollecting nodes took 5.472675mstoFrMultiple took 21.644539msupdating commitments took 52.035324mscollecting nodes took 2.3216mstoFrMultiple took 13.16166msupdating commitments took 54.440922mscollecting nodes took 127.455µstoFrMultiple took 639.024µsupdating commitments took 15.478009msFinalize: 211.469993msblock execution: 293.354953msINFO [07-15|13:10:30.971] Collected key values from base tree count=10000 duration=330.318923ms last account=008f65…483efbINFO [07-15|13:10:31.372] Prepared key values from base tree duration=400.638925msINFO [07-15|13:10:32.097] Inserted key values in overlay tree count=10000 duration=1.126096392smigration took: 1.456677516sfillLevels took 2.508844mscollecting nodes took 47.249µstoFrMultiple took 247.035µsupdating commitments took 4.936315mscollecting nodes took 7.428826mstoFrMultiple took 15.575423msupdating commitments took 50.524827mscollecting nodes took 2.413472mstoFrMultiple took 12.737298msupdating commitments took 41.038935mscollecting nodes took 139.996µstoFrMultiple took 648.065µsupdating commitments took 15.552383msFinalize: 193.08911msblock execution: 252.886918msINFO [07-15|13:10:32.963] Collected key values from base tree count=10000 duration=282.597556ms last account=00ab98…a45379INFO [07-15|13:10:33.531] Prepared key values from base tree duration=567.853577msINFO [07-15|13:10:33.900] Inserted key values in overlay tree count=10000 duration=937.057289msmigration took: 1.219926088sfillLevels took 7.629195mscollecting nodes took 136.204µstoFrMultiple took 414.446µsupdating commitments took 7.367287mscollecting nodes took 14.461581mstoFrMultiple took 18.437174msupdating commitments took 81.609759mscollecting nodes took 3.4579mstoFrMultiple took 19.02924msupdating commitments took 70.383834mscollecting nodes took 121.622µstoFrMultiple took 631.732µsupdating commitments took 15.461385msFinalize: 281.168431msblock execution: 239.645635msfillLevels took 269.784µscollecting nodes took 7.291µstoFrMultiple took 25.958µsupdating commitments took 641.648µscollecting nodes took 345.906µstoFrMultiple took 779.019µsupdating commitments took 5.172558mscollecting nodes took 198.328µstoFrMultiple took 601.982µsupdating commitments took 5.064353mscollecting nodes took 48.999µstoFrMultiple took 390.531µs

5/19/2024Why is this relevant for the Verkle conversion? We have to migrate all the data from MPT to VKT The keys in MPT are hashed We need the preimage of the hash to rekey it into the VKT Thus, we need all the preimages of the MPT tree Overlay Tree overview & timeline mental model image Current proposed strategy

5/16/2024EOF Verkle slides

4/22/2024This document attempts to do another round of optimizations to the Verkle Tree related Multiscalar Multiplications (MSM).

3/21/2024
Published on ** HackMD**

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