diff --git a/docs/docs/dev_docs/contracts/events.md b/docs/docs/dev_docs/contracts/events.md index cf2bb11282e3..3c2f080d8153 100644 --- a/docs/docs/dev_docs/contracts/events.md +++ b/docs/docs/dev_docs/contracts/events.md @@ -36,9 +36,33 @@ await aztecRpc.registerRecipient(completeAddress); +At this point we only allow emitting note spending info through encrypted events. +In the future we will allow emitting arbitrary information. +(If you currently emit arbitrary information, AztecRPC server will fail to process it and it will not be queryable.) + + + ### Unencrypted Events +Unencrypted events are events which can be read by anyone. +They can be emitted by both public and private functions. +It's important for a developer to consider whether it's acceptable for the unencrypted event to be emitted from private functions as it might pose a significant privacy leak. + +Once emitted, unencrypted events are stored in AztecNode and can be queried by anyone: + + + +```bash +aztec-cli get-logs --from 5 --limit 1 +``` + + + + +#include_code logs /yarn-project/end-to-end/src/e2e_public_token_contract.test.ts typescript + + + -### Constraining events ### Costs Explain L1 cost to emit an event. diff --git a/docs/docs/dev_docs/getting_started/cli.md b/docs/docs/dev_docs/getting_started/cli.md index b7244e958c6c..6272d5f94632 100644 --- a/docs/docs/dev_docs/getting_started/cli.md +++ b/docs/docs/dev_docs/getting_started/cli.md @@ -222,7 +222,7 @@ View result: [ Finally, we can use the CLI's `get-logs` command to retrieve unencrypted logs emitted by the contract: ``` -% aztec-cli get-logs 5 1 +% aztec-cli get-logs --from 5 --limit 1 Logs found: Coins transferred diff --git a/yarn-project/end-to-end/src/e2e_public_token_contract.test.ts b/yarn-project/end-to-end/src/e2e_public_token_contract.test.ts index 6a1e3b796581..a0f77428092e 100644 --- a/yarn-project/end-to-end/src/e2e_public_token_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_public_token_contract.test.ts @@ -27,8 +27,12 @@ describe('e2e_public_token_contract', () => { }; const expectLogsFromLastBlockToBe = async (logMessages: string[]) => { + // docs:start:logs + const l2BlockNum = await aztecRpcServer.getBlockNumber(); const unencryptedLogs = await aztecRpcServer.getUnencryptedLogs(l2BlockNum, 1); + + // docs:end:logs const unrolledLogs = L2BlockL2Logs.unrollLogs(unencryptedLogs); const asciiLogs = unrolledLogs.map(log => log.toString('ascii'));