Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix negative tests in AVM circuit for context input lookups #7261

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions barretenberg/cpp/src/barretenberg/vm/tests/avm_kernel.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace tests_avm {
using namespace bb;
using namespace bb::avm_trace;

auto const BAD_LOOKUP = "LOOKUP_INTO_KERNEL";

class AvmKernelTests : public ::testing::Test {
protected:
// TODO(640): The Standard Honk on Grumpkin test suite fails unless the SRS is initialised for every test.
Expand Down Expand Up @@ -614,6 +616,8 @@ void negative_test_incorrect_ia_kernel_lookup(OpcodesFunc apply_opcodes,
auto& ta = trace.at(1);

ta.main_ia = incorrect_ia;
// memory trace should only have one row for these tests as well, so first row has looked-up val
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough we are not supposed to modify unit tests every day and so this is fine for this use case.

ta.mem_val = incorrect_ia;

check_trace(/*indirect*/ false, trace);

Expand Down Expand Up @@ -643,7 +647,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaSender)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaAddress)
Expand All @@ -669,7 +673,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaAddress)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaStorageAddress)
Expand All @@ -695,7 +699,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaStorageAddress)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaFunctionSelector)
Expand All @@ -721,7 +725,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaFunctionSelector)
/*w_in_tag=*/AvmMemoryTag::U32);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaDaGas)
Expand All @@ -747,7 +751,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaDaGas)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIal2Gas)
Expand All @@ -773,7 +777,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIal2Gas)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaTransactionFee)
Expand All @@ -799,7 +803,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaTransactionFee)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaChainId)
Expand All @@ -825,7 +829,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaChainId)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaVersion)
Expand All @@ -851,7 +855,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaVersion)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaBlockNumber)
Expand All @@ -877,7 +881,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaBlockNumber)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaTimestamp)
Expand All @@ -903,7 +907,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaTimestamp)
/*w_in_tag=*/AvmMemoryTag::U64);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

TEST_F(AvmKernelNegativeTests, incorrectIaCoinbase)
Expand All @@ -929,7 +933,7 @@ TEST_F(AvmKernelNegativeTests, incorrectIaCoinbase)
/*w_in_tag=*/AvmMemoryTag::FF);
};

negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, "PERM_MAIN_MEM_A");
negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP);
}

// KERNEL OUTPUTS
Expand Down
Loading