Skip to main content

PrivateContext

When finished, one can call .finish() to convert back to the abi

Fields

FieldType
inputsPrivateContextInputs
side_effect_counteru32
min_revertible_side_effect_counteru32
is_fee_payerbool
args_hashField
return_hashField
max_block_numberMaxBlockNumber
note_hash_read_requestsBoundedVec<ReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>
nullifier_read_requestsBoundedVec<ReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL>
key_validation_requests_and_generatorsBoundedVec<KeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL>
new_note_hashesBoundedVec<NoteHash, MAX_NEW_NOTE_HASHES_PER_CALL>
new_nullifiersBoundedVec<Nullifier, MAX_NEW_NULLIFIERS_PER_CALL>
private_call_requestsBoundedVec<PrivateCallRequest, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>
public_call_stack_hashesBoundedVec<Field, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL>
public_teardown_function_hashField
new_l2_to_l1_msgsBoundedVec<L2ToL1Message, MAX_NEW_L2_TO_L1_MSGS_PER_CALL>
historical_headerHeader
note_encrypted_logs_hashesBoundedVec<NoteLogHash, MAX_NOTE_ENCRYPTED_LOGS_PER_CALL>
encrypted_logs_hashesBoundedVec<EncryptedLogHash, MAX_ENCRYPTED_LOGS_PER_CALL>
unencrypted_logs_hashesBoundedVec<LogHash, MAX_UNENCRYPTED_LOGS_PER_CALL>
last_key_validation_requestsOption<KeyValidationRequest>; NUM_KEY_TYPES]

Methods

new

PrivateContext::new(inputs, args_hash);

Parameters

NameType
inputsPrivateContextInputs
args_hashField

msg_sender

PrivateContext::msg_sender(self);

Parameters

NameType
self

this_address

PrivateContext::this_address(self);

Parameters

NameType
self

chain_id

PrivateContext::chain_id(self);

Parameters

NameType
self

version

PrivateContext::version(self);

Parameters

NameType
self

selector

PrivateContext::selector(self);

Parameters

NameType
self

get_args_hash

PrivateContext::get_args_hash(self);

Parameters

NameType
self

push_new_note_hash

PrivateContext::push_new_note_hash(&mut self, note_hash);

Parameters

NameType
&mut self
note_hashField

push_new_nullifier

