Skip to content

Commit

Permalink
8903: remove discrepancies between simulator and circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Oct 3, 2024
1 parent e1b87c0 commit 32cfa24
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ inline void read(uint8_t const*& it, ExternalCallHint& hint)
using serialize::read;
read(it, hint.success);
read(it, hint.return_data);
read(it, hint.l2_gas_used);
read(it, hint.da_gas_used);
read(it, hint.l2_gas_used);
read(it, hint.end_side_effect_counter);
}

Expand Down
6 changes: 3 additions & 3 deletions barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ void AvmTraceBuilder::op_sload(uint8_t indirect, uint32_t slot_offset, uint32_t
write_dst = AddressWithMode{ AddressingMode::DIRECT, write_a.direct_address + 1 };
}
// FIXME: Since we changed the PC, we need to reset it
op_jump(old_pc + 1);
op_jump(old_pc + 1, true); // TODO(8945)
}

void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t size, uint32_t slot_offset)
Expand Down Expand Up @@ -2413,7 +2413,7 @@ void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t
read_src = AddressWithMode{ AddressingMode::DIRECT, read_a.direct_address + 1 };
}
// FIXME: Since we changed the PC, we need to reset it
op_jump(old_pc + 1);
op_jump(old_pc + 1, true); // TODO(8945)
}

void AvmTraceBuilder::op_note_hash_exists(uint8_t indirect,
Expand Down Expand Up @@ -2737,7 +2737,7 @@ void AvmTraceBuilder::constrain_external_call(OpCode opcode,
// Write the return data to memory
write_slice_to_memory(resolved_ret_offset, AvmMemoryTag::FF, hint.return_data);
// Write the success flag to memory
write_slice_to_memory(resolved_success_offset, AvmMemoryTag::U1, std::vector<FF>{ hint.success });
write_slice_to_memory(resolved_success_offset, AvmMemoryTag::U8, std::vector<FF>{ hint.success });
external_call_counter++;

// Adjust the side_effect_counter to the value at the end of the external call but not static call.
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
#define AVM_DELEGATECALL_BASE_L2_GAS 2445
#define AVM_RETURN_BASE_L2_GAS 28
#define AVM_REVERT_BASE_L2_GAS 28
#define AVM_DEBUGLOG_BASE_L2_GAS 10
#define AVM_DEBUGLOG_BASE_L2_GAS 12
#define AVM_KECCAK_BASE_L2_GAS 3000
#define AVM_POSEIDON2_BASE_L2_GAS 78
#define AVM_SHA256_BASE_L2_GAS 2610
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ global AVM_STATICCALL_BASE_L2_GAS: u32 = 45 + (2 * L2_GAS_PER_NULLIFIER_READ_REQ
global AVM_DELEGATECALL_BASE_L2_GAS: u32 = 45 + (2 * L2_GAS_PER_NULLIFIER_READ_REQUEST);
global AVM_RETURN_BASE_L2_GAS: u32 = 28;
global AVM_REVERT_BASE_L2_GAS: u32 = 28;
global AVM_DEBUGLOG_BASE_L2_GAS: u32 = 10;
global AVM_DEBUGLOG_BASE_L2_GAS: u32 = 12; // Must be equal to AVM_JUMP_BASE_L2_GAS as long as circuit implements debugLog as a jump
global AVM_KECCAK_BASE_L2_GAS: u32 = 3000;
global AVM_POSEIDON2_BASE_L2_GAS: u32 = 78;
global AVM_SHA256_BASE_L2_GAS: u32 = 2610;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export const AVM_STATICCALL_BASE_L2_GAS = 2445;
export const AVM_DELEGATECALL_BASE_L2_GAS = 2445;
export const AVM_RETURN_BASE_L2_GAS = 28;
export const AVM_REVERT_BASE_L2_GAS = 28;
export const AVM_DEBUGLOG_BASE_L2_GAS = 10;
export const AVM_DEBUGLOG_BASE_L2_GAS = 12;
export const AVM_KECCAK_BASE_L2_GAS = 3000;
export const AVM_POSEIDON2_BASE_L2_GAS = 78;
export const AVM_SHA256_BASE_L2_GAS = 2610;
Expand Down

0 comments on commit 32cfa24

Please sign in to comment.