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 915b441db51..abaf0dc72ba 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 7280b26b246..1f51638cc85 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 04fd8f3708a..6965f7411da 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 900255b5625..db90126f6bf 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 4c898437611..5127c290f41 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 c87506dad3c..e5039acd2d6 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 } }