Skip to content

Commit

Permalink
Merge pull request #107 from NillionNetwork/chore/update-metrics-sect…
Browse files Browse the repository at this point in the history
…ions

chore: Update nada metric sections
  • Loading branch information
crypblizz8 authored Oct 10, 2024
2 parents 979a732 + 702008b commit 8d75452
Show file tree
Hide file tree
Showing 6 changed files with 311 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.idea
16 changes: 16 additions & 0 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Information-theoretic security is a measure of security that doesn't depend on c

A Linear Secret Sharing Scheme is a cryptography method where a secret is divided into multiple parts, known as shares. These shares are distributed among participants in such a way that only specific groups of shares can reconstruct the secret. The key property of LSSS is linearity, meaning that any linear combination of valid shares forms another valid share. This allows for flexibility in constructing access structures, determining which sets of participants can together reconstruct the secret.

#### Local Protocol

A Local Protocol is a cryptographic operation performed by nodes during the calculation of a program without the need for communication between them.

#### Masked factors

Masked factors are the protective factors in the Sum of Products. Masked factors are the one-time mask raised to the power of the masked exponent multiplied by the factor.
Expand All @@ -30,6 +34,18 @@ Masked factors are the protective factors in the Sum of Products. Masked factors

The one-time mask is the multiplicative mask that protects a factor. 

#### Online Protocol

An Online Protocol is a cryptographic operation performed by nodes during the calculation of a program in which the communication between them is necessary for correct completion.

#### Preprocessing Elements

Preprocessing refers to a computation that is executed before one is given the inputs to a certain computation task. Preprocessing can be used to speed up some cryptographic systems but also to speed up cryptanalytic attacks. In the case of Nillion preprocessing is used to improve the performance of the execution of online protocols.

Each online protocol requires a different amount and type of preprocessing elements. A "preprocessing service" inside each node is responsible for calculating these preprocessing elements and makes them available to the Nillion VM. The "preprocessing service" will try to make sure that there are enough available preprocessing elements in the node at any time.

Computing these preprocessing elements usually requires an MPC protocol. This is because there needs to be some syncrhonisation in the way these elements are created and used by the nodes.

#### Privacy-enhancing technologies (PETs)

Privacy-enhancing technologies (PETs) are technologies that embody fundamental data protection principles by minimizing personal data use, maximizing data security, and empowering individuals.
Expand Down
100 changes: 100 additions & 0 deletions docs/nada-execution-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
layout:
title:
visible: true
description:
visible: true
tableOfContents:
visible: true
outline:
visible: true
pagination:
visible: true
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Nada Execution Plan

A Nada Program is made of a sequence of instructions (protocols) that to be executed by the nodes. However, these instructions are not executed in the order that they appear in the program, they are reorganized in an early stage according to the dependencies between them. The purpose of this process is to minimize the number of communication rounds. The result of this reorganization is called the Execution Plan for the program. The Execution Plan specifies the way that how the program will be executed inside the NilVM in each Nillion node.

`nada` provides different ways to print the execution plan of a program. For instance, when we execute the command `nada run` with the flag `--metrics-execution-plan`. The result will be a set of metrics that are ordered following the Execution Plan.

<Tabs>

<TabItem value="metrics" label="Execution Plan metrics">

```
Summary:
Preprocessing elements:
Compare: 1
Execution metrics:
Execution duration:
5ms 880us 847ns
Compute duration:
total duration: 104us 787ns (min: 9us 715ns, max: 168us 126ns)
Total rounds: 3
Total network messages size: 1.19 kB
Local protocols: (execution order)
Not:
calls: 1
total duration: 9us 648ns (min: 6us 33ns, max: 21us 600ns)
Online protocols: (execution order)
LessThanShares:
calls: 1
total duration: 892us 741ns (min: 819us 492ns, max: 1ms 154us 380ns)
total network messages size: 1.19 kB
Execution Plan:
Step #0:
Count of communication rounds: 3
Round #0 message size: 23
Round #1 message size: 1139
Round #2 message size: 23
Protocols:
addr(2) - LessThanShares:
Execution step: 0
Total duration: 892us 741ns
Number of communication rounds: 3
Total message size: 1185
Used preprocessing elements:
- Compare: 1
Step #1:
Count of communication rounds: 0
Protocols:
addr(3) - Not:
Execution step: 1
Total duration: 9us 648ns
Number of communication rounds: 0
Total message size: 0
```

</TabItem>

<TabItem value="program" label="Nada Program">
```python reference showGithubLink
https://github.com/NillionNetwork/nada-by-example/blob/main/src/comparison_gte.py
```
</TabItem>

</Tabs>

Looking at the resulting file, we can see that the Execution Plan organizes the protocols into Execution Steps. This is the group of protocols that can be executed in parallel, because all their inputs have been resolved in some previous step. The steps are divided into two stages:
- Local: The [local protocols](/glossary#local-protocol) that are contained in the Execution Step. They are executed before the online protocols.
- Online: Once the local protocols have been executed, the [online protocols](/glossary#online-protocol) of the step can be executed.
76 changes: 76 additions & 0 deletions docs/nada-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
layout:
title:
visible: true
description:
visible: true
tableOfContents:
visible: true
outline:
visible: true
pagination:
visible: true
---

# Nada Metrics
The Nillion VM is able to calculate a number of useful execution metrics.

The list below describes the available program execution metrics.

#### Count of Communication Rounds
Number of times that a specific instance of protocol exchanged data during its execution.

#### Compute Duration

The effective time was taken to execute the program's protocols by a node.

#### Calls

Number of times that a protocol's variant was called during the program execution.

#### Duration

The effective time that a node spent to execute a specific instance of a protocol.

#### Execution Duration

The time was taken to complete a program execution.

#### Execution Step

The step in the Execution Plan in which a protocol was executed.

#### Local Protocols

The number of [local protocol](/glossary#local-protocol) executed.

#### Number of Communication rounds
Number of times that a specific protocol's instance exchanged data during its execution.

#### Online Protocols

The number of [online protocols](/glossary#online-protocol) executed.

#### Preprocessing elements

Number of [preprocessing elements](/glossary#preprocessing-elements) used by the protocols during the execution.

#### Round message size

The amount of data exchanged during a specific communication round.

#### Total Network Size

The amount of data exchanged during a protocol's instance execution.

#### Total Network Message Size

The amount of data exchanged during the program execution.

#### Total Rounds

The number of times that the nodes have exchanged data between them during the program execution.

#### Used preprocessing elements

The amount of [preprocessing elements](/glossary#preprocessing-elements) that a protocol was used by during its execution. It also reports the amount of each type of preprocessing element that was needed.
Loading

0 comments on commit 8d75452

Please sign in to comment.