Skip to content

Instantly share code, notes, and snippets.

##### Raw polynomials multiproof benchmark #####
For 1 polynomials:
Proving:
Proof serialization duration: 0.10ms
Proof creation duration: 51ms
Duration per step:
Generate challenge r and powers : 0.02ms
Calculate t, g(x) and D : 3.50ms
Calculate h(x) and E : 3.37ms
Calculate (h-g)(x) and E-D : 0.00ms
Link: https://github.com/gballet/go-ethereum/commit/8622bdcfb7238a94bedb68c4e18dd63e7e7e373b
Result:
```
$ go test ./trie/utils -run=TestPedersenHashDistribution -count=1 -v
=== RUN TestPedersenHashDistribution
Generating...
Aggregating...
Bit 0: 8000196 (deviation from expected 0.00%)
@jsign
jsign / f.md
Last active October 5, 2023 15:19
2023-10-05 VKT bench

CPU: AMD Ryzen 7 3800XT 8-Core Processor

Client: geth

Random key-values proving in a VKT

##### VKT proof benchmark #####
Setup: **in-memory** tree with 1000000 random key-values...
@jsign
jsign / msg.md
Created October 5, 2023 16:34
msg

So, for the verifying part of the proof, parallelization makes a difference.

Verifying proof of 16k openings:

Total duration: 56ms
Duration per step:
      Generate challenge r and powers                       : 32.02ms
      Calculating helper_scalars r^i/(t-z_i)                : 0.72ms
 g_2(t) = SUM y_i*(r^i/(t-z_i))=SUM y_i*helper_scalars : 0.03ms

This gist shares an experiment on an alternative implementation for JUMPDEST analysis.

Some quick notes:

  • The linked branch passes all go test ./... tests.
  • I'm not opening a PR since I'm not sure yet this might be convincing (explaining why below).

The main idea is to minimize the amount of bitwise operations by switching from a vector of byte to uint64. Using byte means that PUSHN where N is greater than 8 will have to span multiple bytes, thus requiring "internal loops".

Using uint64 means having more space to resolve any PUSHN in a single write attempt with at most one overflow without today's 2^16+2^8 decomposition.

@pytest.mark.zkevm
@pytest.mark.valid_from("Cancun")
@pytest.mark.parametrize(
"gas_limit",
[
36_000_000,
],
)
def test_worst_jumpdest(
blockchain_test: BlockchainTestFiller,
{
"tests/shanghai/eip3855_push0/test_push0.py::test_push0_contracts[fork_Cancun-state_test-before_jumpdest]": {
"env": {
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "0x016345785d8a0000",
"currentNumber": "0x01",
"currentTimestamp": "0x03e8",
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000000000",
"currentDifficulty": "0x00",
"currentBaseFee": "0x07",
tests/zkevm/test_worst_compute.py::test_worst_jumps[fork_Cancun-blockchain_test]-1 1008918
tests/zkevm/test_worst_stateful_opcodes.py::test_worst_storage_access_cold[fork_Cancun-blockchain_test-absent_slots_True-SSTORE same value]-2 26013705
tests/zkevm/test_worst_stateful_opcodes.py::test_worst_storage_access_cold[fork_Cancun-blockchain_test-absent_slots_True-SSTORE new value]-2 26140341
tests/zkevm/test_worst_stateful_opcodes.py::test_worst_address_state_cold[fork_Cancun-blockchain_test-absent_accounts_True-opcode_BALANCE]-1 135454439
tests/zkevm/test_worst_stateful_opcodes.py::test_worst_storage_access_cold[fork_Cancun-blockchain_test-absent_slots_True-SSLOAD]-2 186355602
tests/zkevm/test_worst_stateful_opcodes.py::test_worst_storage_access_cold[fork_Cancun-blockchain_test-absent_slots_False-SSTORE new value]-2 276562915
tests/zkevm/test_worst_bytecode.py::test_worst_bytecode_single_opcode[fork_Cancun-blockchain_test-opcode_EXTCODECOPY]-2297264421
tests/zkevm/test_worst_compute.py::test