diff --git a/barretenberg/cpp/pil/vm2/context.pil b/barretenberg/cpp/pil/vm2/context.pil index b497cc66f0d1..8a4ad3725747 100644 --- a/barretenberg/cpp/pil/vm2/context.pil +++ b/barretenberg/cpp/pil/vm2/context.pil @@ -128,7 +128,7 @@ namespace execution; // The initial next_context_id = 2, in row = 1 #[INCR_NEXT_CONTEXT_ID] - NOT_LAST_EXEC * (next_context_id' - (next_context_id + sel_enter_call)) = 0; + NOT_LAST_EXEC * (next_context_id' - (next_context_id + sel_enter_call + enqueued_call_start')) = 0; // nested_exit_call = 1 ==> context_id' = parent_id // sel_enter_call = 1 ==> context_id' = next_context_id @@ -235,12 +235,12 @@ namespace execution; #[PROPAGATE_RD_SIZE] NOT_LAST_EXEC * DEFAULT_CTX_ROW * (last_child_returndata_size' - last_child_returndata_size) = 0; - // sel_exit_call = 1 ==> last_child_id' = context_id; <-- sel_exit_call includes error case + // nested_exit_call = 1 ==> last_child_id' = context_id; <-- sel_exit_call includes error case // sel_enter_call = 1 ==> last_child_id' = 0; // enqueued_call_start = 1 ==> last_child_id = 0; <-- Current row is 0 // otherwise = 0 ==> last_child_id' = last_child_id; #[EXIT_CALL_LAST_CHILD_ID] - NOT_LAST_EXEC * sel_exit_call * (last_child_id' - context_id) = 0; + NOT_LAST_EXEC * nested_exit_call * (last_child_id' - context_id) = 0; #[ENTER_CALL_LAST_CHILD_ID] NOT_LAST_EXEC * sel_enter_call * last_child_id' = 0; #[LAST_CHILD_ID_IS_ZERO] diff --git a/barretenberg/cpp/pil/vm2/opcodes/internal_call.pil b/barretenberg/cpp/pil/vm2/opcodes/internal_call.pil index d7c5c76f6bcd..a48cc5c15bdf 100644 --- a/barretenberg/cpp/pil/vm2/opcodes/internal_call.pil +++ b/barretenberg/cpp/pil/vm2/opcodes/internal_call.pil @@ -19,7 +19,9 @@ namespace execution; // When we encounter this case, the internal call information in the next row is constrained to change (incremented, unwound, etc) pol NEW_NEXT_CALL_ID = (sel_execute_internal_call + sel_execute_internal_return) * (1 - sel_error) + sel_exit_call; - pol PROPAGATE_CALL_ID = 1 - RESET_NEXT_CALL_ID - NEW_NEXT_CALL_ID; + // This is an XOR + pol RESET_OR_NEW_NEXT_CALL_ID = (RESET_NEXT_CALL_ID + NEW_NEXT_CALL_ID) - (RESET_NEXT_CALL_ID * NEW_NEXT_CALL_ID); + pol PROPAGATE_CALL_ID = 1 - RESET_OR_NEW_NEXT_CALL_ID; // ============================= // === Internal Call Pointer === @@ -57,9 +59,8 @@ namespace execution; #[NEXT_CALL_ID_STARTS_TWO] RESET_NEXT_CALL_ID * (next_internal_call_id' - 2) = 0; // If we encounter a sel_execute_internal_call, we increment the next next_internal_call_id, unless we are changing context - pol CONTEXT_CHANGE = (RESET_NEXT_CALL_ID + sel_exit_call) - (RESET_NEXT_CALL_ID * sel_exit_call) ; #[INCR_NEXT_INT_CALL_ID] - NOT_LAST_EXEC * (1 - CONTEXT_CHANGE) * (next_internal_call_id' - (next_internal_call_id + sel_execute_internal_call)) = 0; + NOT_LAST_EXEC * (1 - RESET_OR_NEW_NEXT_CALL_ID) * (next_internal_call_id' - (next_internal_call_id + sel_execute_internal_call)) = 0; // ============================= // === Error Handling ==== diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp index d0f90ecbc622..512139ed977b 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp @@ -91,7 +91,8 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; auto tmp = execution_NOT_LAST_EXEC * (in.get(C::execution_next_context_id_shift) - - (in.get(C::execution_next_context_id) + in.get(C::execution_sel_enter_call))); + (in.get(C::execution_next_context_id) + in.get(C::execution_sel_enter_call) + + in.get(C::execution_enqueued_call_start_shift))); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); } @@ -285,7 +286,7 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, } { // EXIT_CALL_LAST_CHILD_ID using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = execution_NOT_LAST_EXEC * in.get(C::execution_sel_exit_call) * + auto tmp = execution_NOT_LAST_EXEC * in.get(C::execution_nested_exit_call) * (in.get(C::execution_last_child_id_shift) - in.get(C::execution_context_id)); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call.hpp index 340666bcf6ba..fd2b91d2ef76 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call.hpp @@ -14,7 +14,7 @@ template class internal_callImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 6, 3, 3, 6, 3, 6, 5 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 7, 3, 3, 7, 3, 7, 5 }; template inline static bool skip(const AllEntities& in) { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call_impl.hpp index 5e8147504cb2..af33aec04989 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/internal_call_impl.hpp @@ -23,9 +23,9 @@ void internal_callImpl::accumulate(ContainerOverSubrelations& evals, (in.get(C::execution_sel_execute_internal_call) + in.get(C::execution_sel_execute_internal_return)) * (FF(1) - in.get(C::execution_sel_error)) + in.get(C::execution_sel_exit_call); - const auto execution_PROPAGATE_CALL_ID = ((FF(1) - execution_RESET_NEXT_CALL_ID) - execution_NEW_NEXT_CALL_ID); - const auto execution_CONTEXT_CHANGE = ((execution_RESET_NEXT_CALL_ID + in.get(C::execution_sel_exit_call)) - - execution_RESET_NEXT_CALL_ID * in.get(C::execution_sel_exit_call)); + const auto execution_RESET_OR_NEW_NEXT_CALL_ID = ((execution_RESET_NEXT_CALL_ID + execution_NEW_NEXT_CALL_ID) - + execution_RESET_NEXT_CALL_ID * execution_NEW_NEXT_CALL_ID); + const auto execution_PROPAGATE_CALL_ID = (FF(1) - execution_RESET_OR_NEW_NEXT_CALL_ID); { // CALL_ID_STARTS_ONE using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; @@ -82,7 +82,7 @@ void internal_callImpl::accumulate(ContainerOverSubrelations& evals, } { // INCR_NEXT_INT_CALL_ID using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = execution_NOT_LAST_EXEC * (FF(1) - execution_CONTEXT_CHANGE) * + auto tmp = execution_NOT_LAST_EXEC * (FF(1) - execution_RESET_OR_NEW_NEXT_CALL_ID) * (in.get(C::execution_next_internal_call_id_shift) - (in.get(C::execution_next_internal_call_id) + in.get(C::execution_sel_execute_internal_call))); tmp *= scaling_factor; diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit_amm.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit_amm.test.ts index bef9b2c8eee6..be297c83581f 100644 --- a/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit_amm.test.ts +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit_amm.test.ts @@ -10,8 +10,7 @@ import { AvmProvingTester } from './avm_proving_tester.js'; const TIMEOUT = 300_000; -// TODO: unskip when check-circuit works for AMM. Confirm that it is fast enough to run in CI. -describe.skip('AVM proven AMM', () => { +describe('AVM proven AMM', () => { const logger = createLogger('avm-proven-tests-amm'); const metrics = new TestExecutorMetrics(); let tester: AvmProvingTester;