diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_alu_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_alu_trace.cpp index 7da44d916bd..ed35f3f0720 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_alu_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_alu_trace.cpp @@ -47,11 +47,11 @@ std::vector AvmMiniAluTraceBuilder::final */ FF AvmMiniAluTraceBuilder::add(FF const& a, FF const& b, AvmMemoryTag in_tag, uint32_t const clk) { - FF c{}; + FF c = 0; bool carry = false; - uint8_t alu_u8_r0{}; - uint8_t alu_u8_r1{}; - std::array alu_u16_reg{}; + uint8_t alu_u8_r0 = 0; + uint8_t alu_u8_r1 = 0; + std::array alu_u16_reg; uint128_t a_u128{ a }; uint128_t b_u128{ b }; @@ -136,11 +136,11 @@ FF AvmMiniAluTraceBuilder::add(FF const& a, FF const& b, AvmMemoryTag in_tag, ui */ FF AvmMiniAluTraceBuilder::sub(FF const& a, FF const& b, AvmMemoryTag in_tag, uint32_t const clk) { - FF c{}; + FF c = 0; bool carry = false; - uint8_t alu_u8_r0{}; - uint8_t alu_u8_r1{}; - std::array alu_u16_reg{}; + uint8_t alu_u8_r0 = 0; + uint8_t alu_u8_r1 = 0; + std::array alu_u16_reg; uint128_t a_u128{ a }; uint128_t b_u128{ b }; uint128_t c_u128 = a_u128 - b_u128; @@ -220,12 +220,12 @@ FF AvmMiniAluTraceBuilder::sub(FF const& a, FF const& b, AvmMemoryTag in_tag, ui */ FF AvmMiniAluTraceBuilder::mul(FF const& a, FF const& b, AvmMemoryTag in_tag, uint32_t const clk) { - FF c{}; + FF c = 0; bool carry = false; - uint8_t alu_u8_r0{}; - uint8_t alu_u8_r1{}; + uint8_t alu_u8_r0 = 0; + uint8_t alu_u8_r1 = 0; - std::array alu_u16_reg{}; + std::array alu_u16_reg; uint128_t a_u128{ a }; uint128_t b_u128{ b }; @@ -258,8 +258,8 @@ FF AvmMiniAluTraceBuilder::mul(FF const& a, FF const& b, AvmMemoryTag in_tag, ui uint128_t c_u128 = a_u128 * b_u128; // Decompose a_u128 and b_u128 over 8 16-bit registers. - std::array alu_u16_reg_a{}; - std::array alu_u16_reg_b{}; + std::array alu_u16_reg_a; + std::array alu_u16_reg_b; uint128_t a_trunc_128 = a_u128; uint128_t b_trunc_128 = b_u128; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_deserialization.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_deserialization.cpp index a2ab8a882bd..dace5225ecf 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_deserialization.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_deserialization.cpp @@ -110,7 +110,6 @@ std::vector Deserialization::parse(std::vector const& byte inst_format = { OperandType::TAG, OperandType::UINT128, OperandType::UINT32 }; break; default: // This branch is guarded above. - inst_format = {}; std::cerr << "This code branch must have been guarded by the tag validation. \n"; assert(false); } @@ -140,28 +139,28 @@ std::vector Deserialization::parse(std::vector const& byte operands.emplace_back(bytecode.at(pos)); break; case OperandType::UINT16: { - uint16_t operand_u16{}; + uint16_t operand_u16 = 0; uint8_t const* pos_ptr = &bytecode.at(pos); serialize::read(pos_ptr, operand_u16); operands.emplace_back(operand_u16); break; } case OperandType::UINT32: { - uint32_t operand_u32{}; + uint32_t operand_u32 = 0; uint8_t const* pos_ptr = &bytecode.at(pos); serialize::read(pos_ptr, operand_u32); operands.emplace_back(operand_u32); break; } case OperandType::UINT64: { - uint64_t operand_u64{}; + uint64_t operand_u64 = 0; uint8_t const* pos_ptr = &bytecode.at(pos); serialize::read(pos_ptr, operand_u64); operands.emplace_back(operand_u64); break; } case OperandType::UINT128: { - uint128_t operand_u128{}; + uint128_t operand_u128 = 0; uint8_t const* pos_ptr = &bytecode.at(pos); serialize::read(pos_ptr, operand_u128); operands.emplace_back(operand_u128); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp index 79f0fc0d443..0aae8948100 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp @@ -47,7 +47,7 @@ HonkProof Execution::run_and_prove(std::vector const& bytecode, std::ve */ std::vector Execution::gen_trace(std::vector const& instructions, std::vector const& calldata) { - AvmMiniTraceBuilder trace_builder{}; + AvmMiniTraceBuilder trace_builder; // Copied version of pc maintained in trace builder. The value of pc is evolving based // on opcode logic and therefore is not maintained here. However, the next opcode in the execution @@ -104,8 +104,8 @@ std::vector Execution::gen_trace(std::vector const& instructio break; // Machine State - Memory case OpCode::SET: { - uint32_t dst_offset{}; - uint128_t val{}; + uint32_t dst_offset = 0; + uint128_t val = 0; AvmMemoryTag in_tag = std::get(inst.operands.at(0)); dst_offset = std::get(inst.operands.at(2)); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_trace.cpp index 88aac4a09e6..85f9906533f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_trace.cpp @@ -377,7 +377,7 @@ std::vector AvmMiniTraceBuilder::return_op(uint32_t ret_offset, uint32_t ret { if (ret_size == 0) { halt(); - return std::vector{}; + return {}; } // We parallelize loading memory operations in chunk of 3, i.e., 1 per intermediate register. @@ -604,7 +604,7 @@ std::vector AvmMiniTraceBuilder::finalize() // Fill the rest with zeros. size_t zero_rows_num = AVM_TRACE_SIZE - main_trace_size - 1; while (zero_rows_num-- > 0) { - main_trace.push_back(Row{}); + main_trace.push_back({}); } main_trace.at(main_trace_size - 1).avmMini_last = FF(1); diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp index e02cddcb81e..89cc0b78e58 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp @@ -84,9 +84,9 @@ TEST_F(AvmMiniExecutionTests, basicAddReturn) EXPECT_EQ(std::get(operands.at(0)), 0); EXPECT_EQ(std::get(operands.at(1)), 0); - auto trace = Execution::gen_trace(instructions, std::vector{}); + auto trace = Execution::gen_trace(instructions); - gen_proof_and_validate(bytecode, std::move(trace), std::vector{}); + gen_proof_and_validate(bytecode, std::move(trace), {}); } // Positive test for SET and SUB opcodes @@ -148,7 +148,7 @@ TEST_F(AvmMiniExecutionTests, setAndSubOpcodes) auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.avmMini_sel_op_sub == 1; }); EXPECT_EQ(row->avmMini_ic, 10000); // 47123 - 37123 = 10000 - gen_proof_and_validate(bytecode, std::move(trace), std::vector{}); + gen_proof_and_validate(bytecode, std::move(trace), {}); } // Positive test for multiple MUL opcodes @@ -227,7 +227,7 @@ TEST_F(AvmMiniExecutionTests, powerWithMulOpcodes) trace.begin(), trace.end(), [](Row r) { return r.avmMini_sel_op_mul == 1 && r.avmMini_pc == 13; }); EXPECT_EQ(row->avmMini_ic, 244140625); // 5^12 = 244140625 - gen_proof_and_validate(bytecode, std::move(trace), std::vector{}); + gen_proof_and_validate(bytecode, std::move(trace), {}); } // Positive test about a single internal_call and internal_return @@ -290,7 +290,7 @@ TEST_F(AvmMiniExecutionTests, simpleInternalCall) auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.avmMini_sel_op_add == 1; }); EXPECT_EQ(row->avmMini_ic, 345567789); - gen_proof_and_validate(bytecode, std::move(trace), std::vector{}); + gen_proof_and_validate(bytecode, std::move(trace), {}); } // Positive test with some nested internall calls @@ -370,7 +370,7 @@ TEST_F(AvmMiniExecutionTests, nestedInternalCalls) EXPECT_EQ(row->avmMini_ic, 187); EXPECT_EQ(row->avmMini_pc, 4); - gen_proof_and_validate(bytecode, std::move(trace), std::vector{}); + gen_proof_and_validate(bytecode, std::move(trace), {}); } // Positive test with JUMP and CALLDATACOPY