This file contains hidden or 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
| <img src="https://lcamel.github.io/LCamel-Notes/LazyTower/level_digests.png" width="431px"> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |