From 1888c56e83e945acdee9c57cc5ee808a5d02cac7 Mon Sep 17 00:00:00 2001 From: benesjan Date: Wed, 30 Aug 2023 13:12:07 +0000 Subject: [PATCH] WIP --- .../noir-libs/easy-private-state/src/easy_private_state.nr | 1 + .../noir-libs/noir-aztec/src/state_vars/immutable_singleton.nr | 1 + yarn-project/noir-libs/noir-aztec/src/state_vars/map.nr | 1 + yarn-project/noir-libs/noir-aztec/src/state_vars/public_state.nr | 1 + yarn-project/noir-libs/noir-aztec/src/state_vars/set.nr | 1 + yarn-project/noir-libs/noir-aztec/src/state_vars/singleton.nr | 1 + 6 files changed, 6 insertions(+) diff --git a/yarn-project/noir-libs/easy-private-state/src/easy_private_state.nr b/yarn-project/noir-libs/easy-private-state/src/easy_private_state.nr index 915b441db519..abaf0dc72bab 100644 --- a/yarn-project/noir-libs/easy-private-state/src/easy_private_state.nr +++ b/yarn-project/noir-libs/easy-private-state/src/easy_private_state.nr @@ -23,6 +23,7 @@ struct EasyPrivateUint { impl EasyPrivateUint { fn new(storage_slot: Field) -> Self { + assert(storage_slot != 0); // Storage slot 0 not allowed. Storage slots must start from 1. let set = Set { storage_slot, note_interface: ValueNoteMethods, diff --git a/yarn-project/noir-libs/noir-aztec/src/state_vars/immutable_singleton.nr b/yarn-project/noir-libs/noir-aztec/src/state_vars/immutable_singleton.nr index 7280b26b2460..1f51638cc856 100644 --- a/yarn-project/noir-libs/noir-aztec/src/state_vars/immutable_singleton.nr +++ b/yarn-project/noir-libs/noir-aztec/src/state_vars/immutable_singleton.nr @@ -19,6 +19,7 @@ struct ImmutableSingleton { impl ImmutableSingleton { fn new(storage_slot: Field, note_interface: NoteInterface) -> Self { + assert(storage_slot != 0); // Storage slot 0 not allowed. Storage slots must start from 1. ImmutableSingleton { storage_slot, note_interface } } diff --git a/yarn-project/noir-libs/noir-aztec/src/state_vars/map.nr b/yarn-project/noir-libs/noir-aztec/src/state_vars/map.nr index 04fd8f3708a4..6965f7411da6 100644 --- a/yarn-project/noir-libs/noir-aztec/src/state_vars/map.nr +++ b/yarn-project/noir-libs/noir-aztec/src/state_vars/map.nr @@ -5,6 +5,7 @@ struct Map { impl Map { fn new(storage_slot: Field, state_var_constructor: fn (Field) -> V) -> Map { + assert(storage_slot != 0); // Storage slot 0 not allowed. Storage slots must start from 1. Map { storage_slot, state_var_constructor } } diff --git a/yarn-project/noir-libs/noir-aztec/src/state_vars/public_state.nr b/yarn-project/noir-libs/noir-aztec/src/state_vars/public_state.nr index 900255b56257..db90126f6bf9 100644 --- a/yarn-project/noir-libs/noir-aztec/src/state_vars/public_state.nr +++ b/yarn-project/noir-libs/noir-aztec/src/state_vars/public_state.nr @@ -9,6 +9,7 @@ struct PublicState { impl PublicState { fn new(storage_slot: Field, serialisation_methods: TypeSerialisationInterface) -> Self { + assert(storage_slot != 0); // Storage slot 0 not allowed. Storage slots must start from 1. PublicState { storage_slot, serialisation_methods } } diff --git a/yarn-project/noir-libs/noir-aztec/src/state_vars/set.nr b/yarn-project/noir-libs/noir-aztec/src/state_vars/set.nr index 4c898437611e..5127c290f41b 100644 --- a/yarn-project/noir-libs/noir-aztec/src/state_vars/set.nr +++ b/yarn-project/noir-libs/noir-aztec/src/state_vars/set.nr @@ -21,6 +21,7 @@ struct Set { impl Set { fn new(storage_slot: Field, note_interface: NoteInterface) -> Self { + assert(storage_slot != 0); // Storage slot 0 not allowed. Storage slots must start from 1. Set { storage_slot, note_interface } } diff --git a/yarn-project/noir-libs/noir-aztec/src/state_vars/singleton.nr b/yarn-project/noir-libs/noir-aztec/src/state_vars/singleton.nr index c87506dad3cc..e5039acd2d69 100644 --- a/yarn-project/noir-libs/noir-aztec/src/state_vars/singleton.nr +++ b/yarn-project/noir-libs/noir-aztec/src/state_vars/singleton.nr @@ -22,6 +22,7 @@ struct Singleton { impl Singleton { fn new(storage_slot: Field, note_interface: NoteInterface) -> Self { + assert(storage_slot != 0); // Storage slot 0 not allowed. Storage slots must start from 1. Singleton { storage_slot, note_interface } }