Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::avm2::simulation::RetrievedBytecodesTreeCheck Class Reference

#include <retrieved_bytecodes_tree_check.hpp>

Inheritance diagram for bb::avm2::simulation::RetrievedBytecodesTreeCheck:
bb::avm2::simulation::RetrievedBytecodesTreeCheckInterface bb::avm2::simulation::RetrievedBytecodesInterface

Public Member Functions

 RetrievedBytecodesTreeCheck (IndexedTreeCheckInterface &indexed_tree_check, RetrievedBytecodesTree initial_state)
 
bool contains (const FF &class_id) override
 Checks whether a contract class ID exists in the retrieved bytecodes tree.
 
void insert (const FF &class_id) override
 Inserts a contract class ID into the retrieved bytecodes tree.
 
AppendOnlyTreeSnapshot get_snapshot () const override
 Returns the current tree snapshot.
 
uint32_t size () const override
 Returns the number of retrieved bytecode class IDs in the tree.
 
- Public Member Functions inherited from bb::avm2::simulation::RetrievedBytecodesInterface
virtual ~RetrievedBytecodesInterface ()=default
 

Private Attributes

IndexedTreeCheckInterfaceindexed_tree_check
 
RetrievedBytecodesTree tree
 

Detailed Description

Definition at line 13 of file retrieved_bytecodes_tree_check.hpp.

Constructor & Destructor Documentation

◆ RetrievedBytecodesTreeCheck()

bb::avm2::simulation::RetrievedBytecodesTreeCheck::RetrievedBytecodesTreeCheck ( IndexedTreeCheckInterface indexed_tree_check,
RetrievedBytecodesTree  initial_state 
)
inline

Definition at line 15 of file retrieved_bytecodes_tree_check.hpp.

Member Function Documentation

◆ contains()

bool bb::avm2::simulation::RetrievedBytecodesTreeCheck::contains ( const FF class_id)
overridevirtual

Checks whether a contract class ID exists in the retrieved bytecodes tree.

Queries the internal tree for the low leaf, converts it to generic IndexedTreeLeafData, and delegates the membership/non-membership proof to the indexed tree check gadget.

Parameters
class_idThe contract class ID to look up.
Returns
True if the class ID exists in the tree, false otherwise.

Implements bb::avm2::simulation::RetrievedBytecodesInterface.

Definition at line 16 of file retrieved_bytecodes_tree_check.cpp.

◆ get_snapshot()

AppendOnlyTreeSnapshot bb::avm2::simulation::RetrievedBytecodesTreeCheck::get_snapshot ( ) const
overridevirtual

Returns the current tree snapshot.

Returns
The current tree snapshot.

Implements bb::avm2::simulation::RetrievedBytecodesTreeCheckInterface.

Definition at line 79 of file retrieved_bytecodes_tree_check.cpp.

◆ insert()

void bb::avm2::simulation::RetrievedBytecodesTreeCheck::insert ( const FF class_id)
overridevirtual

Inserts a contract class ID into the retrieved bytecodes tree.

Performs the insertion on the in memory tree, then delegates the constrained write (or duplicate detection) to the indexed tree check gadget. No siloing is applied.

Parameters
class_idThe contract class ID to insert.
Exceptions
std::runtime_errorIf the indexed tree check write returns a snapshot that does not match the internal tree.

Implements bb::avm2::simulation::RetrievedBytecodesInterface.

Definition at line 46 of file retrieved_bytecodes_tree_check.cpp.

◆ size()

uint32_t bb::avm2::simulation::RetrievedBytecodesTreeCheck::size ( ) const
overridevirtual

Returns the number of retrieved bytecode class IDs in the tree.

Returns
The number of class IDs, excluding the prefill leaf at index 0.
Note
Subtracts 1 to account for the prefill leaf at index 0.

Implements bb::avm2::simulation::RetrievedBytecodesInterface.

Definition at line 89 of file retrieved_bytecodes_tree_check.cpp.

Member Data Documentation

◆ indexed_tree_check

IndexedTreeCheckInterface& bb::avm2::simulation::RetrievedBytecodesTreeCheck::indexed_tree_check
private

Definition at line 29 of file retrieved_bytecodes_tree_check.hpp.

◆ tree

RetrievedBytecodesTree bb::avm2::simulation::RetrievedBytecodesTreeCheck::tree
private

Definition at line 31 of file retrieved_bytecodes_tree_check.hpp.


The documentation for this class was generated from the following files: