[go: up one dir, main page]

Draft: decryption in kernel benchmark

TLDR

We need host function for threshold encryption in kernel.

Context

This MR is created to measure the time needed to do decryption in the kernel for threshold encryption. The MR is not intended to be merged.

The decryption process involves 2 major steps, verifying the validity of the decryption shares, and combining the shares to decrypt the original payload.

This MR contains a kernel that runs these 2 operations each repeated 1000 times. To get the benchmark result, do the following:

In lib.rs, keep the code for the step to measure and comment out code for the other step. Build the kernel using cargo build --release --target wasm32-unknown-unknown Run the kernel in the debugger with ../octez-smart-rollup-wasm-debugger --kernel target/wasm32-unknown-unknown/release/decryption_kernel.wasm --inputs inputs.json and run time step inbox

The time used / 1000 would be a good estimate of the cost of the operation.

Result I got on my Mac is that verify key share costs 7ms, and combining key shares costs 3ms. Therefore, one decryption would cost 4 * 7ms + 3ms = 31ms, 4.7 times the cost of running on host machines, which takes 6.6ms(measured by @jtcoolen)

Based on this result, I believe it's safe to say that we need host function for the crypto-primitive for threshold encryption.

Update: with ec_pairing_check host function, verifying a key share would take a bit less than 3ms.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Julien Coolen

Merge request reports

Loading