-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
I suppose We could pass a running hash function state through this boundary, possibly a 203 byte We could simply add a context parameter to Ideally, we should select some fast hash function for hashing large things anyways, probably blake2b or blake2x if we have chacha elsewhere, or maybe kangaroo12 if we want keccek everywhere. We now become free to do On the other hand, alternative implementations suffer from passing a running hash function across the boundary. If they want to provide this call then they would be required to handle the precise internal state of running hash function. If this is a concern, As an aside, if we had unlimited time then STROBE itself provides a perfect interface for being called across boundaries because it's literally one method that does all your normal symmetric crypto operations. In fact, merlin uses STROBE on a Keccek variant, so this remains an option for later, but I donno if STROBE's Keccek variant is the best choice for hashing large amounts of data. I'll note a full STROBE implementation has a slightly more complex internal state than a |
In any case, artificial serialization can always be avoided by hashing data and maybe context inside WASM and calling this |
node/primitives/src/lib.rs
Outdated
use runtime_primitives::generic; | ||
use runtime_primitives::{OpaqueExtrinsic, traits::BlakeTwo256}; | ||
use runtime_primitives::{ | ||
generic, traits::{Verify, BlakeTwo256, Sr25519Signature}, OpaqueExtrinsic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is Sr25519Signature
being imported from traits
submodule of the runtime? Moving it outside (directly imported from runtime_primitives
) seems to take the build error at least a step further toward success.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed that - was just a typo.
The usage expects |
It's fine to treat errors in deserializing a signature as signature verification errors, so It's less ideal treat public key deserialization errors as signature verification errors because they can represent a failure elsewhere.. and sometimes you verify with the same key repeatedly. |
Just to continue that aside: You could alternatively provide only the permutation like keccak in native, except then you'd be calling across the boundary too much. And it'd break optimizations for at least some chacha implementations. You can normally call STROBE's operate only a couple times for whatever your goal is. |
} | ||
/// The Ed25519 keyring. | ||
/// | ||
/// This is deprecated: use `ed25519::Keyring` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there something about this comment not making sense or am I reading it wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also taking the next line of code into account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means: "Don't use Keyring
directly because at some point in the future we'll remove it. Instead use ed25519::Keyring
"
(Buying myself a beer after removing the need to keep those hashes maintained.) |
Co-Authored-By: gavofyork <github@gavwood.com>
while it is still open, we could also add/further discuss a new
|
* first draft of ristretto crypto module paritytech#1685 * adds better comments and code-style * remove the last evil unwrap * remove a mistakenly committed lockfile * add a fresh new lockfile --will probably need a manual merge later * fix an invalid old test vector * Wire in ristretto * Update comment * Fix use. * new Signature type api alias to be compatible with substrate * Add new keyring, fix node executor tests * Bump version. * Remove all hashes. * Update core/primitives/src/sr25519.rs Co-Authored-By: gavofyork <github@gavwood.com> * Revert back to Ed25519 (until JS UI is ready) * Fix test
Alternative to #1706. Closes #1685.
Switch out transaction signing from Ed25519 to Schnorr/Ristretto x25519.
Included in these changes: removal of all hard-coded hashes in the
node-executor
test suite. Yes. That means when you change something in the runtime, you will no longer need to "update the hashes"!@jacogr please let us know once you've managed to integrate the new signing into the JS UI.