-
Notifications
You must be signed in to change notification settings - Fork 2.6k
expose ecdsa_sign_prehashed in sp-io #10119
expose ecdsa_sign_prehashed in sp-io #10119
Conversation
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.
As this is used by offchain workers, I would approve this host function.
/// key type in the keystore. | ||
/// | ||
/// Returns the signature. | ||
fn ecdsa_sign_prehashed( |
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.
Might be worth adding ecdsa_verify_prehashed
for completeness of the API.
AFAICT recover
already takes a hash, so that one should be fine.
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.
Good catch. Added in latest commit.
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.
lgtm! Note this adds new host functions, so it's a breaking change (requires client to be updated first)
Only for clients that also use this function. Aka, Polkadot/Kusama will not require this. |
Actually, polkadot and kusama does pull those, https://github.com/paritytech/polkadot/blob/4fe4d3f9e6efd6607f570094c6872516f54b9549/node/core/pvf/src/executor_intf.rs#L122 IIUC. |
I mean that this isn't used by the Polkadot/Kusama runtime itself. And yes, for Parachains that want to use this, they will need to wait until all validators have upgraded. |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
@dt665m sorry that this was overseen. Could you please merge master? |
…into crypto/expose-ecdsa-sign-prehashed
no worries! Merged, built, and tested locally. |
@dt665m could you please reformat the code using |
done |
* expose ecdsa_sign_prehashed in sp-io * add ecdsa_verify_prehashed to host functions for completeness * cargo fmt
* expose ecdsa_sign_prehashed in sp-io * add ecdsa_verify_prehashed to host functions for completeness * cargo fmt
* expose ecdsa_sign_prehashed in sp-io * add ecdsa_verify_prehashed to host functions for completeness * cargo fmt
Add a new
ecdsa_sign_prehashed
trait function in sp-io's runtime_interface. The currentecdsa_sign
function always hashes with blake2 for ecdsa signatures. Exposing this function opens up new use cases, such as allowing offchain workers to use the keystore to sign ethereum transactions, which uses keccak as the hashing scheme.Related Issue: #10118