TODO(#7112): This function is called with non-zero note hash only in 1 of 25 cases in aztec-packages repo - consider creating a separate function with 1 arg for the zero note hash case.

PrivateContext::push_new_nullifier(&mut self, nullifier, nullified_note_hash);

Parameters

NameType
&mut self
nullifierField
nullified_note_hashField

get_header

Returns the header of a block whose state is used during private execution (not the block the transaction is included in).

PrivateContext::get_header(self);

Parameters

NameType
self

get_header_at

Returns the header of an arbitrary block whose block number is less than or equal to the block number of historical header.

PrivateContext::get_header_at(self, block_number);

Parameters

NameType
self
block_numberu32

set_return_hash

PrivateContext::set_return_hash(&mut self, returns_hasher);

Parameters

NameType
&mut self
returns_hasherArgsHasher

finish

PrivateContext::finish(self);

Parameters

NameType
self

set_as_fee_payer

PrivateContext::set_as_fee_payer(&mut self);

Parameters

NameType
&mut self

end_setup

PrivateContext::end_setup(&mut self);

Parameters

NameType
&mut self

set_tx_max_block_number

PrivateContext::set_tx_max_block_number(&mut self, max_block_number);

Parameters

NameType
&mut self
max_block_numberu32

push_note_hash_read_request

PrivateContext::push_note_hash_read_request(&mut self, note_hash);

Parameters

NameType
&mut self
note_hashField

push_nullifier_read_request

PrivateContext::push_nullifier_read_request(&mut self, nullifier);

Parameters

NameType
&mut self
nullifierField

request_nsk_app

PrivateContext::request_nsk_app(&mut self, npk_m_hash);

Parameters

NameType
&mut self
npk_m_hashField

request_ovsk_app

PrivateContext::request_ovsk_app(&mut self, ovpk_m_hash);

Parameters

NameType
&mut self
ovpk_m_hashField

request_sk_app

PrivateContext::request_sk_app(&mut self, pk_m_hash, key_index);

Parameters

NameType
&mut self
pk_m_hashField
key_indexField

message_portal

PrivateContext::message_portal(&mut self, recipient, content);

Parameters

NameType
&mut self
recipientEthAddress
contentField

consume_l1_to_l2_message

PrivateContext::consume_l1_to_l2_message(&mut self, content, secret, sender);

Parameters

NameType
&mut self
contentField
secretField
senderEthAddress

emit_unencrypted_log

TODO: We might want to remove this since emitting unencrypted logs from private functions is violating privacy. --> might be a better approach to force devs to make a public function call that emits the log if needed then it would be less easy to accidentally leak information. If we decide to keep this function around would make sense to wait for traits and then merge it with emit_unencrypted_log.

PrivateContext::emit_unencrypted_log(&mut self, log);

Parameters

NameType
&mut self
logT

emit_contract_class_unencrypted_log

This fn exists separately from emit_unencrypted_log because sha hashing the preimage is too large to compile (16,200 fields, 518,400 bytes) => the oracle hashes it It is ONLY used with contract_class_registerer_contract since we already assert correctness: - Contract class -> we will commit to the packed bytecode (currently a TODO) - Private function -> we provide a membership proof - Unconstrained function -> we provide a membership proof Ordinary logs are not protected by the above so this fn shouldn't be called by anything else

PrivateContext::emit_contract_class_unencrypted_log(&mut self, log);

Parameters

NameType
&mut self
log[Field; N]

emit_raw_event_log_with_masked_address

NB: A randomness value of 0 signals that the kernels should not mask the contract address used in siloing later on e.g. 'handshaking' contract w/ known address.

PrivateContext::emit_raw_event_log_with_masked_address(&mut self, randomness, encrypted_log);

Parameters

NameType
&mut self
randomnessField
encrypted_log[u8; M]

emit_raw_note_log

PrivateContext::emit_raw_note_log(&mut self, note_hash_counter, encrypted_log);

Parameters

NameType
&mut self
note_hash_counteru32
encrypted_log[u8; M]

call_private_function

PrivateContext::call_private_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

static_call_private_function

PrivateContext::static_call_private_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

delegate_call_private_function

PrivateContext::delegate_call_private_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

call_private_function_no_args

PrivateContext::call_private_function_no_args(&mut self, contract_address, function_selector);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector

static_call_private_function_no_args

PrivateContext::static_call_private_function_no_args(&mut self, contract_address, function_selector);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector

delegate_call_private_function_no_args

PrivateContext::delegate_call_private_function_no_args(&mut self, contract_address, function_selector);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector

call_private_function_with_packed_args

PrivateContext::call_private_function_with_packed_args(&mut self, contract_address, function_selector, args_hash, is_static_call, is_delegate_call);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args_hashField
is_static_callbool
is_delegate_callbool

call_public_function

PrivateContext::call_public_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

static_call_public_function

PrivateContext::static_call_public_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

delegate_call_public_function

PrivateContext::delegate_call_public_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

call_public_function_no_args

PrivateContext::call_public_function_no_args(&mut self, contract_address, function_selector);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector

static_call_public_function_no_args

PrivateContext::static_call_public_function_no_args(&mut self, contract_address, function_selector);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector

delegate_call_public_function_no_args

PrivateContext::delegate_call_public_function_no_args(&mut self, contract_address, function_selector);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector

call_public_function_with_packed_args

PrivateContext::call_public_function_with_packed_args(&mut self, contract_address, function_selector, args_hash, is_static_call, is_delegate_call);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args_hashField
is_static_callbool
is_delegate_callbool

set_public_teardown_function

PrivateContext::set_public_teardown_function(&mut self, contract_address, function_selector, args);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args[Field; ARGS_COUNT]

set_public_teardown_function_with_packed_args

PrivateContext::set_public_teardown_function_with_packed_args(&mut self, contract_address, function_selector, args_hash, is_static_call, is_delegate_call);

Parameters

NameType
&mut self
contract_addressAztecAddress
function_selectorFunctionSelector
args_hashField
is_static_callbool
is_delegate_callbool

validate_call_stack_item_from_oracle

PrivateContext::validate_call_stack_item_from_oracle(self, item, contract_address, function_selector, args_hash, is_static_call, is_delegate_call);

Parameters

NameType
self
itemPublicCallStackItem
contract_addressAztecAddress
function_selectorFunctionSelector
args_hashField
is_static_callbool
is_delegate_callbool

next_counter

PrivateContext::next_counter(&mut self);

Parameters

NameType
&mut self

Standalone Functions

empty

empty();

Takes no parameters.