Skip to content

Commit

Permalink
chore: add comment public_call_stack_item_compressed
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Jul 4, 2024
1 parent b790ce8 commit 02f62f0
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ use crate::constants::{GENERATOR_INDEX__CALL_STACK_ITEM, PUBLIC_CALL_STACK_ITEM_
use crate::traits::{Hash, Empty, Serialize, Deserialize};
use crate::utils::reader::Reader;

/**
* A compressed version of the PublicCallStackItem struct used to compute the "hash"
* of a PublicCallStackItem.
*
* Historically, we have been zeroing most values in the PublicCallStackItem struct
* to compute the hash involved when adding a PublicCallStackItem to the PublicCallStack.
*
* This struct is used to store the values that we did not zero out, and allow us to hash
* only these, thereby skipping a lot of computation and saving us a lot of constraints
*
* Essentially this struct exists such that we don't have a `hash` function in the
* PublicCallStackItem struct that practically throws away some values of the struct
* without clearly indicating that it does so.
*/
struct PublicCallStackItemCompressed {
contract_address: AztecAddress,
call_context: CallContext,
Expand Down

0 comments on commit 02f62f0

Please sign in to comment.