Skip to content

Commit

Permalink
Enable >2^24 Lagrange transcript downloading.
Browse files Browse the repository at this point in the history
Use new monomial transcript00.dat form new folder in s3 bucket.
  • Loading branch information
suyash67 committed Feb 8, 2023
1 parent 2bb5ea0 commit ffa8abd
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 25 deletions.
5 changes: 1 addition & 4 deletions cpp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ build*/
src/wasi-sdk-*
src/aztec/proof_system/proving_key/fixtures
src/aztec/rollup/proofs/*/fixtures
srs_db/ignition/transcript*
srs_db/lagrange
srs_db/coset_lagrange
srs_db/modified_lagrange
srs_db/*/*/transcript*
# to be unignored when we agree on clang-tidy rules
.clangd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pippenger::Pippenger(g1::affine_element* points, size_t num_points)
scalar_multiplication::generate_pippenger_point_table(monomials_, monomials_, num_points);
}

Pippenger::Pippenger(uint8_t const* points, size_t num_points, bool is_lagrange)
Pippenger::Pippenger(uint8_t const* points, size_t num_points, bool)
: num_points_(num_points)
{
monomials_ = point_table_alloc<g1::affine_element>(num_points);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,10 @@ TEST(lagrange_base, verify_lagrange_base_import_srs)
EXPECT_EQ(result, expected);
}

