Skip to content

Commit

Permalink
fix(docs): use code snippet macros in bridge docs (#2205)
Browse files Browse the repository at this point in the history
fixes: AztecProtocol/aztec-packages#2193


Updates the bridge docs code such that it uses code snippets (which can
change) rather than having static code
  • Loading branch information
superstar0402 committed Sep 13, 2023
1 parent bd03bac commit d9a9157
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions yarn-project/noir-libs/aztec-noir/src/context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,25 @@ impl PrivateContext {
self.nullified_commitments.push(nullified_commitment);
}

fn message_portal(&mut self, content: Field) {
// docs:start:context_message_portal
fn message_portal(&mut self, content: Field)
// docs:end:context_message_portal
{
self.new_l2_to_l1_msgs.push(content);
}

// PrivateContextInputs must be temporarily passed in to prevent too many unknowns
// Note this returns self to get around an issue where mutable structs do not maintain mutations unless reassigned
fn consume_l1_to_l2_message(&mut self, inputs: abi::PrivateContextInputs, msg_key: Field, content: Field, secret: Field) {
// docs:start:context_consume_l1_to_l2_message
fn consume_l1_to_l2_message(
&mut self,
inputs: abi::PrivateContextInputs,
msg_key: Field,
content: Field,
secret: Field
)
// docs:end:context_consume_l1_to_l2_message
{
let nullifier = process_l1_to_l2_message(inputs.block_data.l1_to_l2_messages_tree_root, inputs.call_context.storage_contract_address, msg_key, content, secret);

// Push nullifier (and the "commitment" corresponding to this can be "empty")
Expand Down

0 comments on commit d9a9157

Please sign in to comment.