Skip to content

Commit 26cbe44

Browse files
committed
chore: update hpp
1 parent f5285d1 commit 26cbe44

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

barretenberg/cpp/src/barretenberg/dsl/acir_proofs/honk_optimized_contract.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static const char HONK_CONTRACT_OPT_SOURCE[] = R"(
397397
pragma solidity ^0.8.27;
398398
399399
interface IVerifier {
400-
function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external returns (bool);
400+
function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool);
401401
}
402402
403403
@@ -515,7 +515,7 @@ contract HonkVerifier is IVerifier {
515515
// TOOD: maybe verify vk points are on curve in constructor
516516
constructor() {}
517517
518-
function verify(bytes calldata, bytes32[] calldata) public override returns (bool) {
518+
function verify(bytes calldata, bytes32[] calldata) public override view returns (bool) {
519519
// Load the proof from calldata in one large chunk
520520
assembly {
521521
// Inline the verification key code here for the meantime
@@ -1151,7 +1151,7 @@ contract HonkVerifier is IVerifier {
11511151
mstore(0x20, 0x20)
11521152
mstore(0x40, 0x20)
11531153
mstore(0x60, accumulator)
1154-
mstore(0x80, sub(p, 2))
1154+
mstore(0x80, P_SUB_2)
11551155
mstore(0xa0, p)
11561156
if iszero(staticcall(gas(), 0x05, 0x00, 0xc0, 0x00, 0x20)) {
11571157
mstore(0x00, MODEXP_FAILED_SELECTOR)
@@ -1288,7 +1288,7 @@ contract HonkVerifier is IVerifier {
12881288
mulmod(
12891289
mulmod(
12901290
mulmod(mulmod(mload(W1_EVAL_LOC), mload(W2_EVAL_LOC), p), mload(QM_EVAL_LOC), p),
1291-
addmod(q_arith, sub(p, 3), p),
1291+
addmod(q_arith, P_SUB_3, p),
12921292
p
12931293
),
12941294
NEG_HALF_MODULO_P,
@@ -1309,7 +1309,7 @@ contract HonkVerifier is IVerifier {
13091309
// α * (q_arith - 2) * (w_1 + w_4 - w_1_omega + q_m)
13101310
let extra_small_addition_gate_identity :=
13111311
mulmod(
1312-
addmod(q_arith, sub(p, 2), p),
1312+
addmod(q_arith, P_SUB_2, p),
13131313
addmod(
13141314
mload(QM_EVAL_LOC),
13151315
addmod(
@@ -1322,11 +1322,11 @@ contract HonkVerifier is IVerifier {
13221322
13231323
// Split up the two relations
13241324
let contribution_0 :=
1325-
addmod(identity, mulmod(addmod(q_arith, sub(p, 1), p), mload(W4_SHIFT_EVAL_LOC), p), p)
1325+
addmod(identity, mulmod(addmod(q_arith, P_SUB_1, p), mload(W4_SHIFT_EVAL_LOC), p), p)
13261326
contribution_0 := mulmod(mulmod(contribution_0, q_arith, p), mload(POW_PARTIAL_EVALUATION_LOC), p)
13271327
mstore(SUBRELATION_EVAL_0_LOC, contribution_0)
13281328
1329-
let contribution_1 := mulmod(extra_small_addition_gate_identity, addmod(q_arith, sub(p, 1), p), p)
1329+
let contribution_1 := mulmod(extra_small_addition_gate_identity, addmod(q_arith, P_SUB_1, p), p)
13301330
contribution_1 := mulmod(contribution_1, q_arith, p)
13311331
contribution_1 := mulmod(contribution_1, mload(POW_PARTIAL_EVALUATION_LOC), p)
13321332
mstore(SUBRELATION_EVAL_1_LOC, contribution_1)
@@ -1461,7 +1461,7 @@ contract HonkVerifier is IVerifier {
14611461
addmod(accumulator_one, sub(p, mulmod(mload(LOOKUP_READ_COUNTS_EVAL_LOC), write_inverse, p)), p)
14621462
14631463
let read_tag := mload(LOOKUP_READ_TAGS_EVAL_LOC)
1464-
let read_tag_boolean_relation := mulmod(read_tag, addmod(read_tag, sub(p, 1), p), p)
1464+
let read_tag_boolean_relation := mulmod(read_tag, addmod(read_tag, P_SUB_1, p), p)
14651465
read_tag_boolean_relation := mulmod(read_tag_boolean_relation, mload(POW_PARTIAL_EVALUATION_LOC), p)
14661466
14671467
mstore(SUBRELATION_EVAL_4_LOC, accumulator_none)
@@ -1474,9 +1474,9 @@ contract HonkVerifier is IVerifier {
14741474
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
14751475
{
14761476
// TODO(md): optimise the calculations
1477-
let minus_one := sub(p, 1)
1478-
let minus_two := sub(p, 2)
1479-
let minus_three := sub(p, 3)
1477+
let minus_one := P_SUB_1
1478+
let minus_two := P_SUB_2
1479+
let minus_three := P_SUB_3
14801480
14811481
let delta_1 := addmod(mload(W2_EVAL_LOC), sub(p, mload(W1_EVAL_LOC)), p)
14821482
let delta_2 := addmod(mload(W3_EVAL_LOC), sub(p, mload(W2_EVAL_LOC)), p)
@@ -1699,7 +1699,7 @@ contract HonkVerifier is IVerifier {
16991699
17001700
// index_is_monotonically_increasing = index_delta * (index_delta - 1)
17011701
let index_is_monotonically_increasing :=
1702-
mulmod(index_delta, addmod(index_delta, sub(p, 1), p), p)
1702+
mulmod(index_delta, addmod(index_delta, P_SUB_1, p), p)
17031703
17041704
// adjacent_values_match_if_adjacent_indices_match = record_delta * (1 - index_delta)
17051705
let adjacent_values_match_if_adjacent_indices_match :=
@@ -1803,9 +1803,9 @@ contract HonkVerifier is IVerifier {
18031803
* next_gate_access_type_is_boolean = next_gate_access_type^2 - next_gate_access_type
18041804
*/
18051805
let access_type := addmod(mload(W4_EVAL_LOC), sub(p, partial_record_check), p)
1806-
let access_check := mulmod(access_type, addmod(access_type, sub(p, 1), p), p)
1806+
let access_check := mulmod(access_type, addmod(access_type, P_SUB_1, p), p)
18071807
let next_gate_access_type_is_boolean :=
1808-
mulmod(next_gate_access_type, addmod(next_gate_access_type, sub(p, 1), p), p)
1808+
mulmod(next_gate_access_type, addmod(next_gate_access_type, P_SUB_1, p), p)
18091809
18101810
// scaled_activation_selector = q_arith * q_aux * alpha
18111811
let scaled_activation_selector :=
@@ -2317,7 +2317,7 @@ contract HonkVerifier is IVerifier {
23172317
mstore(0x20, 0x20)
23182318
mstore(0x40, 0x20)
23192319
mstore(0x60, accumulator)
2320-
mstore(0x80, sub(p, 2))
2320+
mstore(0x80, P_SUB_2)
23212321
mstore(0xa0, p)
23222322
if iszero(staticcall(gas(), 0x05, 0x00, 0xc0, 0x00, 0x20)) {
23232323
mstore(0x00, MODEXP_FAILED_SELECTOR)

0 commit comments

Comments
 (0)