Skip to content

Instantly share code, notes, and snippets.

Avatar

Zachary James Williamson zac-williamson

View GitHub Profile
View mul_with_floats.cpp
// requires barretenberg numeric dependency
#include <stdio.h>
#include <math.h>
#include <inttypes.h>
#include <x86intrin.h>
#include <stdlib.h>
#include <numeric/random/engine.hpp>
namespace {
View lagrange-base-srs.md

Lagrange-base SRS

Our current reference string is in monomial form, having one in lagrange-base form would singificantly improve prover times.

In Barretenberg, our current reference string is interacted with via the io class.

The SRS is contained in srs_db/transcript.dat. It is stored in a raw binary format, with group elements packed into adjacent 64 byte chunks.

The transcript.dat file contains a 'manifest' object at the start of the file, which contains basic details like the SRS size.

View find_roots_of_unity.js
const crypto = require('crypto');
const BN = require('bn.js');
const p = new BN('30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001', 16);
const pRed = BN.red(p);
function randomGroupScalar = () => {
return new BN(crypto.randomBytes(32), 16).umod(p);
}
View find_roots_of_unity.js
const crypto = require('crypto');
const BN = require('bn.js');
const p = new BN('30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001', 16);
const pRed = BN.red(p);
function randomGroupScalar = () => {
return new BN(crypto.randomBytes(32), 16).umod(p);
}
View parity_benchmarks_07_Jun_19_ZW
running 316 tests
test block::tests::enact_block ... ignored
test block::tests::enact_block_with_uncle ... ignored
test block::tests::open_block ... ignored
test builtin::tests::bn128_add ... ignored
test builtin::tests::bn128_mul ... ignored
test builtin::tests::bn128_pairing_empty ... ignored
test builtin::tests::bn128_pairing_fragmented ... ignored
test builtin::tests::bn128_pairing_notcurve ... ignored
test builtin::tests::ecrecover ... ignored
@zac-williamson
zac-williamson / benchmark.md
Last active Dec 3, 2020
Result of parity benchmarks after `pairing_batch`, `precompute` and `miller_loop` optimizations
View benchmark.md

03 May 2019, Updated Parity Benchmarks

These Parity client benchmarks were run to evaluate the optimizations made to the Parity bn pairing library (link here)

By comparing pre- and post- benchmarks there is a significant improvement to the speed of multiple bilinear pairings that merits a reduction in the gas schedule.

The new benchmarks were run on branches that are currently outstanding pull requests into the Parity client (https://github.com/paritytech/parity-ethereum/pull/10624) and the BN library (https://github.com/paritytech/bn/pull/14).

The previous benchmarks were computed on 25 Oct 2018

View Weierstrudel.js
/* global expect, contract, beforeEach, web3, it:true */
const EC = require('elliptic');
const BN = require('bn.js');
const crypto = require('crypto');
const Weierstrudel = require('../out/Weierstrudel');
const Monty = require('../out/Monty');
const weierstrudelContract = new web3.eth.Contract(Weierstrudel.abi);
const montyContract = new web3.eth.Contract(Monty.abi);