w3f / schnorrkel

Schnorr VRFs and signatures on the Ristretto group
BSD 3-Clause "New" or "Revised" License
315 stars 94 forks source link

Add test vectors #43

Open Warchant opened 5 years ago

Warchant commented 5 years ago

Please, add test vectors, so other implementers can verify their implementations.

jacogr commented 5 years ago

Verified the 0.8.4 upgrade via these (assuring old compat) for the WASM interface -

https://github.com/polkadot-js/wasm/blob/4a2249a220b4c3e2744c29cee9979c470b11ce42/packages/wasm-crypto/src/sr25519.rs#L144

Additionally there are some more-pedantic e2e tests as well -

https://github.com/polkadot-js/wasm/blob/4a2249a220b4c3e2744c29cee9979c470b11ce42/packages/wasm-crypto/test/all/sr25519.js

The combination of these actually ensured compat with older keypairs, signatures for this specific wrapper.

Warchant commented 5 years ago

@jacogr this The problem is that I will copy these tests into sr25519-crust, and eventually test vectors will change (they already changed at least once after transition from 0.1.0 to 0.8.4). Then, implementers will not know which vectors to use, because implementation(s) are not synchronized.

The best approach is to generate file similar to sign.input of ed25519, and put it somewhere inside repository. Then, this file will be a single source of truth for the test data.

jacogr commented 5 years ago

@Warchant Agree 100%, I think this issue also sums it up https://github.com/w3f/schnorrkel/issues/36 - effectively there the current status is "ok, the time is right now, interfaces are stable, go for it"

So I was not suggesting linking the above is the right long-term solution, just trying to show something that at least helps right at this point in time.

burdges commented 5 years ago

I'm happy for any PRs on this. I'll try to do it myself in the near future if nothing materializes.