void test_lagrange_transcripts_helper(const size_t degree,
const std::string monomial_path,
const std::string lagrange_path)
void test_lagrange_transcripts_helper(const size_t degree, const std::string path)
{
auto lagrange_reference_string = scalar_multiplication::Pippenger(lagrange_path, degree, true);
auto monomial_reference_string = scalar_multiplication::Pippenger(monomial_path, degree, false);
auto lagrange_reference_string = scalar_multiplication::Pippenger(path, degree, true);
auto monomial_reference_string = scalar_multiplication::Pippenger(path, degree, false);

barretenberg::evaluation_domain domain(degree);
domain.compute_lookup_table();
Expand All @@ -178,8 +176,8 @@ void test_lagrange_transcripts_helper(const size_t degree,

g2::affine_element lagrange_g2x;
g2::affine_element monomial_g2x;
barretenberg::io::read_transcript_g2(lagrange_g2x, lagrange_path, true);
barretenberg::io::read_transcript_g2(monomial_g2x, monomial_path, false);
barretenberg::io::read_transcript_g2(lagrange_g2x, path, true);
barretenberg::io::read_transcript_g2(monomial_g2x, path, false);

EXPECT_EQ(lagrange_g2x, monomial_g2x);
}
Expand All @@ -200,7 +198,7 @@ HEAVY_TEST(lagrange_base, test_local_lagrange_transcripts)
for (size_t i = 0; i < num_files; i++) {
const size_t degree = static_cast<size_t>(1 << (i + 1));
auto begin = std::chrono::steady_clock::now();
test_lagrange_transcripts_helper(degree, "../srs_db/ignition", "../srs_db/lagrange");
test_lagrange_transcripts_helper(degree, "../srs_db/ignition");
auto end = std::chrono::steady_clock::now();

std::cout << "Verified Lagrange transcript of size " << degree << " in "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
TEST(reference_string, mem_file_consistency)
{
std::ifstream transcript;
int NUM_POINTS_IN_TRANSCRIPT = 5040000;
transcript.open("../srs_db/ignition/transcript00.dat", std::ifstream::binary);
int NUM_POINTS_IN_TRANSCRIPT = 5040001;
transcript.open("../srs_db/ignition/monomial/transcript00.dat", std::ifstream::binary);
std::vector<uint8_t> monomials(32768 * 64);
std::vector<uint8_t> g2x(128);
transcript.seekg(28);
Expand Down
4 changes: 3 additions & 1 deletion cpp/srs_db/download_ignition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ set -e

mkdir -p ignition
cd ignition
mkdir -p monomial
cd monomial
NUM=${1:-19}

if command -v sha256sum > /dev/null; then
Expand All @@ -31,7 +33,7 @@ checksum() {
}

download() {
curl https://aztec-ignition.s3-eu-west-2.amazonaws.com/MAIN%20IGNITION/sealed/transcript${1}.dat > transcript${1}.dat
curl https://aztec-ignition.s3-eu-west-2.amazonaws.com/MAIN%20IGNITION/monomial/transcript${1}.dat > transcript${1}.dat
}

for TRANSCRIPT in $(seq 0 $NUM); do
Expand Down
33 changes: 25 additions & 8 deletions cpp/srs_db/download_ignition_lagrange.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Downloads the Lagrange transcripts generated from ignition trusted setup.
#
# To download all transcripts upto 2^{24}.
# To download all transcripts upto 2^{25}.
# ./download_ignition_lagrange.sh
#
# To download select transcripts upto size 2^m,
Expand All @@ -12,9 +12,10 @@
# whatever is requested but does not check the validity of the downloads.
set -e

cd ignition
mkdir -p lagrange
cd lagrange
num_transcripts=${1:-24}
num_transcripts=${1:-25}
ARGS=$(seq 1 $num_transcripts)

checksum() {
Expand All @@ -26,13 +27,29 @@ download() {
curl https://aztec-ignition.s3-eu-west-2.amazonaws.com/MAIN%20IGNITION/lagrange/transcript_${1}.dat > transcript_${1}.dat
}

for TRANSCRIPT in $ARGS; do
NUM=$(printf %2d $((1 << $TRANSCRIPT)))
get_transcript() {
if [ -f checksums ]; then
checksum $NUM && continue
download $NUM
checksum $NUM || exit 1
checksum ${1} && continue
download ${1}
checksum ${1} || exit 1
else
download $NUM
download ${1}
fi
}

for TRANSCRIPT in $ARGS; do
NUM=$(printf %2d $((1 << $TRANSCRIPT)))
get_transcript $NUM

# We need to handle Lagrange transcripts with > 2^24 points differently
# as they're split across multiple transcript files.
if [ $TRANSCRIPT -gt 24 ]; then
diff=$(($TRANSCRIPT - 24))
num_sub_transcripts=$((1 << $diff - 1))
for i in $(seq $num_sub_transcripts)
do
NUM_SUB="${NUM}_${i}"
get_transcript $NUM_SUB
done
fi
done
27 changes: 27 additions & 0 deletions cpp/srs_db/ignition/lagrange/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
227512f4233e1b068e5dbfcf1a7fbb8b03d18050844eec29cb34af283fa6a7c9 g2.dat
22bfbaf553eafc920078b26d41ab93ee1cb6fd333857f6080dd17f669e3f9f9b transcript_2.dat
83954bf47ecadb3bb05d8904fb65bca717d5c29ed55e720dd633a956bf101f8f transcript_4.dat
6caac617d66a61103389e4ff42f282817cb3a5bb42a7ebb7a82193cf87945aca transcript_8.dat
480b03a01fbdff93eff15277092e76d0f96552d7a95a6cf8155db9010e166401 transcript_16.dat
b85e4431eb83c7f09dce2be7da7bc8658565f2d7a49768b9367d2b46b5accc9f transcript_32.dat
5b9f1440bc74dad80865bdce14f0e1a0bf332a8612697a251df28ab018e1d73d transcript_64.dat
0e32cccf645a0f39196bde9df334b6db08249da8ed229049c5823e5ca96eb273 transcript_128.dat
95c99d976f455b555b48fab9dffbead96d21b73222761b1b24f27af82dcb7d16 transcript_256.dat
9b86ec33e7d025f3d72161320dfde80d1b24ff58212276bfc6b64afec0140d92 transcript_512.dat
408e690b0c2eeaea757af1e56388ca98b80edb96a795b6e84447c4711c6acc47 transcript_1024.dat
8a008912a54763e3f4ede6e5e5290c592709ca29f6f01100530fb48f7e6b27b6 transcript_2048.dat
0a691a36c92262677b2fe4416b7570c161b732c73f9083b95821468dbb160d16 transcript_4096.dat
2ad1e2d3ef8a6c4cfea5034903b62d31ed5a8d3234d5465b3463d2e403f5752d transcript_8192.dat
b8a6bf124112e882871a69b2ee1065c3b384ffc920af56edcc8475a7a8432d86 transcript_16384.dat
f7e22fd549bab9e669405fc7146630c688a87ea52ba5574d7c55db4ecb5f6b27 transcript_32768.dat
37dee3a7e792c211b2acfc767f24700044ae311756e4328306071ce410fa2f08 transcript_65536.dat
9caa2c2ff519cc4afd9b1e8865a604669f31026766c2fa24f7c29a113aa14c8c transcript_131072.dat
9e72008d43dda29e13bfd7c84044063f91a31e418a609ed4678b80815252282f transcript_262144.dat
53b8137464da802eec2acc637335be965c449d81ac415ad42c250cba7e0364c7 transcript_524288.dat
0a87714dbb5bba388eeb085c2eb6744215a5b48835a192a1a485c7e00ac763ce transcript_1048576.dat
8bc47bb1e36b5aea7a4a3d30c7c3c32529f5c4fb29dd8f906b3c17bfacf34ab6 transcript_2097152.dat
9b82696d6dbaf95cce3f5e2dcf04d83dd82987cdd84cbbf3a6ff8e42d6ae7c9e transcript_4194304.dat
06ed904322d468ae2412be7ee482b9149968627a21d592861d2c415051479be7 transcript_8388608.dat
998238ccac69a20620793a1a13cc43d4706c4859f2f5576ca29c645a9d2e666b transcript_16777216.dat
e3e1de0a97a6cd50a3959c795edd97253641621f867895199fca6b6852f22941 transcript_33554432.dat
6b580183d05b650517567b9c196ccec83f86bdefea021cbe885122ff41dda97a transcript_33554432_1.dat
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
227512f4233e1b068e5dbfcf1a7fbb8b03d18050844eec29cb34af283fa6a7c9 g2.dat
af247f77ebe9382c5ade03349737b651550a3548a78f49cddd27027f2b0df389 transcript00.dat
0f94b39426f5a57d1a17742624f7d3170a32e19d6c5e16f202281439dbe48695 transcript00.dat
fe8919733b0ef279d31787f2c80e67a014dc50ad2790640157a7d411307784a3 transcript01.dat
0602f52fa0dd81a26cc5e1db5c068caf49118c30921238f41d8d16169041e15f transcript02.dat
b02f5c2b6d6017f90f3389ba2796465a11f582b49bbc900e76583a64bc8b32a5 transcript03.dat
Expand Down
1 change: 1 addition & 0 deletions cpp/srs_db/ignition/monomial/g2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~#쓈���YD;2��������N�ո7��N�0������Q�z5����NX���&�Q��DžJ����^U��?��΢VG[B�a^"�����c*�A<��j_��FA����QV���r��ci��

0 comments on commit ffa8abd

Please sign in to comment.