FHERMA
L2 · OPERATIONMEASURED

Encrypted Zero Test

encrypted-iszero · spec v0.1.0 · 0 implementations · 6 runners

Create implementationSpecification

DESCRIPTION

Returns 1 if the encrypted operand is zero and 0 otherwise.

The cheapest looking opcode in the set and not a cheap one: equality against a single point is a discontinuity, and an approximation that is merely close to zero near zero answers the wrong question. Every encrypted conditional reduces to this test, so its cost propagates into everything above it.

INTERFACE

encrypted_iszero(
  in  ct     : Ciphertext  // the encrypted first operand
  out ct     : Ciphertext  // the encrypted result of the opcode
  ...               // anything else the realization needs — keys, context, encoding — is its own concern
)

PARAMETER SCHEMA

NAMETYPERANGE
word_maxinteger255 – 2^32
target_precisionnumber0.5 – 1

The schema belongs to the kernel. Each implementation declares which part of it it supports.

CORRECTNESS

01The result is exactly one for a zero operand and exactly zero for any other.
02Values very close to zero but not zero must return zero, which is the case a loose approximation fails.
03The result matches the EVM definition of the opcode exactly, including its behaviour at the boundaries.

An opcode is exact by definition. Where the scheme is approximate, the precision threshold is what stands in for exactness, and it has to hold at every integer in range.

SECURITY PROPERTIES

Operands and result stay encrypted throughout. Nothing about the values may be observable through timing or control flow, which rules out any realization that branches on a decrypted intermediate.

ASSUMPTIONS

Operands are integers held exactly at the point of encryption.

REFERENCES

Encrypted Zero Test · FHERMA