Skip to content

Commit

Permalink
docs(yellowpaper): logs (#4016)
Browse files Browse the repository at this point in the history
Update the logs section in yellow paper.
  • Loading branch information
LeilaWang authored Jan 16, 2024
1 parent 2787bae commit d734c79
Show file tree
Hide file tree
Showing 8 changed files with 605 additions and 220 deletions.
70 changes: 48 additions & 22 deletions yellow-paper/docs/circuits/private-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ The public inputs of a private function circuit will be incorporated into the pr

The following format defines the ABI that is used by the private kernel circuit when processing private function public inputs:

| Field | Type | Description |
| ---------------------------------- | ------------------------------------ | ---------------------------------------------------------------------- |
| _call_context_ | _[CallContext](#callcontext)_ | Context of the call corresponding to this function execution. |
| _args_hash_ | _field_ | Hash of the function arguments. |
| _return_values_ | [_field_; _C_] | Return values of this function call. |
| _read_requests_ | [_[ReadRequest](#readrequest)_; _C_] | Requests to read notes in the note hash tree. |
| _note_hashes_ | [_[NoteHash](#notehash)_; _C_] | New note hashes created in this function call. |
| _nullifiers_ | [_[Nullifier](#nullifier)_; _C_] | New nullifiers created in this function call. |
| _l2_to_l1_messages_ | [_field_; _C_] | New L2 to L1 messages created in this function call. |
| _encrypted_logs_hash_ | _field_ | Hash of the encrypted logs emitted in this function call. |
| _unencrypted_logs_hash_ | _field_ | Hash of the unencrypted logs emitted in this function call. |
| _encrypted_log_preimages_length_ | _field_ | Length of the encrypted log preimages emitted in this function call. |
| _unencrypted_log_preimages_length_ | _field_ | Length of the unencrypted log preimages emitted in this function call. |
| _private_call_stack_item_hashes_ | [_field_; _C_] | Hashes of the private function calls initiated by this function. |
| _public_call_stack_item_hashes_ | [_field_; _C_] | Hashes of the public function calls initiated by this function. |
| _block_header_ | _[BlockHeader](#blockheader)_ | Information about the trees used for the transaction. |
| _chain_id_ | _field_ | Chain ID of the transaction. |
| _version_ | _field_ | Version of the transaction. |
| Field | Type | Description |
| -------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------- |
| _call_context_ | _[CallContext](#callcontext)_ | Context of the call corresponding to this function execution. |
| _args_hash_ | _field_ | Hash of the function arguments. |
| _return_values_ | [_field_; _C_] | Return values of this function call. |
| _read_requests_ | [_[ReadRequest](#readrequest)_; _C_] | Requests to read notes in the note hash tree. |
| _note_hashes_ | [_[NoteHash](#notehash)_; _C_] | New note hashes created in this function call. |
| _nullifiers_ | [_[Nullifier](#nullifier)_; _C_] | New nullifiers created in this function call. |
| _l2_to_l1_messages_ | [_field_; _C_] | New L2 to L1 messages created in this function call. |
| _unencrypted_log_hashes_ | [_[UnencryptedLogHash](#unencryptedloghash)_; _C_] | Hashes of the unencrypted logs emitted in this function call. |
| _encrypted_log_hashes_ | [_[EncryptedLogHash](#encryptedloghash)_; _C_] | Hashes of the encrypted logs emitted in this function call. |
| _encrypted_note_preimage_hashes_ | [_[EncryptedNotePreimageHash](#encryptednotepreimagehash)_; _C_] | Hashes of the encrypted note preimages emitted in this function call. |
| _private_call_stack_item_hashes_ | [_field_; _C_] | Hashes of the private function calls initiated by this function. |
| _public_call_stack_item_hashes_ | [_field_; _C_] | Hashes of the public function calls initiated by this function. |
| _block_header_ | _[BlockHeader](#blockheader)_ | Information about the trees used for the transaction. |
| _chain_id_ | _field_ | Chain ID of the transaction. |
| _version_ | _field_ | Version of the transaction. |

> The above **C**s represent constants defined by the protocol. Each **C** might have a different value from the others.
Expand Down Expand Up @@ -65,10 +64,37 @@ The following format defines the ABI that is used by the private kernel circuit

#### _Nullifier_

| Field | Type | Description |
| --------- | ------- | ------------------------------------------- |
| _value_ | _field_ | Value of the nullifier. |
| _counter_ | _field_ | Counter at which the nullifier was created. |
| Field | Type | Description |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
| _value_ | _field_ | Value of the nullifier. |
| _counter_ | _field_ | Counter at which the nullifier was created. |
| _note_hash_counter_ | _field_ | Counter of the transient note the nullifier is created for. 0 if the nullifier does not associate with a transient note. |

#### _UnencryptedLogHash_

| Field | Type | Description |
| --------- | ------- | -------------------------------------- |
| _hash_ | _field_ | Hash of the unencrypted log. |
| _length_ | _field_ | Number of fields of the log preimage. |
| _counter_ | _field_ | Counter at which the hash was emitted. |

#### _EncryptedLogHash_

| Field | Type | Description |
| ------------ | ------- | -------------------------------------------- |
| _hash_ | _field_ | Hash of the encrypted log. |
| _length_ | _field_ | Number of fields of the log preimage. |
| _randomness_ | _field_ | A random value to hide the contract address. |
| _counter_ | _field_ | Counter at which the hash was emitted. |

#### _EncryptedNotePreimageHash_

| Field | Type | Description |
| ------------------- | ------- | --------------------------------------- |
| _hash_ | _field_ | Hash of the encrypted note preimage. |
| _length_ | _field_ | Number of fields of the note preimage. |
| _counter_ | _field_ | Counter at which the hash was emitted. |
| _note_hash_counter_ | _field_ | Counter of the corresponding note hash. |

#### _BlockHeader_

Expand Down
Loading

0 comments on commit d734c79

Please sign in to comment.