-
Notifications
You must be signed in to change notification settings - Fork 20
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
multisig brainstorming #118
Conversation
Codecov Report
@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 68.77% 69.90% +1.12%
==========================================
Files 51 53 +2
Lines 2729 2931 +202
==========================================
+ Hits 1877 2049 +172
- Misses 833 862 +29
- Partials 19 20 +1
Continue to review full report at Codecov.
|
20ca853
to
1ccdf7d
Compare
update: multisig is moved out to an alternative at the transaction structure level, where SignerInfo.public_key is now an enum allowing you to choose between PublicKey and a multisig config. Likewise, UnverifiedTransaction.1 T is now an enum allowing you to choose between Signature and a multisig signature set. we're 🤏 this close to putting "multisig v0" as a signing algorithm next to ed25519 and secp256k1, but not quite. in this state, we can at least use PublicKey and Signature inside the multisig structures without getting all cyclic. this all won't build yet, as I haven't updated the surrounding code |
1ccdf7d
to
b18baba
Compare
update: spreading the changes through the rest of the rust part of the sdk, added a verification routine: check single-key vs multisig consistency -> zip -> extract present signatures for multisig -> bail if weight is below threshold -> flatten public key and signature lists -> call batch verify |
b18baba
to
531270b
Compare
update: adding sanity checker for multisig configurations, based on the oasis-core version. need to add calls to it. |
4b8956f
to
d8ec563
Compare
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.
Don't forget to add #[serde(deny_unknown_fields)]
to all the serializable things.
yup, gotta add that, gotta add renames, gotta add doc comments |
061356e
to
761717b
Compare
opening this for review at this stage. here's the current idea for a data model. some feedback is in already:
we need some discussion on how multisig conceptually fits in to the existing multiple-accounts-i.e.-nonces being able to sign. in this draft it's not anticipated that a principal that has a key should distinguish between signing any specific SignerInfo slot or any specific entry inside a multisig proof. btw, the terminology: 'proof,' as introduced in this PR refers to a generalization of (i) a signature satisfying the authentication requirement of a single-public-key account or a (ii) set of signatures satisfying the authentication requirement of a multisig configuration. also 'config' and 'solo.' let me know your thoughts on this too. and a little weirdness with the encoding of unverified transactions: it's focused on lists that match up one-to-one with the various signer info of the tx, but this results in needing duplicate signatures if the same key would be used in solo and/or multiple multisig proofs. maybe we could flatten and dedup these signatures, if we prefer it that way. it would be more work on the verification side to match them up, maybe. let me know your thoughts on this too |
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.
we need some discussion on how multisig conceptually fits in to the existing multiple-accounts-i.e.-nonces being able to sign.
I guess the use case would be that one account pays for fees and another account authorizes some action?
btw, the terminology: 'proof,' as introduced in this PR refers to a generalization of (i) a signature satisfying the authentication requirement of a single-public-key account or a (ii) set of signatures satisfying the authentication requirement of a multisig configuration. also 'config' and 'solo.' let me know your thoughts on this too.
Yeah auth proof and multisig config seem fine. Added a comment regarding "solo".
and a little weirdness with the encoding of unverified transactions: it's focused on lists that match up one-to-one with the various signer info of the tx, but this results in needing duplicate signatures if the same key would be used in solo and/or multiple multisig proofs. maybe we could flatten and dedup these signatures, if we prefer it that way. it would be more work on the verification side to match them up, maybe. let me know your thoughts on this too
I would rather keep it simple and not dedup.
1431571
to
88af89c
Compare
adding some limits for number of authinfo slots in tx and number of signer slots in multisig config |
0f3d93a
to
5c396bf
Compare
2a5a2eb
to
d50dd17
Compare
d50dd17
to
d2d9513
Compare
a2e312e
to
095a131
Compare
tracking in #141 |
if !si.PublicKey.Equal(pk) { | ||
continue | ||
} | ||
switch { |
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.
Oh I see, so now you sign all the slots that correspond to the signer.
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.
yeah 🤷 the typescript client is different in style
|
||
// Batch checks that enough signers have signed and returns vectors of public keys and signatures | ||
// for batch verification of those signatures. This internally calls `Verify`. | ||
func (mc *MultisigConfig) Batch(signatureSet [][]byte) ([]PublicKey, [][]byte, error) { |
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 not do the actual verification? I'm of mixed opinion if a batch should fail if it as any invalid signatures regardless of threshold or not. The way this is setup right now is an all-or-nothing design as far as I can tell.
(I assume allowing a MultisigConfig with mixed public-key types is deliberate, though this will complicate batch verification logic.)
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.
we'll have to have an additional step to separate the public key types. but are we moving away from batch signature verification in general?
this isn't meant to be all-or-nothing. it'll leave out the nil
s from the signature set (Option in the rust side). we'd advise that the transaction sender nil out invalid signatures on their own and avoid submitting a transaction with some valid and some invalid signatures
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.
I'll open an issue to discuss this
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.
b131bf5
to
62c4901
Compare
outside of cargo fmt's jurisdiction, who knew? Co-authored-by: Jernej Kos <[email protected]>
62c4901
to
9388aa1
Compare
#91 from oasisprotocol/oasis-core#3094
due to scope changes, this will fix #120