daimo-eth / p256-verifier Goto Github PK
View Code? Open in Web Editor NEWP256 signature verification solidity contract
Home Page: https://p256.eth.limo
License: MIT License
P256 signature verification solidity contract
Home Page: https://p256.eth.limo
License: MIT License
Alongside with pubkey and signature transaction caller may provide an inverted value then we can check the inversion (a * a_inv == 1) mod n
. So that modexp call can be skipped
you could differentially fuzz the code vs native code w/ ffi https://book.getfoundry.sh/forge/differential-ffi-testing
Seems worth adding fuzzing against popular implementations like noble/subtlecrypto in future.
from @gakonst
Instead of doubling at each index of the loop, for the bits that are 0 in both u and v we can skip over them while incrementing some counter. When we encounter the next non-zero bit (or the end of the loop), we can perform a single scaling of 2^(counter) on the running sum point. Should reduce cost since scaling can be implemented more gas efficiently than (counter) doubles.
Don’t see other implementations do this probably because scaling cost is close enough in real CPU cycles to double and add, but our use case of Solidity would see improvements I believe.
Add a test that measures gas usage of our implementation and FCL’s implementation.
To match real world use cases exactly, generate 100 random privkeys and 100 random signatures from each. Measure gas used by both implementations and output mean median etc of usage (note that both implementations should have same compilation settings etc)
forge test
.
seems running CREATE2 in tests generates a different address. Worth investigating in more detail but I suspect it's a Foundry bug as we discussed. Maybe we should just pull this out into its own issue for future?
Originally posted by @nalinbhardwaj in #21 (comment)
requires pulling an implementation of sha3 in generate.ts
script
couldn't find any online ATM, worst case we could automate selenium or something to generate a large amount ourselves.
cool down the line thing
Clarify and mention normalization
Using IR==true in toml crushes FCL performances, leading to incorrect bench.
Provide benchmarks in line with on chain performances:
https://goerli.basescan.org/address/0xe9399d1183a5cf9e14b120875a616b6e2bcb840a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.