Skip to content

chore: decouple perm arg boundary from shiftability assumptions#22396

Merged
iakovenkos merged 5 commits intomerge-train/barretenbergfrom
si/enforce-relation-boundaries
Apr 8, 2026
Merged

chore: decouple perm arg boundary from shiftability assumptions#22396
iakovenkos merged 5 commits intomerge-train/barretenbergfrom
si/enforce-relation-boundaries

Conversation

@iakovenkos
Copy link
Copy Markdown
Contributor

brittle.

@iakovenkos iakovenkos self-assigned this Apr 8, 2026
@iakovenkos iakovenkos requested a review from notnotraju April 8, 2026 10:04
@iakovenkos iakovenkos added the ci-full Run all master checks. label Apr 8, 2026
EXPECT_FALSE(tampered_permutation_relation_failures.empty());
}

/**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once we start masking at the top, I guess we can update this test to include ZK flavor? (I.e., where lagrange_first would be the row at index 4, a.k.a. the 5th row.)

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.

can do it now as well, since I need to update sol anyway

EXPECT_FALSE(tampered_failures.empty());
// Sub-relation 2 (lagrange_first * z_perm = 0) should fail at the lagrange_first row
ASSERT_TRUE(tampered_failures.contains(2)) << "Expected sub-relation 2 (z_perm init) to fail";
ASSERT_EQ(tampered_failures.at(2), first_row) << "Expected failure at lagrange_first row";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good!

EXPECT_FALSE(failures.empty()) << "Set relation should fail after z_perm init corruption";
EXPECT_TRUE(failures.contains(ECCVMSetRelationImpl<FF>::Z_PERM_INIT))
<< "Sub-relation Z_PERM_INIT should catch the corruption";
EXPECT_EQ(failures.at(ECCVMSetRelationImpl<FF>::Z_PERM_INIT), first_row)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

great!

using InitView = typename InitAccumulator::View;
const auto& lagrange_first_init = InitView(in.lagrange_first);
const auto& z_perm_init = InitView(in.z_perm);
std::get<Z_PERM_INIT>(accumulator) += lagrange_first_init * z_perm_init * scaling_factor;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm so happy the subrelations are named rather than numbered :-)

@notnotraju notnotraju self-requested a review April 8, 2026 11:49
Copy link
Copy Markdown
Contributor

@notnotraju notnotraju left a comment

Choose a reason for hiding this comment

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

Looks good, thank you for realizing that we need to do this in prep for masking at the top!

auto& z_perm = prover_instance->polynomials.z_perm;
auto& z_perm_shift = prover_instance->polynomials.z_perm_shift;
ASSERT_TRUE(z_perm.is_shiftable());
size_t structural_first_row = z_perm.start_index() - 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we could also have a static constexpr flavor variable called structural_first_row, just to further pin it? To me, it seems nice to be so explicit, but I'm not sure.

…rlap in optimized verifier

The removal of BATCH_SCALAR_0 shifted the batch scalar region 0x40 too low,
causing BATCH_SCALAR_1/2 to collide with POWERS_OF_EVALUATION_CHALLENGE_13/14.
This corrupted fold_pos_evaluations which dereferences those power entries after
batch scalars have been written.
@iakovenkos iakovenkos merged commit a6c119f into merge-train/barretenberg Apr 8, 2026
12 checks passed
@iakovenkos iakovenkos deleted the si/enforce-relation-boundaries branch April 8, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants