This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/iden3/circomlib/blob/master/circuits/comparators.circom | |
const p = 23; | |
const N = 2; | |
var fp = []; // false positive | |
for (var x = 0; x < p; x++) { | |
fp[x] = []; | |
for (var y = 0; y < p; y++) { | |
fp[x][y] = ' '; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma circom 2.1.4; | |
include "circomlib/multiplexer.circom"; | |
include "circomlib/comparators.circom"; | |
// Pick in[sel] | |
template PickOne(N) { | |
signal input in[N]; | |
signal input sel; | |
signal output out; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% yarn workspace hashtower.sol test | |
Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. | |
--> poseidon-solidity/PoseidonT3.sol:4:1: | |
| | |
4 | library PoseidonT3 { | |
| ^ (Relevant source part starts here and spans across multiple lines). | |
Compiled 3 Solidity files successfully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% yarn workspace hashtower.sol test:coverage | |
Version | |
======= | |
> solidity-coverage: v0.8.2 | |
Instrumenting for coverage... | |
============================= | |
> HashTowerHashChain.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { poseidon } from "circomlibjs"; // 0.0.8 | |
import { poseidon2 } from "poseidon-lite"; // 0.2.0 | |
for (let j = 0; j < 5; j++) { | |
console.time("circomlibjs") | |
for (let i = 0n; i < 10000; i++) { poseidon([i, i + 1n]) } | |
console.timeEnd("circomlibjs") | |
console.time("poseidon-lite") | |
for (let i = 0n; i < 10000; i++) { poseidon2([i, i + 1n]) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lcamel@lcameldeMacBook-Pro POC % time npx mocha test/ContractTest.mjs | |
The Contract | |
add | |
=== i: 0 | |
add: gasUsed: 50266 | |
0n | |
=== i: 1 | |
add: gasUsed: 105620 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://discord.com/channels/943612659163602974/1065263015622090802/1088499598579990589 | |
let f = (x) => 4 * 2**x * 2**(129/4 - x/8) + 2**(129 - x/2); | |
for (let x = 0; x <= 256; x++) { | |
console.log(x, Math.log2(f(x))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% node | |
Welcome to Node.js v16.15.1. | |
Type ".help" for more information. | |
> var a = require("circomlibjs") | |
undefined | |
> a.poseidon_gencontract.createCode(1).length / 2 | |
6858 | |
> a.poseidon_gencontract.createCode(2).length / 2 | |
9756 | |
> a.poseidon_gencontract.createCode(6).length / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let p = 7; | |
for (let a = 0; a < p; a++) { | |
for (let b = 0; b < p; b++) { | |
let arr = []; | |
for (let q = 0; q < p; q++) { | |
for (let r = 0; r < p; r++) { | |
//if (a == (b * q + r) && r < b) arr.push([a, b, q, r]); | |
if (a == (b * q + r) % p && r < b) arr.push([a, b, q, r]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template instances: 88 | |
non-linear constraints: 5128 | |
linear constraints: 0 | |
public inputs: 65 | |
public outputs: 1 | |
private inputs: 81 | |
private outputs: 0 | |
wires: 5238 | |
labels: 20290 |
NewerOlder