Skip to content

Commit 8e9f594

Browse files
authored
chore: restore method syntax on get_storage_slot calls (#12532)
Addresses a question brought up by @ludamad in slack
1 parent a38f353 commit 8e9f594

File tree

1 file changed

+8
-14
lines changed
  • noir-projects/noir-contracts/contracts/test_contract/src

1 file changed

+8
-14
lines changed

noir-projects/noir-contracts/contracts/test_contract/src/main.nr

+8-14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub contract Test {
4848
note_interface::NoteType,
4949
retrieved_note::RetrievedNote,
5050
},
51+
state_vars::storage::Storage as _,
5152
test::mocks::mock_struct::MockStruct,
5253
};
5354
use dep::token_portal_content_hash_lib::{
@@ -139,8 +140,7 @@ pub contract Test {
139140
storage_slot: Field,
140141
) {
141142
assert(
142-
storage_slot
143-
!= aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant),
143+
storage_slot != storage.example_constant.get_storage_slot(),
144144
"this storage slot is reserved for example_constant",
145145
);
146146

@@ -156,8 +156,7 @@ pub contract Test {
156156
#[private]
157157
fn call_get_notes(storage_slot: Field, active_or_nullified: bool) -> Field {
158158
assert(
159-
storage_slot
160-
!= aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant),
159+
storage_slot != storage.example_constant.get_storage_slot(),
161160
"this storage slot is reserved for example_constant",
162161
);
163162

@@ -177,8 +176,7 @@ pub contract Test {
177176
#[private]
178177
fn call_get_notes_many(storage_slot: Field, active_or_nullified: bool) -> [Field; 2] {
179178
assert(
180-
storage_slot
181-
!= aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant),
179+
storage_slot != storage.example_constant.get_storage_slot(),
182180
"this storage slot is reserved for example_constant",
183181
);
184182

@@ -195,8 +193,7 @@ pub contract Test {
195193

196194
unconstrained fn call_view_notes(storage_slot: Field, active_or_nullified: bool) -> pub Field {
197195
assert(
198-
storage_slot
199-
!= aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant),
196+
storage_slot != storage.example_constant.get_storage_slot(),
200197
"this storage slot is reserved for example_constant",
201198
);
202199

@@ -215,8 +212,7 @@ pub contract Test {
215212
active_or_nullified: bool,
216213
) -> pub [Field; 2] {
217214
assert(
218-
storage_slot
219-
!= aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant),
215+
storage_slot != storage.example_constant.get_storage_slot(),
220216
"this storage slot is reserved for example_constant",
221217
);
222218

@@ -233,8 +229,7 @@ pub contract Test {
233229
#[private]
234230
fn call_destroy_note(storage_slot: Field) {
235231
assert(
236-
storage_slot
237-
!= aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant),
232+
storage_slot != storage.example_constant.get_storage_slot(),
238233
"this storage slot is reserved for example_constant",
239234
);
240235

@@ -376,8 +371,7 @@ pub contract Test {
376371

377372
#[private]
378373
fn emit_encrypted_logs_nested(value: Field, owner: AztecAddress, sender: AztecAddress) {
379-
let mut storage_slot =
380-
aztec::state_vars::storage::Storage::get_storage_slot(storage.example_constant) + 1;
374+
let mut storage_slot = storage.example_constant.get_storage_slot() + 1;
381375
Test::at(context.this_address()).call_create_note(value, owner, sender, storage_slot).call(
382376
&mut context,
383377
);

0 commit comments

Comments
 (0)