Skip to content

Commit

Permalink
Merge branch 'master' into pw/ssd
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilWindle authored Dec 31, 2024
2 parents e2837f8 + b8fe0e4 commit 32ba085
Show file tree
Hide file tree
Showing 134 changed files with 2,655 additions and 1,661 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/devnet-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ on:
description: Whether to respect the Terraform lock
required: false
default: "true"
sepolia_deployment:
description: Whether to deploy to Sepolia
required: false
default: "false"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -47,6 +51,7 @@ jobs:
deployment_salt: ${{ github.event.inputs.deployment_salt }}
respect_tf_lock: ${{ github.event.inputs.respect_tf_lock }}
run_terraform_destroy: "true"
sepolia_deployment: ${{ github.event.inputs.sepolia_deployment }}
secrets:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/network-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ on:
sepolia_deployment:
description: "Whether to deploy on Sepolia network (default: false)"
required: false
type: boolean
default: false
type: string
default: "false"
secrets:
GCP_SA_KEY:
required: true
Expand Down Expand Up @@ -84,8 +84,8 @@ on:
sepolia_deployment:
description: "Whether to deploy on Sepolia network (default: false)"
required: false
type: boolean
default: false
type: string
default: "false"

jobs:
network_deployment:
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
# Destroy fails if the resources are already destroyed, so we continue on error
continue-on-error: true
run: |
if ${{ inputs.sepolia_deployment }}; then
if ${{ inputs.sepolia_deployment == 'true' }}; then
terraform destroy -auto-approve \
-var="RELEASE_NAME=${{ env.NAMESPACE }}" \
-var="VALUES_FILE=${{ env.VALUES_FILE }}" \
Expand All @@ -189,7 +189,7 @@ jobs:
- name: Terraform Plan
working-directory: ./spartan/terraform/deploy-release
run: |
if ${{ inputs.sepolia_deployment }}; then
if ${{ inputs.sepolia_deployment == 'true' }}; then
terraform plan \
-var="RELEASE_NAME=${{ env.NAMESPACE }}" \
-var="VALUES_FILE=${{ env.VALUES_FILE }}" \
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 = b0e1247cdb47c388d1610f99dacea86449cfe291
parent = c0821bd9f224c84d4e0079fd783812e1e766b92c
commit = ef0c28cee77014437448aa905e184199047c77d1
parent = 158afc4cd34a9fc9cb41bcb083b5197eae1ce442
method = merge
cmdver = 0.4.6
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ template <IsUltraFlavor Flavor> bool verify_honk(const std::string& proof_path,
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1168): Add formula to flavor
const size_t HONK_PROOF_LENGTH = 469;
const size_t num_public_inputs =
static_cast<size_t>(proof[1]) - PAIRING_POINT_ACCUMULATOR_SIZE - IPA_CLAIM_SIZE;
static_cast<size_t>(uint64_t(proof[1])) - PAIRING_POINT_ACCUMULATOR_SIZE - IPA_CLAIM_SIZE;
// The extra calculation is for the IPA proof length.
debug("proof size: ", proof.size());
debug("num public inputs: ", num_public_inputs);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
namespace bb {
/**
* @brief TranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of
* EccOpQueue in Fq while operating in the Fr scalar field (r is the modulus of Fr and p is the modulus of Fp)
* EccOpQueue in Fq while operating in the Fr scalar field (r is the modulus of Fr and q is the modulus of Fq)
*
* @details Translator Circuit Builder builds a circuit the purpose of which is to calculate the batched
* @details Translator Circuit Builder builds a circuit whose purpose is to calculate the batched
* evaluation of 5 polynomials in non-native field represented through coefficients in 4 native polynomials (op,
* x_lo_y_hi, x_hi_z_1, y_lo_z_2):
*
Expand All @@ -33,11 +33,11 @@ namespace bb {
*
* Translator calculates the result of evaluation of a polynomial op + P.x⋅v +P.y⋅v² + z1 ⋅ v³ + z2⋅v⁴ at the
* given challenge x (evaluation_input_x). For this it uses logic similar to the stdlib bigfield class. We operate in Fr
* while trying to calculate values in Fq. To show that a⋅b=c mod p, we:
* while trying to calculate values in Fq. To show that a⋅b=c mod q, we:
* 1) Compute a⋅b in integers
* 2) Compute quotient=a⋅b/p
* 3) Show that a⋅b - quotient⋅p - c = 0 mod 2²⁷²
* 4) Show that a⋅b - quotient⋅p - c = 0 mod r (scalar field modulus)
* 2) Compute quotient=a⋅b/q
* 3) Show that a⋅b - quotient⋅q - c = 0 mod 2²⁷²
* 4) Show that a⋅b - quotient⋅q - c = 0 mod r (scalar field modulus)
* This ensures that the logic is sound modulo 2²⁷²⋅r, which means it's correct in integers, if all the values are
* sufficiently constrained (there is no way to undeflow or overflow)
*
Expand Down Expand Up @@ -73,6 +73,7 @@ class TranslatorCircuitBuilder : public CircuitBuilderBase<bb::fr> {
// We don't need templating for Goblin
using Fr = bb::fr;
using Fq = bb::fq;
using ECCVMOperation = ECCOpQueue::ECCVMOperation;

public:
static constexpr size_t NUM_WIRES = 81;
Expand Down Expand Up @@ -272,7 +273,7 @@ class TranslatorCircuitBuilder : public CircuitBuilderBase<bb::fr> {
* @brief The accumulation input structure contains all the necessary values to initalize an accumulation gate as
* well as additional values for checking its correctness
*
* @details For example, we don't really nead the prime limbs, but they serve to check the correctness of over
* @details For example, we don't really need the prime limbs, but they serve to check the correctness of over
* values. We also don't need the values of x's and v's limbs during circuit construction, since they are added to
* relations directly, but this allows us to check correctness of the computed accumulator
*/
Expand Down Expand Up @@ -448,7 +449,7 @@ class TranslatorCircuitBuilder : public CircuitBuilderBase<bb::fr> {
*
* @param ecc_op_queue The queue
*/
void feed_ecc_op_queue_into_circuit(std::shared_ptr<ECCOpQueue> ecc_op_queue);
void feed_ecc_op_queue_into_circuit(const std::shared_ptr<ECCOpQueue> ecc_op_queue);

/**
* @brief Check the witness satisifies the circuit
Expand All @@ -459,16 +460,20 @@ class TranslatorCircuitBuilder : public CircuitBuilderBase<bb::fr> {
* @return false
*/
bool check_circuit();
static AccumulationInput generate_witness_values(const Fr op_code,
const Fr p_x_lo,
const Fr p_x_hi,
const Fr p_y_lo,
const Fr p_y_hi,
const Fr z1,
const Fr z2,
const Fq previous_accumulator,
const Fq batching_challenge_v,
const Fq evaluation_input_x);
static AccumulationInput compute_witness_values_for_one_ecc_op(const ECCVMOperation& ecc_op,
const Fq previous_accumulator,
const Fq batching_challenge_v,
const Fq evaluation_input_x);
};
template <typename Fq, typename Fr>
TranslatorCircuitBuilder::AccumulationInput generate_witness_values(Fr op_code,
Fr p_x_lo,
Fr p_x_hi,
Fr p_y_lo,
Fr p_y_hi,
Fr z1,
Fr z2,
Fq previous_accumulator,
Fq batching_challenge_v,
Fq evaluation_input_x);

} // namespace bb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ TEST(TranslatorCircuitBuilder, CircuitBuilderBaseCase)

