Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ed25519 signature verification (e.g. Tendermint block headers) #755

Closed
ethanfrey opened this issue Jan 27, 2021 · 3 comments · Fixed by #771
Closed

Support ed25519 signature verification (e.g. Tendermint block headers) #755

ethanfrey opened this issue Jan 27, 2021 · 3 comments · Fixed by #771

Comments

@ethanfrey
Copy link
Member

Part of #751
Follow same steps as #752

Add a function verify_ed25519() to MockApi to verify ed25519 signatures. This should take the raw pubkey and signature bytes as used in tendermint core to sign blocks.

There seems to be much more standardization in ed25519, so we hopefully only need this one variant, not 3 different encodings as with secp256k1 (cosmos, ethereum, bitcoin).

@ethanfrey
Copy link
Member Author

ethanfrey commented Feb 2, 2021

As mentioned in #751 (comment) let us add a batch verify here as well.

It should be something like batch_verify(message: &[u8], pubkeys: &[&[u8]], signatures &[&[u8]]) -> Vec<bool> or bool (either return results of which ones are valid, or just if all are valid.

pubkeys and signatures are both N elements long (must be the same). If the return value is Vec<bool>, it must also be N elements long. Do we send the original message or the message hash like with secp256k1? I guess that is the same as whatever you do for the single verify function (which should be done first).

@ethanfrey
Copy link
Member Author

Request was to use https://crates.io/crates/ed25519-zebra that implements this
This is also planned for CosmJS support: cosmos/cosmjs#584
And is the 100% compatible crate for tendermint now: tendermint/tendermint#5632

@maurolacy maurolacy self-assigned this Feb 9, 2021
@webmaster128 webmaster128 changed the title Implement MockApi verification for ed25519 signatures (Tendermint block headers) Support ed25519 signature verification (e.g. Tendermint block headers) Feb 9, 2021
@webmaster128
Copy link
Member

webmaster128 commented Feb 9, 2021

Do we send the original message or the message hash like with secp256k1

Ed25519 supports arbitrary input lengths because the algorithm itself has an internal hashing step. In secp256k1 the input must not exceed 32 bytes. This is why you use an external hashing step. As a consequence, the secp256k1_verify takes a message_hash and ed25519_verify takes a message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants