-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: storing
&mut context
in state vars (#1926)
Fixes #1805
- Loading branch information
Showing
44 changed files
with
789 additions
and
540 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 13 additions & 3 deletions
16
yarn-project/noir-contracts/src/contracts/child_contract/src/storage.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
use dep::aztec::context::{PrivateContext, PublicContext}; | ||
use dep::aztec::state_vars::public_state::PublicState; | ||
use dep::aztec::types::type_serialisation::field_serialisation::FieldSerialisationMethods; | ||
use dep::aztec::types::type_serialisation::field_serialisation::FIELD_SERIALISED_LEN; | ||
use dep::std::option::Option; | ||
|
||
struct Storage { | ||
current_value: PublicState<Field, FIELD_SERIALISED_LEN>, | ||
} | ||
|
||
impl Storage { | ||
fn init() -> Self { | ||
fn init( | ||
private_context: Option<&mut PrivateContext>, | ||
public_context: Option<&mut PublicContext>, | ||
) -> Self { | ||
Storage { | ||
current_value: PublicState::new(1, FieldSerialisationMethods), | ||
current_value: PublicState::new( | ||
private_context, | ||
public_context, | ||
1, | ||
FieldSerialisationMethods, | ||
), | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.