Skip to content

Commit

Permalink
feat: Sync from aztec-packages (noir-lang/noir#5917)
Browse files Browse the repository at this point in the history
chore: bump some dependencies (noir-lang/noir#5893)
chore: make nested slice error more clear for `[[T]; N]` case (noir-lang/noir#5906)
feat: better println for Quoted (noir-lang/noir#5896)
feat: LSP diagnostics for all package files (noir-lang/noir#5895)
feat: LSP code action "Fill struct fields" (noir-lang/noir#5885)
chore: Cleanup str_as_bytes (noir-lang/noir#5900)
chore: update git user for release PRs (noir-lang/noir#5894)
  • Loading branch information
AztecBot committed Sep 4, 2024
2 parents 8b32c5f + 9869cb2 commit cfa38c9
Show file tree
Hide file tree
Showing 103 changed files with 1,286 additions and 460 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/devnet-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
API_KEY: ${{ secrets.DEVNET_API_KEY }}
PUBLIC_API_KEY: ${{ secrets.DEVNET_API_KEY }}
FORK_ADMIN_API_KEY: ${{ secrets.DEVNET_API_KEY }}
FORK_MNEMONIC: ${{ secrets.FORK_MNEMONIC }}
CONTRACT_PUBLISHER_PRIVATE_KEY: ${{ secrets.CONTRACT_PUBLISHER_PRIVATE_KEY }}
CONTRACT_S3_BUCKET: s3://static.aztec.network
Expand Down Expand Up @@ -65,7 +65,7 @@ env:
# Anvil
TF_VAR_FORK_MNEMONIC: ${{ secrets.FORK_MNEMONIC }}
TF_VAR_INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
TF_VAR_PUBLIC_API_KEY: ${{ secrets.DEVNET_API_KEY }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets.DEVNET_API_KEY }}

# Faucet
TF_VAR_FAUCET_ACCOUNT_INDEX: 9
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
deploy_tag: ${{ steps.set_network_vars.outputs.deploy_tag }}
branch_name: ${{ steps.set_network_vars.outputs.branch_name }}
network_api_key: ${{ steps.set_network_vars.outputs.network_api_key }}
network_public_api_key: ${{ steps.set_network_vars.outputs.network_public_api_key }}
network_fork_admin_api_key: ${{ steps.set_network_vars.outputs.network_fork_admin_api_key }}
agents_per_prover: ${{ steps.set_network_vars.outputs.agents_per_prover }}
bot_interval: ${{ steps.set_network_vars.outputs.bot_interval }}
node_tcp_range_start: ${{ steps.set_network_vars.outputs.node_tcp_range_start }}
Expand All @@ -134,7 +134,7 @@ jobs:
echo "deploy_tag=devnet" >> $GITHUB_OUTPUT
echo "branch_name=devnet" >> $GITHUB_OUTPUT
echo "network_api_key=DEVNET_API_KEY" >> $GITHUB_OUTPUT
echo "network_public_api_key=DEVNET_API_KEY" >> $GITHUB_OUTPUT
echo "network_fork_admin_api_key=DEVNET_API_KEY" >> $GITHUB_OUTPUT
echo "agents_per_prover=4" >> $GITHUB_OUTPUT
echo "bot_interval=180" >> $GITHUB_OUTPUT
echo "node_tcp_range_start=40100" >> $GITHUB_OUTPUT
Expand All @@ -155,7 +155,7 @@ jobs:
echo "deploy_tag=provernet" >> $GITHUB_OUTPUT
echo "branch_name=provernet" >> $GITHUB_OUTPUT
echo "network_api_key=PROVERNET_API_KEY" >> $GITHUB_OUTPUT
echo "network_public_api_key=PROVERNET_PUBLIC_API_KEY" >> $GITHUB_OUTPUT
echo "network_fork_admin_api_key=PROVERNET_FORK_ADMIN_API_KEY" >> $GITHUB_OUTPUT
echo "agents_per_prover=8" >> $GITHUB_OUTPUT
echo "bot_interval=10" >> $GITHUB_OUTPUT
echo "node_tcp_range_start=40200" >> $GITHUB_OUTPUT
Expand All @@ -176,7 +176,7 @@ jobs:
echo "deploy_tag=alphanet" >> $GITHUB_OUTPUT
echo "branch_name=alphanet" >> $GITHUB_OUTPUT
echo "network_api_key=ALPHANET_API_KEY" >> $GITHUB_OUTPUT
echo "network_public_api_key=ALPHANET_API_KEY" >> $GITHUB_OUTPUT
echo "network_fork_admin_api_key=ALPHANET_API_KEY" >> $GITHUB_OUTPUT
echo "agents_per_prover=1" >> $GITHUB_OUTPUT
echo "bot_interval=30" >> $GITHUB_OUTPUT
echo "node_tcp_range_start=40000" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -206,8 +206,8 @@ jobs:
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
PUBLIC_API_KEY: ${{ secrets[needs.set-network.outputs.network_public_api_key] }}
TF_VAR_PUBLIC_API_KEY: ${{ secrets[needs.set-network.outputs.network_public_api_key] }}
FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
API_KEY_NAME: ${{ needs.set-network.outputs.network_api_key }}
runs-on: ${{ github.actor }}-x86
steps:
Expand Down Expand Up @@ -334,6 +334,8 @@ jobs:
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
API_KEY_NAME: ${{ needs.set-network.outputs.network_api_key }}
runs-on: ${{ github.actor }}-x86
steps:
Expand Down Expand Up @@ -451,8 +453,8 @@ jobs:
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
PUBLIC_API_KEY: ${{ secrets[needs.set-network.outputs.network_public_api_key] }}
TF_VAR_PUBLIC_API_KEY: ${{ secrets[needs.set-network.outputs.network_public_api_key] }}
FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_AGENTS_PER_PROVER: ${{ needs.set-network.outputs.agents_per_prover }}
TF_VAR_BOT_TX_INTERVAL_SECONDS: ${{ needs.set-network.outputs.bot_interval }}
TF_VAR_NODE_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.node_lb_priority_range_start }}
Expand Down Expand Up @@ -495,7 +497,7 @@ jobs:
docker pull aztecprotocol/aztec:${{ env.DEPLOY_TAG }}
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} deploy-l1-contracts \
--private-key ${{ env.CONTRACT_PUBLISHER_PRIVATE_KEY }} \
--rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ env.API_KEY }} \
--rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/admin-${{ env.FORK_ADMIN_API_KEY }} \
--l1-chain-id ${{ env.L1_CHAIN_ID }} \
--salt ${{ github.run_id }} \
--json | tee ./l1_contracts.json
Expand Down Expand Up @@ -563,6 +565,8 @@ jobs:
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -600,7 +604,7 @@ jobs:
set -o pipefail
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} bootstrap-network \
--rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ env.API_KEY }} \
--l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ env.API_KEY }} \
--l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/admin-${{ env.FORK_ADMIN_API_KEY }} \
--l1-chain-id ${{ env.L1_CHAIN_ID }} \
--l1-private-key ${{ env.CONTRACT_PUBLISHER_PRIVATE_KEY }} \
--json | tee ./basic_contracts.json
Expand All @@ -617,6 +621,8 @@ jobs:
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FAUCET_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.faucet_lb_priority }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -659,6 +665,8 @@ jobs:
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets[needs.set-network.outputs.network_fork_admin_api_key] }}
TF_VAR_AGENTS_PER_PROVER: ${{ needs.set-network.outputs.agents_per_prover }}
TF_VAR_BOT_TX_INTERVAL_SECONDS: ${{ needs.set-network.outputs.bot_interval }}
TF_VAR_NODE_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.node_lb_priority_range_start }}
Expand Down Expand Up @@ -694,7 +702,7 @@ jobs:
# set -eo pipefail
# docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} set-proven-until \
# --rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ env.API_KEY }} \
# --l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ env.API_KEY }} \
# --l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/admin-${{ env.FORK_ADMIN_API_KEY }} \
# --l1-chain-id ${{ env.L1_CHAIN_ID }} \
# --l1-private-key ${{ env.CONTRACT_PUBLISHER_PRIVATE_KEY }}

Expand Down Expand Up @@ -734,7 +742,7 @@ jobs:
set -eo pipefail
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} deploy-l1-verifier \
--rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ env.API_KEY }} \
--l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ env.API_KEY }} \
--l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/admin-${{ env.FORK_ADMIN_API_KEY }} \
--l1-chain-id ${{ env.L1_CHAIN_ID }} \
--l1-private-key ${{ env.CONTRACT_PUBLISHER_PRIVATE_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devnet-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AZTEC_NODE_URL: https://api.aztec.network/devnet/aztec-node-1/{{ secrets.DEVNET_API_KEY }}
FAUCET_URL: https://api.aztec.network/devnet/aztec-faucet/{{ secrets.DEVNET_API_KEY }}
ETHEREUM_HOST: https://devnet-mainnet-fork.aztec.network:8545/${{ secrets.DEVNET_API_KEY }}
ETHEREUM_HOST: https://devnet-mainnet-fork.aztec.network:8545/admin-${{ secrets.DEVNET_API_KEY }}

jobs:
setup:
Expand Down
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
34cb23fc645cbc2baa81dcc664324db340fa76f9
33bd102d6021912b56fe880efab65346c3ea9228
3 changes: 3 additions & 0 deletions avm-transpiler/src/transpile_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub struct AvmContractFunctionArtifact {
deserialize_with = "ProgramDebugInfo::deserialize_compressed_base64_json"
)]
pub debug_symbols: ProgramDebugInfo,
pub brillig_names: Vec<String>,
pub assert_messages: HashMap<usize, String>,
}

Expand All @@ -73,6 +74,7 @@ pub struct AcirContractFunctionArtifact {
deserialize_with = "ProgramDebugInfo::deserialize_compressed_base64_json"
)]
pub debug_symbols: ProgramDebugInfo,
pub brillig_names: Vec<String>,
}

/// An enum that allows the TranspiledContract struct to contain
Expand Down Expand Up @@ -139,6 +141,7 @@ impl From<CompiledAcirContractArtifact> for TranspiledContractArtifact {
abi: function.abi,
bytecode: base64::prelude::BASE64_STANDARD.encode(compressed_avm_bytecode),
debug_symbols: ProgramDebugInfo { debug_infos },
brillig_names: function.brillig_names,
assert_messages,
},
));
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
commit = a3bef86e97765dd218fc3a8361afeba83e4c955f
parent = 2d3e0b672c11eddf0e4e50f00a42a662bdd67c0c
commit = 84191703c27890b755124db6255e6a3f0747bb42
parent = efad298f60a86094394fd4ac67fbf108fba110f9
method = merge
cmdver = 0.4.6
26 changes: 10 additions & 16 deletions barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ TEST_F(AztecIVCTests, BasicFour)
};

/**
* @brief Check that the IVC fails if an intermediate fold proof is invalid
* @brief Check that the IVC fails to verify if an intermediate fold proof is invalid
* @details When accumulating 4 circuits, there are 3 fold proofs to verify (the first two are recursively verfied and
* the 3rd is verified as part of the IVC proof). Check that if any of one of these proofs is invalid, the IVC will
* fail.
* the 3rd is verified as part of the IVC proof). Check that if any of one of these proofs is invalid, the IVC will fail
* to verify.
*
*/
TEST_F(AztecIVCTests, BadProofFailure)
Expand All @@ -175,7 +175,7 @@ TEST_F(AztecIVCTests, BadProofFailure)
EXPECT_TRUE(ivc.prove_and_verify());
}

// The IVC throws an exception if the FIRST fold proof is tampered with
// The IVC fails to verify if the FIRST fold proof is tampered with
{
AztecIVC ivc;
ivc.trace_structure = TraceStructure::SMALL_TEST;
Expand All @@ -185,11 +185,6 @@ TEST_F(AztecIVCTests, BadProofFailure)
// Construct and accumulate a set of mocked private function execution circuits
size_t NUM_CIRCUITS = 4;
for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) {
if (idx == 3) { // At idx = 3, we've tampered with the one of the folding proofs so create the recursive
// folding verifier will throw an error.
EXPECT_ANY_THROW(circuit_producer.create_next_circuit(ivc, /*log2_num_gates=*/5));
break;
}
auto circuit = circuit_producer.create_next_circuit(ivc, /*log2_num_gates=*/5);
ivc.accumulate(circuit);

Expand All @@ -198,9 +193,11 @@ TEST_F(AztecIVCTests, BadProofFailure)
tamper_with_proof(ivc.verification_queue[0].proof); // tamper with first proof
}
}

EXPECT_FALSE(ivc.prove_and_verify());
}

// The IVC fails if the SECOND fold proof is tampered with
// The IVC fails to verify if the SECOND fold proof is tampered with
{
AztecIVC ivc;
ivc.trace_structure = TraceStructure::SMALL_TEST;
Expand All @@ -210,11 +207,6 @@ TEST_F(AztecIVCTests, BadProofFailure)
// Construct and accumulate a set of mocked private function execution circuits
size_t NUM_CIRCUITS = 4;
for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) {
if (idx == 3) { // At idx = 3, we've tampered with the one of the folding proofs so create the recursive
// folding verifier will throw an error.
EXPECT_ANY_THROW(circuit_producer.create_next_circuit(ivc, /*log2_num_gates=*/5));
break;
}
auto circuit = circuit_producer.create_next_circuit(ivc, /*log2_num_gates=*/5);
ivc.accumulate(circuit);

Expand All @@ -223,9 +215,11 @@ TEST_F(AztecIVCTests, BadProofFailure)
tamper_with_proof(ivc.verification_queue[1].proof); // tamper with second proof
}
}

EXPECT_FALSE(ivc.prove_and_verify());
}

// The IVC fails if the 3rd/FINAL fold proof is tampered with
// The IVC fails to verify if the 3rd/FINAL fold proof is tampered with
{
AztecIVC ivc;
ivc.trace_structure = TraceStructure::SMALL_TEST;
Expand Down
11 changes: 7 additions & 4 deletions barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ TEST_F(ClientIVCTests, BasicThree)
};

/**
* @brief Check that the IVC fails if an intermediate fold proof is invalid
* @brief Check that the IVC fails to verify if an intermediate fold proof is invalid
*
*/
TEST_F(ClientIVCTests, BasicFailure)
Expand All @@ -128,10 +128,13 @@ TEST_F(ClientIVCTests, BasicFailure)
break;
}
}
// Accumulate another circuit; this involves recursive folding verification of the bad proof which throws an error
// because of circuit sizes don't match.

// Accumulate another circuit; this involves recursive folding verification of the bad proof
Builder circuit_2 = create_mock_circuit(ivc);
EXPECT_ANY_THROW(ivc.accumulate(circuit_2));
ivc.accumulate(circuit_2);

// The bad fold proof should result in an invalid witness in the final circuit and the IVC should fail to verify
EXPECT_FALSE(prove_and_verify(ivc));
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ TEST_F(join_split_tests, test_0_input_notes_and_detect_circuit_change)
// The below part detects any changes in the join-split circuit
constexpr size_t DYADIC_CIRCUIT_SIZE = 1 << 16;

constexpr uint256_t CIRCUIT_HASH("0x9170317e02f4131b84f6b4efdd3ac23e5f392d815df37750c8f05a94c64797b2");
constexpr uint256_t CIRCUIT_HASH("0x2b30566e4d921ea9b0c76802d86ea5b8381ffa78ef143af1b0d0e3045862cb6b");

const uint256_t circuit_hash = circuit.hash_circuit();
// circuit is finalized now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,14 @@ template <typename Flavor> void OinkRecursiveVerifier_<Flavor>::verify()
CommitmentLabels labels;

FF circuit_size = transcript->template receive_from_prover<FF>(domain_separator + "circuit_size");
FF public_input_size = transcript->template receive_from_prover<FF>(domain_separator + "public_input_size");
FF pub_inputs_offset = transcript->template receive_from_prover<FF>(domain_separator + "pub_inputs_offset");

if (static_cast<uint32_t>(circuit_size.get_value()) != instance->verification_key->circuit_size) {
throw_or_abort("OinkRecursiveVerifier::verify: proof circuit size does not match verification key");
}
if (static_cast<uint32_t>(public_input_size.get_value()) != instance->verification_key->num_public_inputs) {
throw_or_abort("OinkRecursiveVerifier::verify: proof public input size does not match verification key");
}
if (static_cast<uint32_t>(pub_inputs_offset.get_value()) != instance->verification_key->pub_inputs_offset) {
throw_or_abort("OinkRecursiveVerifier::verify: proof public input offset does not match verification key");
}
transcript->template receive_from_prover<FF>(domain_separator + "public_input_size");
transcript->template receive_from_prover<FF>(domain_separator + "pub_inputs_offset");

// TODO(https://github.com/AztecProtocol/barretenberg/issues/1032): Uncomment these once it doesn't cause issues
// with the flows
// ASSERT(static_cast<uint32_t>(circuit_size.get_value()) == key->circuit_size);
// ASSERT(static_cast<uint32_t>(public_input_size.get_value()) == key->num_public_inputs);
// ASSERT(static_cast<uint32_t>(pub_inputs_offset.get_value()) == key->pub_inputs_offset);

std::vector<FF> public_inputs;
for (size_t i = 0; i < instance->verification_key->num_public_inputs; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,18 +694,18 @@ template <typename Builder> bool_t<Builder> field_t<Builder>::operator==(const f
bb::fr fd = fa - fb;
bool is_equal = (fa == fb);
bb::fr fc = is_equal ? bb::fr::one() : fd.invert();
bool_t result(ctx, is_equal);
auto result_witness = witness_t(ctx, is_equal);
result.witness_index = result_witness.witness_index;
result.witness_bool = is_equal;

bool_t result(witness_t(ctx, is_equal));
field_t r(result);
field_t x(witness_t(ctx, fc));

const field_t& a = *this;
const field_t& b = other;
const field_t diff = a - b;

const field_t t1 = r.madd(-x + 1, x);
const field_t t2 = diff.madd(t1, r - 1);
t2.assert_equal(0);
// these constraints ensure that result is a boolean
field_t::evaluate_polynomial_identity(diff, x, result, -field_t(bb::fr::one()));
field_t::evaluate_polynomial_identity(diff, result, field_t(bb::fr::zero()), field_t(bb::fr::zero()));

return result;
}
Expand Down
Loading

0 comments on commit cfa38c9

Please sign in to comment.