From 2a7494baec4396b9fa62f0a9c240b4b02f23fb1d Mon Sep 17 00:00:00 2001 From: Jean M <132435771+jeanmon@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:43:45 +0200 Subject: [PATCH] fix(avm): fixes AVM full tests and decrease timeout to 35 minutes (#7438) Fixes failure in: https://github.com/AztecProtocol/aztec-packages/actions/runs/9885438673 Timeout decrease for the AVM full tests action to 35 minutes. --- .github/workflows/vm_full_tests.yml | 4 ++-- .../barretenberg/vm/tests/avm_arithmetic.test.cpp | 6 +++--- .../barretenberg/vm/tests/avm_execution.test.cpp | 13 +++++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/vm_full_tests.yml b/.github/workflows/vm_full_tests.yml index e1e135b0201..601ed966b80 100644 --- a/.github/workflows/vm_full_tests.yml +++ b/.github/workflows/vm_full_tests.yml @@ -55,7 +55,7 @@ jobs: concurrency_key: avm-full-tests-x86 - name: "AVM Full Tests" working-directory: ./barretenberg/cpp/ - timeout-minutes: 70 + timeout-minutes: 35 run: | - sudo shutdown -P 70 # hack until core part of the scripts + sudo shutdown -P 35 # hack until core part of the scripts earthly-ci --no-output +vm-full-test --hardware_concurrency=64 # limit our parallelism to half our cores diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_arithmetic.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_arithmetic.test.cpp index 8418aa87ab4..96debab2682 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/avm_arithmetic.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_arithmetic.test.cpp @@ -412,7 +412,7 @@ TEST_F(AvmArithmeticTestsFF, subtraction) EXPECT_EQ(alu_row.alu_u8_r0, FF(0)); std::vector const returndata = { 8, 9, 17 }; - validate_trace(std::move(trace), public_inputs, calldata); + validate_trace(std::move(trace), public_inputs, calldata, returndata); } // Test on basic multiplication over finite field type. @@ -483,7 +483,7 @@ TEST_F(AvmArithmeticTestsFF, fDivision) EXPECT_EQ(row->main_sel_mem_op_c, FF(1)); EXPECT_EQ(row->main_rwc, FF(1)); - std::vector const returndata = { 15, 315, 0 }; + std::vector const returndata = { 15, 315, 21 }; validate_trace(std::move(trace), public_inputs, calldata, returndata); } @@ -619,7 +619,7 @@ TEST_F(AvmArithmeticTestsFF, nonEquality) gen_trace_builder(calldata); trace_builder.op_calldata_copy(0, 0, 2, 0); trace_builder.op_eq(0, 0, 1, 2, AvmMemoryTag::FF); // Memory Layout [q - 1, q, 0, 0..] - trace_builder.op_return(0, 0, 0); + trace_builder.op_return(0, 0, 3); auto trace = trace_builder.finalize(); auto alu_row_index = common_validate_eq(trace, elem, FF(0), FF(0), FF(0), FF(1), FF(2), AvmMemoryTag::FF); diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_execution.test.cpp index 98591c27945..be6f99c52f9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/avm_execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_execution.test.cpp @@ -1451,9 +1451,10 @@ TEST_F(AvmExecutionTests, kernelInputOpcodes) // The return data for this test should be a the opcodes in sequence, as the opcodes dst address lines up with // this array The returndata call above will then return this array - std::vector returndata = { sender, address, storage_address, function_selector, transaction_fee, - chainid, version, blocknumber, /*coinbase,*/ timestamp, feeperl2gas, - feeperdagas }; + std::vector const expected_returndata = { + address, storage_address, sender, function_selector, transaction_fee, chainid, version, + blocknumber, /*coinbase,*/ timestamp, feeperl2gas, feeperdagas, + }; // Set up public inputs to contain the above values // TODO: maybe have a javascript like object construction so that this is readable @@ -1476,8 +1477,12 @@ TEST_F(AvmExecutionTests, kernelInputOpcodes) public_inputs_vec[FEE_PER_DA_GAS_OFFSET] = feeperdagas; public_inputs_vec[FEE_PER_L2_GAS_OFFSET] = feeperl2gas; + std::vector returndata; auto trace = Execution::gen_trace(instructions, returndata, calldata, public_inputs_vec); + // Validate returndata + EXPECT_EQ(returndata, expected_returndata); + // Validate that the opcode read the correct value into ia // Check address auto address_row = @@ -1539,7 +1544,7 @@ TEST_F(AvmExecutionTests, kernelInputOpcodes) std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_fee_per_l2_gas == 1; }); EXPECT_EQ(feeperl2gas_row->main_ia, feeperl2gas); - validate_trace(std::move(trace), Execution::convert_public_inputs(public_inputs_vec)); + validate_trace(std::move(trace), Execution::convert_public_inputs(public_inputs_vec), calldata, returndata); } // Positive test for L2GASLEFT opcode