-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix MultiSigner, simplify tests #2033
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.
|
Also included in #2028 |
adc92d5 to
7b690c8
Compare
node/cli/src/chain_spec.rs
Outdated
| sr25519::Pair::from_string(&format!("//{}", seed), None) | ||
| .expect("static values are valid; qed") | ||
| .public() | ||
| .unchecked_into() |
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.
unchecked_into is semantically unsafe, so shouldn't be in any production code. though it's kind of safe here, i'd prefer to use a real .into() since we are after all converting between two strong types.
node/executor/src/lib.rs
Outdated
| let key = AccountKeyring::from_public(&signed).unwrap(); | ||
| let signature = payload.using_encoded(|b| { | ||
| let key = AccountKeyring::from_h256_public(signed.clone().into()).unwrap(); | ||
| let signature = UncheckedFrom::unchecked_from(payload.using_encoded(|b| { |
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.
would prefer to keep strong types here, too.
node/executor/src/lib.rs
Outdated
| let payload = (index.into(), xt.function, era, GENESIS_HASH); | ||
| let key = AccountKeyring::from_public(&signed).unwrap(); | ||
| let signature = payload.using_encoded(|b| { | ||
| let key = AccountKeyring::from_h256_public(signed.clone().into()).unwrap(); |
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.
converting via H256 kills semantics. this stuff should retain strong typing as before.
gavofyork
left a comment
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.
A few instances where type-unsafety is being created.
|
I've removed |
|
There's not much point using |
|
@gavofyork so current code is cheating a bit cause it uses
I can implement the second option, cause I till believe this PR is worth merging, since it simplifies a bunch of code where we create transactions and uses the |
|
The extra 84 lines and semantic clutter (additional I would be ok with a PR that purely made |
|
@gavofyork is there any chance that this could be merged soon? It might be a substantial help for BABE, which uses sr25519 everywhere. |
|
I'll take another shot on this (from scratch) |
a728a7c to
bdd4636
Compare
node/runtime|
Ok, current approach fixes |
|
I'd really like to have a way to write some test and make sure that |
|
@demimarie-parity How exactly did you expect this PR to help you with |
|
Just fyi, schnorrkel 0.2's This should make batch verification of AnySignature's possible. |
* Fix MultiSigner, use `into_signed_tx` * Rebuild.
Related #2022
Uses
AnySignaturefornode/runtimeandMultiSignaturefortest-runtime.Superceded by #2028