Fq previous_accumulator = Fq::random_element();

// Create a circuit builder
auto circuit_builder = TranslatorCircuitBuilder(v, x);

// Generate the witness for a single step
TranslatorCircuitBuilder::AccumulationInput single_accumulation_step =
generate_witness_values(op, p_x_lo, p_x_hi, p_y_lo, p_y_hi, z_1, z_2, previous_accumulator, v, x);
TranslatorCircuitBuilder::generate_witness_values(
op, p_x_lo, p_x_hi, p_y_lo, p_y_hi, z_1, z_2, previous_accumulator, v, x);

// Create a circuit builder
auto circuit_builder = TranslatorCircuitBuilder(v, x);
// Submit one accumulation step in the builder
circuit_builder.create_accumulation_gate(single_accumulation_step);
// Check if the circuit fails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,7 @@ class TranslatorFlavor {
static constexpr size_t NUM_RELATIONS = std::tuple_size_v<Relations>;

// define the containers for storing the contributions from each relation in Sumcheck
using SumcheckTupleOfTuplesOfUnivariates =
std::tuple<typename TranslatorPermutationRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations,
typename TranslatorDeltaRangeConstraintRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations,
typename TranslatorOpcodeConstraintRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations,
typename TranslatorAccumulatorTransferRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations,
typename TranslatorDecompositionRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations,
typename TranslatorNonNativeFieldRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations,
typename TranslatorZeroConstraintsRelation<FF>::SumcheckTupleOfUnivariatesOverSubrelations>;
using SumcheckTupleOfTuplesOfUnivariates = decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
using TupleOfArraysOfValues = decltype(create_tuple_of_arrays_of_values<Relations>());

/**
Expand Down Expand Up @@ -168,7 +161,6 @@ class TranslatorFlavor {
concatenated_range_constraints_2, // column 2
concatenated_range_constraints_3) // column 3
};
// TODO(https://github.com/AztecProtocol/barretenberg/issues/790) dedupe with shifted?
template <typename DataType> class WireToBeShiftedWithoutConcatenated {
public:
DEFINE_FLAVOR_MEMBERS(DataType,
Expand Down
8 changes: 8 additions & 0 deletions docs/components/snippet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';

const Spec_Placeholder = () => (
<p>The design and implementation have largely changed since the original specification, and these docs will soon be updated to reflect the latest implementation.
</p>
);

export default Spec_Placeholder;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 32ba085

Please sign in to comment.