From 024ff1f1ef591ba90deca8d106e1b8495b8888d2 Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 27 Feb 2024 08:40:54 +0000 Subject: [PATCH] improved docs --- .../contracts/references/storage/private_state.md | 4 ++-- .../contracts/references/storage/public_state.md | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/docs/developers/contracts/references/storage/private_state.md b/docs/docs/developers/contracts/references/storage/private_state.md index 736475a8c67..ce9770ee2af 100644 --- a/docs/docs/developers/contracts/references/storage/private_state.md +++ b/docs/docs/developers/contracts/references/storage/private_state.md @@ -68,7 +68,7 @@ Interestingly, if a developer requires a private state to be modifiable by users ## `PrivateMutable` -PrivateMutable is a private state variable that is unique in a way. When a PrivateMutable is initialized, a note is created to represent its value. And the way to update the value is to destroy the current note, and create a new one with the updated value. +PrivateMutable (formerly known as `Singleton`) is a private state variable that is unique in a way. When a PrivateMutable is initialized, a note is created to represent its value. And the way to update the value is to destroy the current note, and create a new one with the updated value. Like for public state, we define the struct to have context and a storage slot. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr). @@ -134,7 +134,7 @@ Functionally similar to [`get_note`](#get_note), but executed in unconstrained f ## `PrivateImmutable` -`PrivateImmutable` represents a unique private state variable that, as the name suggests, is immutable. Once initialized, its value cannot be altered. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr). +`PrivateImmutable` (formerly known as `ImmutableSingleton`) represents a unique private state variable that, as the name suggests, is immutable. Once initialized, its value cannot be altered. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr). ### `new` diff --git a/docs/docs/developers/contracts/references/storage/public_state.md b/docs/docs/developers/contracts/references/storage/public_state.md index 2fe6111d38e..4344c0b0d10 100644 --- a/docs/docs/developers/contracts/references/storage/public_state.md +++ b/docs/docs/developers/contracts/references/storage/public_state.md @@ -8,7 +8,7 @@ For a higher level overview of the state model in Aztec, see the [state model](. ## Overview -The `PublicMutable` struct is generic over the variable type `T`. The type _must_ implement Serialize and Deserialize traits, as specified here: +The `PublicMutable` (formerly known as `PublicState`) struct is generic over the variable type `T`. The type _must_ implement Serialize and Deserialize traits, as specified here: #include_code serialize /noir-projects/noir-protocol-circuits/src/crates/types/src/traits.nr rust #include_code deserialize /noir-projects/noir-protocol-circuits/src/crates/types/src/traits.nr rust @@ -91,7 +91,7 @@ We have a `write` method on the `PublicMutable` struct that takes the value to w ## Shared Immutable -`SharedImmutable` is a special type that can be read from both public and private! +`SharedImmutable` (formerly known as `StablePublicState`) is a special type that can be read from both public and private! Since private execution is based on historical data, the user can pick ANY of its prior values to read from. This is why it `MUST` not be updated after the contract is deployed. The variable should be initialized at the constructor and then never changed. @@ -101,6 +101,10 @@ Just like the `PublicMutable` it is generic over the variable type `T`. The type You can find the details of `SharedImmutable` in the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/shared_immutable.nr). +:::info +The word `Shared` in Aztec protocol means read/write from public, read only from private. +::: + ### `new` Is done exactly like the `PublicMutable` struct, but with the `SharedImmutable` struct.