Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions barretenberg/cpp/pil/vm2/keccak_memory.pil
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ sel * (1 - last) * (ctr' - ctr - 1) = 0;
pol commit rw; // @boolean (constrained by memory.pil)

pol commit single_tag_error; // @boolean
#[SINGLE_TAG_ERROR_BOOLEAN]
single_tag_error * (1 - single_tag_error) = 0;

#[NO_TAG_ERROR_ON_WRITE]
Expand Down Expand Up @@ -177,9 +178,6 @@ pol TAG_MIN_U64 = tag - constants.MEM_TAG_U64;
#[SINGLE_TAG_ERROR]
sel * (TAG_MIN_U64 * ((1 - single_tag_error) * (1 - tag_min_u64_inv) + tag_min_u64_inv) - single_tag_error) = 0;

#[SINGLE_TAG_ERROR_BOOLEAN]
single_tag_error * (1 - single_tag_error) = 0;

#[VAL01]
Comment on lines 180 to 181

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Duplicate constraint

val[1] = (1 - last) * val[0]';
#[VAL02]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ include "../constants_gen.pil";
* };
**/
namespace l1_to_l2_message_tree_check;
pol commit sel;
pol commit sel; // @boolean
sel * (1 - sel) = 0;

#[skippable_if]
sel = 0;

// Inputs to the gadget
pol commit exists;
pol commit exists; // @boolean
exists * (1 - exists) = 0;

pol commit msg_hash;
pol commit leaf_index;
Expand Down
11 changes: 6 additions & 5 deletions barretenberg/cpp/pil/vm2/trees/note_hash_tree_check.pil
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,30 @@ include "../public_inputs.pil";
* As write variant usage, we can omit the address column whenever we pass should_silo == 0.
**/
namespace note_hash_tree_check;
pol commit sel;
pol commit sel; // @boolean
sel * (1 - sel) = 0;

#[skippable_if]
sel = 0;

// Inputs to the gadget
pol commit write;
pol commit write; // @boolean
write * (1 - write) = 0;
pol READ = 1 - write;
pol commit exists;
pol commit exists; // @boolean
exists * (1 - exists) = 0;

pol commit note_hash;
pol commit leaf_index;
pol commit prev_root;

// Write specific inputs
pol commit should_silo;
pol commit should_silo; // @boolean
should_silo * (1 - should_silo) = 0;

pol commit address;

pol commit should_unique;
pol commit should_unique; // @boolean
should_unique * (1 - should_unique) = 0;

pol commit note_hash_index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ template <typename FF_> class keccak_memoryImpl {
public:
using FF = FF_;

static constexpr std::array<size_t, 46> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 4, 3, 5, 3, 4, 3,
3, 3, 3, 4, 3, 3, 3, 5, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
static constexpr std::array<size_t, 45> SUBRELATION_PARTIAL_LENGTHS = {
3, 3, 3, 3, 3, 3, 4, 3, 5, 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 5, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
};

template <typename AllEntities> inline static bool skip(const AllEntities& in)
{
Expand Down Expand Up @@ -45,6 +45,7 @@ template <typename FF> class keccak_memory : public Relation<keccak_memoryImpl<F
static constexpr size_t SR_CTR_END = 8;
static constexpr size_t SR_LAST = 9;
static constexpr size_t SR_CTR_INCREMENT = 10;
static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN = 11;
static constexpr size_t SR_NO_TAG_ERROR_ON_WRITE = 12;
static constexpr size_t SR_TAG_ERROR_INIT = 13;
static constexpr size_t SR_TAG_ERROR_PROPAGATION = 14;
Expand All @@ -53,31 +54,30 @@ template <typename FF> class keccak_memory : public Relation<keccak_memoryImpl<F
static constexpr size_t SR_CLK_PROPAGATION = 17;
static constexpr size_t SR_RW_PROPAGATION = 18;
static constexpr size_t SR_SINGLE_TAG_ERROR = 19;
static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN = 20;
static constexpr size_t SR_VAL01 = 21;
static constexpr size_t SR_VAL02 = 22;
static constexpr size_t SR_VAL03 = 23;
static constexpr size_t SR_VAL04 = 24;
static constexpr size_t SR_VAL05 = 25;
static constexpr size_t SR_VAL06 = 26;
static constexpr size_t SR_VAL07 = 27;
static constexpr size_t SR_VAL8 = 28;
static constexpr size_t SR_VAL09 = 29;
static constexpr size_t SR_VAL10 = 30;
static constexpr size_t SR_VAL11 = 31;
static constexpr size_t SR_VAL12 = 32;
static constexpr size_t SR_VAL13 = 33;
static constexpr size_t SR_VAL14 = 34;
static constexpr size_t SR_VAL15 = 35;
static constexpr size_t SR_VAL41 = 36;
static constexpr size_t SR_VAL17 = 37;
static constexpr size_t SR_VAL18 = 38;
static constexpr size_t SR_VAL19 = 39;
static constexpr size_t SR_VAL20 = 40;
static constexpr size_t SR_VAL21 = 41;
static constexpr size_t SR_VAL22 = 42;
static constexpr size_t SR_VAL23 = 43;
static constexpr size_t SR_VAL24 = 44;
static constexpr size_t SR_VAL01 = 20;
static constexpr size_t SR_VAL02 = 21;
static constexpr size_t SR_VAL03 = 22;
static constexpr size_t SR_VAL04 = 23;
static constexpr size_t SR_VAL05 = 24;
static constexpr size_t SR_VAL06 = 25;
static constexpr size_t SR_VAL07 = 26;
static constexpr size_t SR_VAL8 = 27;
static constexpr size_t SR_VAL09 = 28;
static constexpr size_t SR_VAL10 = 29;
static constexpr size_t SR_VAL11 = 30;
static constexpr size_t SR_VAL12 = 31;
static constexpr size_t SR_VAL13 = 32;
static constexpr size_t SR_VAL14 = 33;
static constexpr size_t SR_VAL15 = 34;
static constexpr size_t SR_VAL41 = 35;
static constexpr size_t SR_VAL17 = 36;
static constexpr size_t SR_VAL18 = 37;
static constexpr size_t SR_VAL19 = 38;
static constexpr size_t SR_VAL20 = 39;
static constexpr size_t SR_VAL21 = 40;
static constexpr size_t SR_VAL22 = 41;
static constexpr size_t SR_VAL23 = 42;
static constexpr size_t SR_VAL24 = 43;

static std::string get_subrelation_label(size_t index)
{
Expand All @@ -96,6 +96,8 @@ template <typename FF> class keccak_memory : public Relation<keccak_memoryImpl<F
return "LAST";
case SR_CTR_INCREMENT:
return "CTR_INCREMENT";
case SR_SINGLE_TAG_ERROR_BOOLEAN:
return "SINGLE_TAG_ERROR_BOOLEAN";
case SR_NO_TAG_ERROR_ON_WRITE:
return "NO_TAG_ERROR_ON_WRITE";
case SR_TAG_ERROR_INIT:
Expand All @@ -112,8 +114,6 @@ template <typename FF> class keccak_memory : public Relation<keccak_memoryImpl<F
return "RW_PROPAGATION";
case SR_SINGLE_TAG_ERROR:
return "SINGLE_TAG_ERROR";
case SR_SINGLE_TAG_ERROR_BOOLEAN:
return "SINGLE_TAG_ERROR_BOOLEAN";
case SR_VAL01:
return "VAL01";
case SR_VAL02:
Expand Down
Loading
Loading