Skip to content

Commit

Permalink
[ci rebuild aztec-sandbox] [ci force-deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
charlielye committed Dec 1, 2023
2 parents 9eed4a3 + d889359 commit 92ebdbb
Show file tree
Hide file tree
Showing 405 changed files with 11,208 additions and 6,430 deletions.
74 changes: 72 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,17 @@ jobs:
echo "Skipping doc deploy (not on master)."
fi
yellow-paper:
machine:
image: ubuntu-2204:2023.07.2
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: "Build yellow paper"
command: build yellow-paper

e2e-join:
docker:
- image: cimg/base:2023.09
Expand Down Expand Up @@ -905,7 +916,21 @@ jobs:
name: "Deploy mainnet fork"
command: |
should_deploy || exit 0
deploy_ecr mainnet-fork
deploy mainnet-fork
deploy-contracts:
machine:
image: ubuntu-2204:2023.07.2
resource_class: medium
steps:
- *checkout
- *setup_env
- run:
name: "Deploy L1 contracts to mainnet fork"
working_directory: l1-contracts
command: |
should_deploy || exit 0
./scripts/ci_deploy_contracts.sh
deploy-npm:
machine:
Expand All @@ -931,9 +956,40 @@ jobs:
name: "Deploy to dockerhub"
command: |
should_deploy || exit 0
<<<<<<< HEAD
deploy_dockerhub noir
deploy_dockerhub aztec-sandbox
deploy_dockerhub cli
=======
deploy_dockerhub noir x86_64,arm64
deploy_dockerhub aztec-sandbox x86_64,arm64
deploy_dockerhub cli x86_64,arm64
deploy_dockerhub aztec-faucet x86_64
deploy_dockerhub mainnet-fork x86_64
deploy_dockerhub l1-contracts x86_64

deploy-devnet:
machine:
image: ubuntu-2204:2023.07.2
resource_class: medium
steps:
- *checkout
- *setup_env
- run:
name: "Deploy devnet to AWS"
command: |
should_deploy 0 || exit 0
export TF_VAR_FAUCET_PRIVATE_KEY=$FAUCET_PRIVATE_KEY
export TF_VAR_BOOTNODE_1_PEER_ID=$BOOTNODE_1_PEER_ID
export TF_VAR_BOOTNODE_2_PEER_ID=$BOOTNODE_2_PEER_ID
export TF_VAR_BOOTNODE_1_PRIVATE_KEY=$BOOTNODE_1_PRIVATE_KEY
export TF_VAR_BOOTNODE_2_PRIVATE_KEY=$BOOTNODE_2_PRIVATE_KEY
export TF_VAR_SEQ_1_PUBLISHER_PRIVATE_KEY=$SEQ_1_PUBLISHER_PRIVATE_KEY
export TF_VAR_SEQ_2_PUBLISHER_PRIVATE_KEY=$SEQ_2_PUBLISHER_PRIVATE_KEY
deploy_terraform p2p-bootstrap yarn-project/p2p-bootstrap/terraform
deploy_terraform aztec-node yarn-project/aztec-node/terraform
deploy_terraform aztec-faucet yarn-project/aztec-faucet/terraform
>>>>>>> origin/master

# Repeatable config for defining the workflow below.
defaults: &defaults
Expand Down Expand Up @@ -1030,6 +1086,8 @@ workflows:

- mainnet-fork: *defaults

- yellow-paper: *defaults

# Yarn Project
- yarn-project-base:
requires:
Expand Down Expand Up @@ -1143,6 +1201,7 @@ workflows:
- guides-dapp-testing
- guides-sample-dapp
- guides-up-quick-start
- yellow-paper
<<: *defaults

# Benchmark jobs.
Expand All @@ -1157,4 +1216,15 @@ workflows:
# Production deployment
- deploy-dockerhub: *defaults_deploy
- deploy-npm: *defaults_deploy
- deploy-mainnet-fork: *defaults_deploy
- deploy-mainnet-fork:
requires:
- deploy-dockerhub
<<: *defaults_deploy
- deploy-contracts:
requires:
- deploy-mainnet-fork
<<: *defaults_deploy
- deploy-devnet:
requires:
- deploy-contracts
<<: *defaults_deploy
4 changes: 4 additions & 0 deletions barretenberg/cpp/.clangd
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Diagnostics:
- google-explicit-constructor
# Not honouring.
- cppcoreguidelines-owning-memory
# "This check is deprecated since it’s no longer part of the CERT standard. It will be removed in clang-tidy version 19."
- cert-dc21-cpp
# Noisy. As we don't need to return error types or raw allocations, really unlikely we'd cause problems by ignoring a return type.
- modernize-use-nodiscard

--- # this divider is necessary
# Disable some checks for Google Test/Bench
Expand Down
47 changes: 3 additions & 44 deletions barretenberg/cpp/pil/avm/avm_mini.pil
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
constant %N = 256;

namespace avmMini(%N);
include "mem_trace.pil";

namespace avmMini(256);

//===== CONSTANT POLYNOMIALS ==================================================
pol constant clk(i) { i };
Expand Down Expand Up @@ -52,46 +53,4 @@ namespace avmMini(%N);
// Relation for addition over the finite field
subop * (ia + ib - ic) = 0;

// ========= Table MEM-TR =================
pol commit m_clk;
pol commit m_sub_clk;
pol commit m_addr;
pol commit m_val;
pol commit m_lastAccess; // Boolean (1 when this row is the last of a given address)
pol commit m_rw; // Enum: 0 (read), 1 (write)

// Type constraints
m_lastAccess * (1 - m_lastAccess) = 0;
m_rw * (1 - m_rw) = 0;

// m_lastAccess == 0 ==> m_addr' == m_addr
(1 - first) * (1 - m_lastAccess) * (m_addr' - m_addr) = 0;

// We need: m_lastAccess == 1 ==> m_addr' > m_addr
// The above implies: m_addr' == m_addr ==> m_lastAccess == 0
// This condition does not apply on the last row.
// clk + 1 used as an expression for positive integers
// TODO: Uncomment when lookups are supported
// (1 - first) * (1 - last) * m_lastAccess { (m_addr' - m_addr) } in clk + 1; // Gated inclusion check. Is it supported?

// TODO: following constraint
// m_addr' == m_addr && m_clk == m_clk' ==> m_sub_clk' - m_sub_clk > 0
// Can be enforced with (1 - first) * (1 - last) * (1 - m_lastAccess) { 6 * (m_clk' - m_clk) + m_sub_clk' - m_sub_clk } in clk + 1

// Alternatively to the above, one could require
// that m_addr' - m_addr is 0 or 1 (needs to add placeholders m_addr values):
// (m_addr' - m_addr) * (m_addr' - m_addr) - (m_addr' - m_addr) = 0;
// if m_addr' - m_addr is 0 or 1, the following is equiv. to m_lastAccess
// (m_addr' - m_addr)

// m_lastAccess == 0 && m_rw' == 0 ==> m_val == m_val'
// This condition does not apply on the last row.
// Note: in barretenberg, a shifted polynomial will be 0 on the last row (shift is not cyclic)
// Note2: in barretenberg, if a poynomial is shifted, its non-shifted equivalent must be 0 on the first row

(1 - first) * (1 - last) * (1 - m_lastAccess) * (1 - m_rw') * (m_val' - m_val) = 0;

// TODO: Constraint the first load from a given adress has value 0. (Consistency of memory initialization.)
// TODO: when introducing load/store as sub-operations, we will have to add consistency of intermediate
// register values ia, ib, ic

25 changes: 12 additions & 13 deletions barretenberg/cpp/pil/avm/avm_mini_opt.pil
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
constant %N = 256;
namespace memTrace(256);
col witness m_clk;
col witness m_sub_clk;
col witness m_addr;
col witness m_val;
col witness m_lastAccess;
col witness m_rw;
(memTrace.m_lastAccess * (1 - memTrace.m_lastAccess)) = 0;
(memTrace.m_rw * (1 - memTrace.m_rw)) = 0;
(((1 - avmMini.first) * (1 - memTrace.m_lastAccess)) * (memTrace.m_addr' - memTrace.m_addr)) = 0;
(((((1 - avmMini.first) * (1 - avmMini.last)) * (1 - memTrace.m_lastAccess)) * (1 - memTrace.m_rw')) * (memTrace.m_val' - memTrace.m_val)) = 0;
namespace avmMini(256);
col fixed clk(i) { i };
col fixed positive(i) { (i + 1) };
col fixed first = [1] + [0]*;
col witness subop;
col witness ia;
Expand All @@ -24,14 +33,4 @@ namespace avmMini(256);
(avmMini.rwa * (1 - avmMini.rwa)) = 0;
(avmMini.rwb * (1 - avmMini.rwb)) = 0;
(avmMini.rwc * (1 - avmMini.rwc)) = 0;
(avmMini.subop * ((avmMini.ia + avmMini.ib) - avmMini.ic)) = 0;
col witness m_clk;
col witness m_sub_clk;
col witness m_addr;
col witness m_val;
col witness m_lastAccess;
col witness m_rw;
(avmMini.m_lastAccess * (1 - avmMini.m_lastAccess)) = 0;
(avmMini.m_rw * (1 - avmMini.m_rw)) = 0;
(((1 - avmMini.first) * (1 - avmMini.m_lastAccess)) * (avmMini.m_addr' - avmMini.m_addr)) = 0;
(((((1 - avmMini.first) * (1 - avmMini.last)) * (1 - avmMini.m_lastAccess)) * (1 - avmMini.m_rw')) * (avmMini.m_val' - avmMini.m_val)) = 0;
(avmMini.subop * ((avmMini.ia + avmMini.ib) - avmMini.ic)) = 0;
47 changes: 47 additions & 0 deletions barretenberg/cpp/pil/avm/mem_trace.pil
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@


include "avm_mini.pil";

namespace memTrace(256);
// ========= Table MEM-TR =================
pol commit m_clk;
pol commit m_sub_clk;
pol commit m_addr;
pol commit m_val;
pol commit m_lastAccess; // Boolean (1 when this row is the last of a given address)
pol commit m_rw; // Enum: 0 (read), 1 (write)

// Type constraints
m_lastAccess * (1 - m_lastAccess) = 0;
m_rw * (1 - m_rw) = 0;

// m_lastAccess == 0 ==> m_addr' == m_addr
(1 - avmMini.first) * (1 - m_lastAccess) * (m_addr' - m_addr) = 0;

// We need: m_lastAccess == 1 ==> m_addr' > m_addr
// The above implies: m_addr' == m_addr ==> m_lastAccess == 0
// This condition does not apply on the last row.
// clk + 1 used as an expression for positive integers
// TODO: Uncomment when lookups are supported
// (1 - first) * (1 - last) * m_lastAccess { (m_addr' - m_addr) } in clk + 1; // Gated inclusion check. Is it supported?

// TODO: following constraint
// m_addr' == m_addr && m_clk == m_clk' ==> m_sub_clk' - m_sub_clk > 0
// Can be enforced with (1 - first) * (1 - last) * (1 - m_lastAccess) { 6 * (m_clk' - m_clk) + m_sub_clk' - m_sub_clk } in clk + 1

// Alternatively to the above, one could require
// that m_addr' - m_addr is 0 or 1 (needs to add placeholders m_addr values):
// (m_addr' - m_addr) * (m_addr' - m_addr) - (m_addr' - m_addr) = 0;
// if m_addr' - m_addr is 0 or 1, the following is equiv. to m_lastAccess
// (m_addr' - m_addr)

// m_lastAccess == 0 && m_rw' == 0 ==> m_val == m_val'
// This condition does not apply on the last row.
// Note: in barretenberg, a shifted polynomial will be 0 on the last row (shift is not cyclic)
// Note2: in barretenberg, if a poynomial is shifted, its non-shifted equivalent must be 0 on the first row

(1 - avmMini.first) * (1 - avmMini.last) * (1 - m_lastAccess) * (1 - m_rw') * (m_val' - m_val) = 0;

// TODO: Constraint the first load from a given adress has value 0. (Consistency of memory initialization.)
// TODO: when introducing load/store as sub-operations, we will have to add consistency of intermediate
// register values ia, ib, ic
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ template <typename Flavor, typename Relation> void execute_relation(::benchmark:
auto params = proof_system::RelationParameters<FF>::get_random();

// Extract an array containing all the polynomial evaluations at a given row i
AllValues new_value;
AllValues new_value{};
// Define the appropriate SumcheckArrayOfValuesOverSubrelations type for this relation and initialize to zero
SumcheckArrayOfValuesOverSubrelations accumulator;
// Evaluate each constraint in the relation and check that each is satisfied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ template <class Curve> class GeminiTest : public CommitmentTest<Curve> {
std::vector<GroupElement> multilinear_commitments,
std::vector<GroupElement> multilinear_commitments_to_be_shifted)
{
auto prover_transcript = BaseTranscript<Fr>::prover_init_empty();
auto prover_transcript = BaseTranscript::prover_init_empty();

const Fr rho = Fr::random_element();

Expand Down Expand Up @@ -79,7 +79,7 @@ template <class Curve> class GeminiTest : public CommitmentTest<Curve> {
// Check that the Fold polynomials have been evaluated correctly in the prover
this->verify_batch_opening_pair(prover_output.opening_pairs, prover_output.witnesses);

auto verifier_transcript = BaseTranscript<Fr>::verifier_init_empty(prover_transcript);
auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);

// Compute:
// - Single opening pair: {r, \hat{a}_0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ template <typename Curve> class IPA {
static void compute_opening_proof(std::shared_ptr<CK> ck,
const OpeningPair<Curve>& opening_pair,
const Polynomial& polynomial,
BaseTranscript<Fr>& transcript)
BaseTranscript& transcript)
{
ASSERT(opening_pair.challenge != 0 && "The challenge point should not be zero");
auto poly_degree = static_cast<size_t>(polynomial.size());
Expand Down Expand Up @@ -134,7 +134,7 @@ template <typename Curve> class IPA {
*
* @return true/false depending on if the proof verifies
*/
static bool verify(std::shared_ptr<VK> vk, const OpeningClaim<Curve>& opening_claim, BaseTranscript<Fr>& transcript)
static bool verify(std::shared_ptr<VK> vk, const OpeningClaim<Curve>& opening_claim, BaseTranscript& transcript)
{
auto poly_degree = static_cast<size_t>(transcript.template receive_from_prover<uint64_t>("IPA:poly_degree"));
Fr generator_challenge = transcript.get_challenge("IPA:generator_challenge");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ TEST_F(IPATest, Open)
const OpeningClaim<Curve> opening_claim{ opening_pair, commitment };

// initialize empty prover transcript
BaseTranscript<Fr> prover_transcript;
BaseTranscript prover_transcript;
IPA::compute_opening_proof(this->ck(), opening_pair, poly, prover_transcript);

// initialize verifier transcript from proof data
BaseTranscript<Fr> verifier_transcript{ prover_transcript.proof_data };
BaseTranscript verifier_transcript{ prover_transcript.proof_data };

auto result = IPA::verify(this->vk(), opening_claim, verifier_transcript);
EXPECT_TRUE(result);
Expand Down Expand Up @@ -129,7 +129,7 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)
batched_commitment_unshifted = commitment1 * rhos[0] + commitment2 * rhos[1];
batched_commitment_to_be_shifted = commitment2 * rhos[2];

auto prover_transcript = BaseTranscript<Fr>::prover_init_empty();
auto prover_transcript = BaseTranscript::prover_init_empty();

auto gemini_polynomials = GeminiProver::compute_gemini_polynomials(
mle_opening_point, std::move(batched_unshifted), std::move(batched_to_be_shifted));
Expand Down Expand Up @@ -162,7 +162,7 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)

IPA::compute_opening_proof(this->ck(), shplonk_opening_pair, shplonk_witness, prover_transcript);

auto verifier_transcript = BaseTranscript<Fr>::verifier_init_empty(prover_transcript);
auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);

auto gemini_verifier_claim = GeminiVerifier::reduce_verification(mle_opening_point,
batched_evaluation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template <typename Curve> class KZG {
static void compute_opening_proof(std::shared_ptr<CK> ck,
const OpeningPair<Curve>& opening_pair,
const Polynomial& polynomial,
BaseTranscript<Fr>& prover_trancript)
BaseTranscript& prover_trancript)
{
Polynomial quotient(polynomial);
quotient[0] -= opening_pair.evaluation;
Expand All @@ -53,9 +53,7 @@ template <typename Curve> class KZG {
* - P₀ = C − v⋅[1]₁ + r⋅[x]₁
* - P₁ = [Q(x)]₁
*/
static bool verify(std::shared_ptr<VK> vk,
const OpeningClaim<Curve>& claim,
BaseTranscript<Fr>& verifier_transcript)
static bool verify(std::shared_ptr<VK> vk, const OpeningClaim<Curve>& claim, BaseTranscript& verifier_transcript)
{
auto quotient_commitment = verifier_transcript.template receive_from_prover<Commitment>("KZG:W");
auto lhs = claim.commitment - (GroupElement::one() * claim.opening_pair.evaluation) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ TYPED_TEST(KZGTest, single)
auto opening_pair = OpeningPair<TypeParam>{ challenge, evaluation };
auto opening_claim = OpeningClaim<TypeParam>{ opening_pair, commitment };

auto prover_transcript = BaseTranscript<Fr>::prover_init_empty();
auto prover_transcript = BaseTranscript::prover_init_empty();

KZG::compute_opening_proof(this->ck(), opening_pair, witness, prover_transcript);

auto verifier_transcript = BaseTranscript<Fr>::verifier_init_empty(prover_transcript);
auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
bool verified = KZG::verify(this->vk(), opening_claim, verifier_transcript);

EXPECT_EQ(verified, true);
Expand Down Expand Up @@ -109,7 +109,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)
batched_commitment_unshifted = commitment1 * rhos[0] + commitment2 * rhos[1];
batched_commitment_to_be_shifted = commitment2 * rhos[2];

auto prover_transcript = BaseTranscript<Fr>::prover_init_empty();
auto prover_transcript = BaseTranscript::prover_init_empty();

// Run the full prover PCS protocol:

Expand Down Expand Up @@ -154,7 +154,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)

// Run the full verifier PCS protocol with genuine opening claims (genuine commitment, genuine evaluation)

auto verifier_transcript = BaseTranscript<Fr>::verifier_init_empty(prover_transcript);
auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);

// Gemini verifier output:
// - claim: d+1 commitments to Fold_{r}^(0), Fold_{-r}^(0), Fold^(l), d+1 evaluations a_0_pos, a_l, l = 0:d-1
Expand Down
Loading

0 comments on commit 92ebdbb

Please sign in to comment.