Files
pezkuwi-subxt/substrate/frame/sassafras/src/data/benchmark-results.md
T
Davide Galassi 095f4bd9ae Sassafras Consensus Pallet (#1577)
This PR introduces the pallet for Sassafras consensus.

## Non Goals

The pallet delivers only the bare-bones and doesn't deliver support for
auxiliary functionalities such as equivocation report and support for
epoch change via session pallet.

These functionalities were drafted in the [main
PR](https://github.com/paritytech/polkadot-sdk/pull/1336), but IMO is
better to introduce this auxiliary stuff in a follow up PR and after
client code.

## Potential follow ups

https://github.com/paritytech/polkadot-sdk/issues/2364

---------

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
2023-12-01 16:39:07 +01:00

2.3 KiB

Benchmarks High Level Results

  • Ring size: the actual number of validators for an epoch
  • Domain size: a value which bounds the max size of the ring (max_ring_size = domain_size - 256)

Verify Submitted Tickets (extrinsic)

x = Number of tickets

Domain=1024, Uncompressed (~ 13 ms + 11·x ms)

Time ~=    13400
    + x    11390
              µs

Domain=1024, Compressed (~ 13 ms + 11·x ms)

Time ~=    13120
    + x    11370
              µs

Domain=2048, Uncompressed (~ 26 ms + 11·x ms)

Time ~=    26210
    + x    11440
              µs

Domain=2048, Compressed (~ 26 ms + 11·x ms)

Time ~=    26250
    + x    11460
              µs

Conclusions

  • Verification doesn't depend on ring size as verification key is already constructed.
  • The call is fast as far as the max number of tickets which can be submitted in one shot is appropriately bounded.
  • Currently, the bound is set equal epoch length, which iirc for Polkadot is 3600. In this case if all the tickets are submitted in one shot timing is expected to be ~39 seconds, which is not acceptable. TODO: find a sensible bound

Recompute Ring Verifier Key (on epoch change)

x = Ring size

Domain=1024, Uncompressed (~ 50 ms)

Time ~=    54070
    + x    98.53
              µs

Domain=1024, Compressed (~ 700 ms)

Time ~=   733700
    + x    90.49
              µs

Domain=2048, Uncompressed (~ 100 ms)

Time ~=    107700
    + x    108.5
              µs

Domain=2048, Compressed (~ 1.5 s)

Time ~=   1462400
    + x    65.14
              µs

Conclusions

  • Here we load the full ring context data to recompute verification key for the epoch
  • Ring size influence is marginal (e.g. for 1500 validators → ~98 ms to be added to the base time)
  • This step is performed at most once per epoch (if validator set changes).
  • Domain size for ring context influence the PoV size (see next paragraph)
  • Decompression heavily influence timings (1.5sec vs 100ms for same domain size)

Ring Context Data Size

Domain=1024, Uncompressed

295412 bytes = ~ 300 KiB

Domain=1024, Compressed

147716 bytes = ~ 150 KiB

Domain=2048, Uncompressed

590324 bytes = ~ 590 KiB

Domain=2048, Compressed

295172 bytes = ~ 300 KiB