From 431a755226b97f92c8c86748e509fcc57c6a4fc5 Mon Sep 17 00:00:00 2001 From: benesjan Date: Mon, 26 Feb 2024 18:59:29 +0000 Subject: [PATCH] documenting INITIALIZATION_SLOT_SEPARATOR --- .../noir-protocol-circuits/src/crates/types/src/constants.nr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/constants.nr index 480b0f825e7..ee8ddb87f39 100644 --- a/noir-projects/noir-protocol-circuits/src/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/constants.nr @@ -97,6 +97,10 @@ global FUNCTION_SELECTOR_NUM_BYTES: Field = 4; global NUM_FIELDS_PER_SHA256: Field = 2; global ARGS_HASH_CHUNK_LENGTH: u32 = 32; global ARGS_HASH_CHUNK_COUNT: u32 = 32; +// The following is used in immutable state variables to compute an initialization slot whose value is used to +// determine whether a given variable has been initialized (by asserting that the value in the slot is 0). +// The initialization slot is computed by adding the constant bellow to the variable's storage slot. This constant has +// to be large enough so that it's ensured that it doesn't collide with storage slots of other variables. global INITIALIZATION_SLOT_SEPARATOR: Field = 1000; // CONTRACT CLASS CONSTANTS