Skip to content

Instantly share code, notes, and snippets.

View enricobottazzi's full-sized avatar
😶‍🌫️

enrico.eth enricobottazzi

😶‍🌫️
View GitHub Profile

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:e5bf1d674a5458c1d950e79c5a140a69";

@enricobottazzi
enricobottazzi / rust_profiling.md
Last active August 31, 2023 13:38
Profiling In Rust

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:1687b3393262984ed9c46f8146e5ae90";

@enricobottazzi
enricobottazzi / calldata.txt
Created June 29, 2023 13:32
solvency-calldata
calldata: (Bytes(0x1b531702eb8124c58c0691d2b5293d41d6f86eda516a14629af3304a69dee6121f41a2f37101cc5c7141cb4d5111aeebb7482efc7dc0d9c2930ad4849ed3012528594c3ac2e2852d9fcae5c092d9747875e7587f5875184b263a158d9b93d3da21f854d412bef9ff730c023e33e73c96149b2cbcd6a64b94719bb7778ab91a4126eb960525dd35e31c736de87cc993458883224801ec059db2a1866b17208f822328136b19d4231f4f4ef53eaf4b55f4438da656c48a5a998821217b7329074a16e2089f730191067b45f23fa546aa2b9170675a72ca91a52443978dee507b20150b7153f947eaf9945d31c112a9d33c15c0299904f36a8f6f30d61ece884615114fb5df0268a0555777ec236c1b447009fc21c9e4f46bb40bd4386066f9a86c2f5df3f2ad11dd2756c25af2b80b811c9a39ebe822173ed0ef6574f966bcccc514b98dd8da5672337f345297f1b09275f0b367b59bb8797134593a90eb3e939820ca20fa72be051f47e8033d0e3477efe4de3574046cadc3ae24012ce1874648193adfd7da3e5fdd62d8d923be6dd3076663d6cf96ebc4dcf47d60cba70492ef1654326fe57ff5c91cc697738b8b9ab3a316659f9c5561c968f28951670fc8d31151888eef09ce7feed2b7af2bba339aa76bca36a6e32d646415e448ab55dd4513d8c3c78f53dae778f3e7234bc3add935fe020397f0
object "plonk_verifier" {
code {
function allocate(size) -> ptr {
ptr := mload(0x40)
if eq(ptr, 0) { ptr := 0x60 }
mstore(0x40, add(ptr, size))
}
let size := datasize("Runtime")
let offset := allocate(size)
const { ethers } = require("ethers");
async function sign(privKey, message) {
// Create a Wallet instance
const wallet = new ethers.Wallet(privKey);
// Sign the message
const signature = await wallet.signMessage(message);
pragma circom 2.1.2;
include "circomlib/comparators.circom";
template VarSubarray(n) {
signal input in[n];
signal input start;
signal input end;
signal output out[n];
pragma circom 2.1.2;
include "circomlib/comparators.circom";
template VarSubarray(n) {
signal input in[n];
signal input start;
signal input end;
signal output out[n];
@enricobottazzi
enricobottazzi / test.js
Created January 5, 2023 11:12
Test for range-check.circom
const path = require("path");
const {assert} = require("chai");
const wasm_tester = require("circom_tester").wasm;
const Scalar = require("ffjavascript").Scalar;
exports.p = Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617");
describe("Tree Testing", function async() {
beforeEach(async function () {
@enricobottazzi
enricobottazzi / range-check.circom
Created January 5, 2023 11:11
Circuit to test Range Check Overflow
pragma circom 2.1.0;
include "node_modules/circomlib/circuits/bitify.circom";
template Example () {
signal input a;
log(a);
// prevent overflow of leafSum