You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: fix counter tutorial ownership semantics and add TXE tests
The counter tutorial framed the example as "your own private counter,"
but `increment(owner: AztecAddress)` let any caller mutate any owner's
counter. Drop the `owner` parameter and read `self.msg_sender()` so the
caller can only increment the counter mapped to their own address.
Also add a sibling `counter_contract_test` package (mirroring
`logging_example_test`) with TXE tests covering `initialize` and
`increment`. This catches regressions in the example contract via
`aztec test` when wired up.
The `increment` function works similarly to the `initialize` function. It logs a debug message, then adds 1 to the owner's counter and delivers the note onchain.
121
+
The `increment` function uses `self.msg_sender()` so each caller can only increment the counter mapped to their own address. It logs a debug message, then adds 1 to that counter and delivers the note onchain.
0 commit comments