GithubHelp home page GithubHelp logo

Comments (5)

prestwich avatar prestwich commented on July 17, 2024 1

After some discussion, we decided on:

  1. Adapt the precompile to accept arbitrary-length messages.
    • func Verify(msg []byte, pubkey [32]byte, signature [64]byte) uint32
  2. Modify the serialized precompile input format to include 1 variable-length argument (the message)
    • serialized format to be defined as pubkey || signature || message where || is concatenation
  3. Modify gas costs to account for the internal sha-512

This should preserve full compatibility with other PureEdDSA and HashEdDSA implementations

from celo-proposals.

mkaczanowski avatar mkaczanowski commented on July 17, 2024 1

FYI: I've just published the initial PR

from celo-proposals.

prestwich avatar prestwich commented on July 17, 2024

If I recall correctly, ed25519 specifies sha2-512 (64-byte messages) while the proposal specifies 32-byte messages. For full compatibility with the ed25519 spec

  1. Should message size be 64 (and support a 32-byte operating mode)?
  2. Should CIP-20 add support for sha2-512?

from celo-proposals.

prestwich avatar prestwich commented on July 17, 2024

Went and reviewed RFC 8032. It looks like this is the prehash function PH(M) (see section 4). We do not need to support PureEdDSA, and for HashEdDSA the prehash can be parameterized by any collision-resistant hash function. I guess the question then is whether common cryptographic protocols we want to verify use 64-byte hashes. What does Cosmos use?

from celo-proposals.

prestwich avatar prestwich commented on July 17, 2024

ah hmm. I guess that I had been thinking of this as a Raw verify function func VerifyRaw(msgHash []byte, pubkey [32]byte, signature [64]byte) uint32 where msgHash is almost always 32 or 64 bytes. Edit: Apparently this concept doesn't precisely apply to EdDSA because it always uses sha512 internally

Currently as specced it's Verify(msg [32]byte, pubkey [32]byte, signature [64]byte) uint32. This results in the 32 byte message being hashed with Sha512 again in the eddsa library I believe. This would create compatibility issues with almost any use case (including cosmos-sdk, I believe) so it seems like we'll want to switch to the raw variant 🤔

from celo-proposals.

Related Issues (20)

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.