Coder Social home page Coder Social logo

daimo-eth / p256-verifier Goto Github PK

View Code? Open in Web Editor NEW
152.0 152.0 29.0 2.32 MB

P256 signature verification solidity contract

Home Page: https://p256.eth.limo

License: MIT License

Solidity 70.41% TypeScript 28.80% Shell 0.23% JavaScript 0.43% CSS 0.13%
p256 signature-verification solidity

p256-verifier's People

Contributors

dcposch avatar doublespending avatar nalinbhardwaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

p256-verifier's Issues

Cheap inversion with 32 bytes helper value

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

Optimization idea: using scaling instead of doubling in Strauss-Shamir

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.

Gas measurement test

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)

Pre-audit checklist

  • Remove all commented-out code from P256Verifier.
  • Clean up code, add thorough inline documentation.
  • Remove reverts. EIP-7212 spec always returns 1 or 0, never reverts.
  • Combine test vectors in a clean JSON file. Use in forge test.
    • Wycheproof vectors
    • Sage vectors
    • others?
  • Measure branch coverage
  • Measure gas cost
  • Deploy on Base Goerli
  • Test in Daimo via 4337 contract account

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.