14 .
operand(
static_cast<uint16_t
>(0))
50 .pointer_address =
address.pointer_address,
51 .base_offset =
address.base_offset,
61 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
83 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
103 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
112 .
operand(result.value().second)
123 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
132 .
operand(result.value().second)
143 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
152 .
operand(result.value().second)
164 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
173 .
operand(result.value().second)
184 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
193 .
operand(result.value().second)
204 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
214 .
operand(result.value().second)
225 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
235 .
operand(result.value().second)
246 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
256 .
operand(result.value().second)
268 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
278 .
operand(result.value().second)
290 if (!
a.has_value() || !
b.has_value() || !result.has_value()) {
300 .
operand(result.value().second)
309 if (!effective_address_operand.has_value()) {
314 .operand(effective_address_operand.value().second)
324 if (!effective_address_operand.has_value()) {
329 .operand(effective_address_operand.value().second)
339 if (!effective_address_operand.has_value()) {
344 .operand(effective_address_operand.value().second)
354 if (!effective_address_operand.has_value()) {
359 .operand(effective_address_operand.value().second)
369 if (!effective_address_operand.has_value()) {
376 .operand(effective_address_operand.value().second)
386 if (!effective_address_operand.has_value()) {
391 .operand(effective_address_operand.value().second)
402 if (!src_address_operand.has_value() || !result_address_operand.has_value()) {
408 .
operand(src_address_operand.value().second)
409 .
operand(result_address_operand.value().second)
419 if (!src_address_operand.has_value() || !result_address_operand.has_value()) {
426 .
operand(src_address_operand.value().second)
427 .
operand(result_address_operand.value().second)
438 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
446 .
operand(a_address_operand.value().second)
447 .
operand(b_address_operand.value().second)
448 .
operand(result_address_operand.value().second)
458 if (!a_address_operand.has_value() || !result_address_operand.has_value()) {
465 .
operand(a_address_operand.value().second)
466 .
operand(result_address_operand.value().second)
477 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
485 .
operand(a_address_operand.value().second)
486 .
operand(b_address_operand.value().second)
487 .
operand(result_address_operand.value().second)
498 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
506 .
operand(a_address_operand.value().second)
507 .
operand(b_address_operand.value().second)
508 .
operand(result_address_operand.value().second)
519 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
527 .
operand(a_address_operand.value().second)
528 .
operand(b_address_operand.value().second)
529 .
operand(result_address_operand.value().second)
540 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
548 .
operand(a_address_operand.value().second)
549 .
operand(b_address_operand.value().second)
550 .
operand(result_address_operand.value().second)
561 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
569 .
operand(a_address_operand.value().second)
570 .
operand(b_address_operand.value().second)
571 .
operand(result_address_operand.value().second)
582 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
590 .
operand(a_address_operand.value().second)
591 .
operand(b_address_operand.value().second)
592 .
operand(result_address_operand.value().second)
603 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
611 .
operand(a_address_operand.value().second)
612 .
operand(b_address_operand.value().second)
613 .
operand(result_address_operand.value().second)
624 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
632 .
operand(a_address_operand.value().second)
633 .
operand(b_address_operand.value().second)
634 .
operand(result_address_operand.value().second)
645 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
653 .
operand(a_address_operand.value().second)
654 .
operand(b_address_operand.value().second)
655 .
operand(result_address_operand.value().second)
666 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
674 .
operand(a_address_operand.value().second)
675 .
operand(b_address_operand.value().second)
676 .
operand(result_address_operand.value().second)
687 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
695 .
operand(a_address_operand.value().second)
696 .
operand(b_address_operand.value().second)
697 .
operand(result_address_operand.value().second)
707 if (!a_address_operand.has_value() || !result_address_operand.has_value()) {
714 .
operand(a_address_operand.value().second)
715 .
operand(result_address_operand.value().second)
726 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
734 .
operand(a_address_operand.value().second)
735 .
operand(b_address_operand.value().second)
736 .
operand(result_address_operand.value().second)
747 if (!a_address_operand.has_value() || !b_address_operand.has_value() || !result_address_operand.has_value()) {
755 .
operand(a_address_operand.value().second)
756 .
operand(b_address_operand.value().second)
757 .
operand(result_address_operand.value().second)
767 if (!src_address_operand.has_value() || !result_address_operand.has_value()) {
774 .
operand(src_address_operand.value().second)
775 .
operand(result_address_operand.value().second)
786 if (!src_address_operand.has_value() || !result_address_operand.has_value()) {
793 .
operand(src_address_operand.value().second)
794 .
operand(result_address_operand.value().second)
805 if (!src_address_operand.has_value() || !result_address_operand.has_value()) {
815 .
operand(src_address_operand.value().second)
816 .
operand(result_address_operand.value().second)
825 if (!slot_addr.has_value()) {
831 .value = *slot_addr };
835 if (!slot_address_operand.has_value() || !result_address_operand.has_value()) {
842 .
operand(slot_address_operand.value().second)
843 .
operand(result_address_operand.value().second)
851 auto instruction_type =
static_cast<uint8_t
>(
instruction.type % 12);
853 if (!result_address_operand.has_value()) {
858 .
operand(result_address_operand.value().second)
863 if (instruction_type == 6) {
873 if (!nullifier_address_operand.has_value()) {
878 .
operand(nullifier_address_operand.value().second)
886 auto contract_address_operand =
889 if (!nullifier_address_operand.has_value() || !contract_address_operand.has_value() ||
890 !result_address_operand.has_value()) {
897 auto get_contract_address_instruction =
902 .
operand(nullifier_address_operand.value().second)
903 .
operand(contract_address_operand.value().second)
904 .
operand(result_address_operand.value().second)
919 if (!note_hash_address_operand.has_value()) {
925 .
operand(note_hash_address_operand.value().second)
938 if (!leaf_index.has_value()) {
942 auto note_hash_counter =
static_cast<uint64_t
>(*leaf_index);
949 .value = unique_note_computed_hash };
953 .value = *leaf_index };
959 if (!notehash_address_operand.has_value() || !leaf_index_address_operand.has_value() ||
960 !result_address_operand.has_value()) {
968 .
operand(notehash_address_operand.value().second)
969 .
operand(leaf_index_address_operand.value().second)
970 .
operand(result_address_operand.value().second)
990 if (!copy_size_address_operand.has_value() || !cd_start_address_operand.has_value() ||
991 !dst_address_operand.has_value()) {
999 .
operand(copy_size_address_operand.value().second)
1000 .
operand(cd_start_address_operand.value().second)
1001 .
operand(dst_address_operand.value().second)
1006 auto loop_upper_bound =
1008 for (uint32_t calldata_addr =
instruction.dst_address.address; calldata_addr < loop_upper_bound; calldata_addr++) {
1020 auto internalreturn_instruction =
1027 if (!return_addr.has_value()) {
1033 uint16_t return_size_offset = 5U;
1043 .
operand(
static_cast<uint16_t
>(return_size_offset))
1044 .
operand(
static_cast<uint16_t
>(return_addr.value()))
1055 if (copy_memory_manager) {
1063 bool copy_memory_manager)
1073 if (copy_memory_manager) {
1081 auto internalcall_instruction =
1093 auto internalcall_instruction =
instructions.at(instruction_index);
1094 if (target_block->offset == -1) {
1095 throw std::runtime_error(
"Target block offset is not set, should not happen");
1097 auto internalcall_instruction_builder =
1099 .
operand(
static_cast<uint32_t
>(target_block->offset));
1108 if (!condition_addr.has_value()) {
1111 return condition_addr;
1179 [](
auto) {
throw std::runtime_error(
"Unknown instruction"); },
::FuzzInstruction FuzzInstruction
const FF CONTRACT_ADDRESS
std::optional< bb::avm2::FF > get_emitted_note_hash(uint16_t note_hash_index)
std::optional< std::pair< uint32_t, bb::avm2::testing::OperandBuilder > > get_memory_address_and_operand_8(AddressRef address)
std::optional< bb::avm2::FF > get_slot(uint16_t slot_offset_index)
bool is_memory_address_set(uint16_t address)
std::optional< uint16_t > get_leaf_index(uint16_t note_hash_index)
void set_memory_address(bb::avm2::MemoryTag tag, uint32_t address)
std::optional< std::pair< uint32_t, bb::avm2::testing::OperandBuilder > > get_memory_address_and_operand_16(AddressRef address)
void append_slot(bb::avm2::FF slot)
std::optional< uint32_t > get_memory_offset(bb::avm2::MemoryTag tag, uint32_t address_index)
void append_emitted_note_hash(bb::avm2::FF note_hash)
void process_shr_16_instruction(SHR_16_Instruction instruction)
void process_set_8_instruction(SET_8_Instruction instruction)
std::vector< ProgramBlock * > predecessors
void process_sload_instruction(SLOAD_Instruction instruction)
void finalize_with_return(uint8_t return_size, MemoryTagWrapper return_value_tag, uint16_t return_value_offset_index)
finalize the program block with a return instruction Tries to find memory address with the given retu...
std::vector< bb::avm2::simulation::Instruction > get_instructions()
void insert_internal_call(ProgramBlock *target_block)
insert INTERNALCALL instruction with 0 offset
bool is_memory_address_set(uint16_t address)
void process_emitnotehash_instruction(EMITNOTEHASH_Instruction instruction)
void process_xor_16_instruction(XOR_16_Instruction instruction)
ProgramBlock * caller
the block that called this block by INTERNALCALL This field is copied to predecessors on every CFG in...
void process_or_16_instruction(OR_16_Instruction instruction)
void patch_internal_calls()
in insert_internal_call we insert INTERNALCALL instruction with 0 offset, because we don't know the r...
void finalize_with_jump(ProgramBlock *target_block, bool copy_memory_manager=true)
finalize the block with a jump Sets the terminator type to JUMP, adds the target block to the success...
uint16_t condition_offset_index
the offset index of the condition variable (for JUMP_IF)
void process_lte_16_instruction(LTE_16_Instruction instruction)
void process_eq_8_instruction(EQ_8_Instruction instruction)
void process_fdiv_8_instruction(FDIV_8_Instruction instruction)
void process_nullifierexists_instruction(NULLIFIEREXISTS_Instruction instruction)
void process_not_8_instruction(NOT_8_Instruction instruction)
void process_add_8_instruction(ADD_8_Instruction instruction)
void process_and_16_instruction(AND_16_Instruction instruction)
MemoryManager memory_manager
void process_sub_8_instruction(SUB_8_Instruction instruction)
void process_shl_8_instruction(SHL_8_Instruction instruction)
void process_notehashexists_instruction(NOTEHASHEXISTS_Instruction instruction)
void process_div_16_instruction(DIV_16_Instruction instruction)
void process_instruction(FuzzInstruction instruction)
process the instruction
void process_emitnulifier_instruction(EMITNULLIFIER_Instruction instruction)
void process_fdiv_16_instruction(FDIV_16_Instruction instruction)
void process_shl_16_instruction(SHL_16_Instruction instruction)
void process_mul_16_instruction(MUL_16_Instruction instruction)
void process_set_ff_instruction(SET_FF_Instruction instruction)
void process_sstore_instruction(SSTORE_Instruction instruction)
std::map< size_t, ProgramBlock * > internal_call_instruction_indicies_to_patch
void process_div_8_instruction(DIV_8_Instruction instruction)
void process_and_8_instruction(AND_8_Instruction instruction)
void process_lt_16_instruction(LT_16_Instruction instruction)
std::vector< ProgramBlock * > successors
void process_sub_16_instruction(SUB_16_Instruction instruction)
void process_or_8_instruction(OR_8_Instruction instruction)
void process_cast_8_instruction(CAST_8_Instruction instruction)
void process_cast_16_instruction(CAST_16_Instruction instruction)
void process_not_16_instruction(NOT_16_Instruction instruction)
void process_set_64_instruction(SET_64_Instruction instruction)
void process_calldatacopy_instruction(CALLDATACOPY_Instruction instruction)
void process_mov_8_instruction(MOV_8_Instruction instruction)
std::optional< uint16_t > get_terminating_condition_value()
void process_mul_8_instruction(MUL_8_Instruction instruction)
void process_set_16_instruction(SET_16_Instruction instruction)
void process_add_16_instruction(ADD_16_Instruction instruction)
void process_xor_8_instruction(XOR_8_Instruction instruction)
void process_eq_16_instruction(EQ_16_Instruction instruction)
void preprocess_memory_addresses(AddressRef address, uint32_t actual_address)
preprocess the memory addresses Sets M[0] = base_offset for Relative/IndirectRelative modes Sets M[po...
void process_lte_8_instruction(LTE_8_Instruction instruction)
void finalize_with_jump_if(ProgramBlock *target_then_block, ProgramBlock *target_else_block, uint16_t condition_offset, bool copy_memory_manager=true)
finalize the block with a jump if Sets the terminator type to JUMP_IF, adds the target blocks to the ...
void process_set_32_instruction(SET_32_Instruction instruction)
void process_getenvvar_instruction(GETENVVAR_Instruction instruction)
TerminatorType terminator_type
void process_lt_8_instruction(LT_8_Instruction instruction)
std::vector< bb::avm2::simulation::Instruction > instructions
void process_shr_8_instruction(SHR_8_Instruction instruction)
void process_mov_16_instruction(MOV_16_Instruction instruction)
void process_set_128_instruction(SET_128_Instruction instruction)
simulation::Instruction build() const
InstructionBuilder & operand(OperandBuilder operand)
@ return_value_offset_index
AztecAddress contract_address
FF unconstrained_make_unique_note_hash(const FF &siloed_note_hash, const FF &first_nullifier, uint64_t note_hash_counter)
FF unconstrained_silo_note_hash(const AztecAddress &contract_address, const FF ¬e_hash)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
unsigned __int128 uint128_t
mem[result_offset] = mem[a_address] + mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] + mem[b_address]
mem[result_offset] = mem[a_address] & mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] & mem[b_address]
CALLDATACOPY: M[dstOffset:dstOffset+M[copySizeOffset]] = calldata[M[cdStartOffset]:M[cdStartOffset]+M...
CAST_16: cast mem[src_offset_index] to target_tag and store at dst_offset.
CAST_8: cast mem[src_offset_index] to target_tag and store at dst_offset.
mem[result_offset] = mem[a_address] / mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] / mem[b_address]
EMITNOTEHASH: M[note_hash_offset] = note_hash; emit note hash to the note hash tree.
EMITNULIFIER: inserts new nullifier to the nullifier tree.
mem[result_offset] = mem[a_address] == mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] == mem[b_address]
GETENVVAR: M[result_offset] = getenvvar(type)
ResultAddressRef result_address
mem[result_offset] = mem[a_address] < mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] < mem[b_address]
mem[result_offset] = mem[a_address] <= mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] <= mem[b_address]
MOV_16 instruction: mem[dst_offset] = mem[src_offset].
MOV_8 instruction: mem[dst_offset] = mem[src_offset].
mem[result_offset] = mem[a_address] * mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] * mem[b_address]
Wrapper for MemoryTag to allow for msgpack packing and unpacking.
NOTEHASHEXISTS: M[result_offset] = NOTEHASHEXISTS(M[notehash_offset], M[leaf_index_offset]) len = len...
NULLIFIEREXISTS: checks if nullifier exists in the nullifier tree Gets contract's address by GETENVVA...
mem[result_offset] = mem[a_address] | mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] | mem[b_address]
MemoryTagWrapper value_tag
MemoryTagWrapper value_tag
mem[result_offset] = mem[a_address] << mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] << mem[b_address]
mem[result_offset] = mem[a_address] >> mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] >> mem[b_address]
SLOAD: M[slot_offset] = slot; M[result_offset] = S[M[slotOffset]].
SSTORE: M[slot_offset_index] = slot; S[M[slotOffset]] = M[srcOffset].
mem[result_offset] = mem[a_address] - mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] - mem[b_address]
mem[result_offset] = mem[a_address] ^ mem[b_address] (16-bit)
mem[result_offset] = mem[a_address] ^ mem[b_address]