Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
returndata_size.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
4#include <cstdint>
5
12
13namespace bb::avm2::constraining {
14namespace {
15
16using tracegen::TestTraceContainer;
18using C = Column;
20
21TEST(ReturndataSizeConstrainingTest, SimpleTest)
22{
23 TestTraceContainer trace({
24 { { C::execution_sel, 1 },
25 { C::execution_sel_execute_returndata_size, 1 },
26 { C::execution_register_0_, /*rd_size=*/10 },
27 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U32) },
28 { C::execution_last_child_returndata_size, 10 } },
29 });
31}
32
33TEST(ReturndataSizeConstrainingTest, NegativeInvalidMemTag)
34{
35 TestTraceContainer trace({
36 { { C::execution_sel, 1 },
37 { C::execution_sel_execute_returndata_size, 1 },
38 { C::execution_register_0_, 12345 },
39 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U64) },
40 { C::execution_last_child_returndata_size, 12345 } },
41 });
43 "RETURNDATA_SIZE_U32_TAG");
44}
45
46TEST(ReturndataSizeConstrainingTest, NegativeInvalidLastChildSuccess)
47{
48 TestTraceContainer trace({
49 { { C::execution_sel, 1 },
50 { C::execution_sel_execute_returndata_size, 1 },
51 { C::execution_register_0_, /*rd_size=*/12345 },
52 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U32) },
53 { C::execution_last_child_returndata_size, 10 } },
54 });
56 "RETURNDATA_SIZE_WRITE_REG");
57}
58
59} // namespace
60} // namespace bb::avm2::constraining
static constexpr size_t SR_RETURNDATA_SIZE_WRITE_REG
static constexpr size_t SR_RETURNDATA_SIZE_U32_TAG
TestTraceContainer trace
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessage)
Definition macros.hpp:7
TEST(TxExecutionConstrainingTest, WriteTreeValue)
Definition tx.test.cpp:508
NiceMock< MockExecution > execution