-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: force update option for key exchange [master] #8329
Conversation
3eb0000
to
b1c33c4
Compare
b1c33c4
to
0f597c1
Compare
Resolved merge conflicts. Updated Workflow 1 (recommended)
Workflow 2 (fastest, less robust in general if there is a malicious group member)
|
51c6f21
to
68f22f5
Compare
I removed checks from If wallets can enter a state where the post-kex verification message can't be extracted, then malicious users could plausibly claim 'I can't get my post-kex verification message'. |
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.
Nothing critical, just a few questions (that may or may not require changes).
@@ -181,7 +181,8 @@ namespace multisig | |||
* Key aggregation via aggregation coefficients prevents key cancellation attacks. | |||
* See: https://www.getmonero.org/resources/research-lab/pubs/MRL-0009.pdf | |||
* param: final_keys - address components (public keys) obtained from other participants (not shared with local) | |||
* param: privkeys_inout - private keys of address components known by local; each key will be multiplied by an aggregation coefficient (return by reference) | |||
* param: privkeys_inout - private keys of address components known by local; each key will be multiplied by an aggregation |
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.
Pinging @moneromooo-monero some whitespace changes ... allow ?
@@ -199,7 +200,8 @@ namespace multisig | |||
for (std::size_t multisig_keys_index{0}; multisig_keys_index < privkeys_inout.size(); ++multisig_keys_index) | |||
{ | |||
crypto::public_key pubkey; | |||
CHECK_AND_ASSERT_THROW_MES(crypto::secret_key_to_public_key(privkeys_inout[multisig_keys_index], pubkey), "Failed to derive public key"); | |||
CHECK_AND_ASSERT_THROW_MES(crypto::secret_key_to_public_key(privkeys_inout[multisig_keys_index], pubkey), |
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.
Here again.
return true; | ||
} | ||
|
||
bool simple_wallet::exchange_multisig_keys_main(const std::vector<std::string> &args, bool called_by_mms) { | ||
CHECK_MULTISIG_ENABLED(); |
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.
Was CHECK_MULTISIG_ENABLED()
intentionally removed? Its not used in mms_next
.
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.
No, this was a rebase mistake, will fix.
{ | ||
bool ready{false}; | ||
CHECK_AND_ASSERT_THROW_MES(multisig(&ready), "The wallet is not multisig"); | ||
CHECK_AND_ASSERT_THROW_MES(!ready, "Multisig wallet creation process has already been finished"); |
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 was the !ready
check removed? Seems like that should be done, even with the new if
statement below.
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.
Existing multisig wallets (which have ready == true
) have no way to recover the post-kex verification message, which may be needed by other signers even after the local signer has done their post-kex verification round.
@@ -5126,8 +5125,18 @@ std::string wallet2::exchange_multisig_keys(const epee::wipeable_string &passwor | |||
"" | |||
}; | |||
|
|||
// KLUDGE: early return if there are no kex messages and main kex is complete (will return the post-kex verification round | |||
// message) (it's a kludge because this behavior would be more appropriate for a standalone wallet method) | |||
if (kex_messages.size() == 0) |
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 this just to retrieve the post-kex message multiple times or something? Otherwise I don't see why this was added.
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.
Yes, because existing multisig wallets are stuck, unable to complete the post-kex verification round that was added in v0.18 (an oversight in testing the multisig changes).
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.
They aren't guaranteed to be stuck though, right? Seems like this would only happen if other signers lost someone's post-kex message? If that could happen, couldn't any of the steps get stuck? I guess that's why the force option was added?
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.
The post-kex round did not exist before v0.18, and the only way to get a post-kex message right now is from exchange_multisig_keys()
as the output of a kex round (but existing accounts already completed their last kex round without getting a post-kex message).
I guess I am overloading this PR a little so we can fix multisig faster, the post-kex stuff isn't directly related to the force update option. However, you need force updating to get your account past the post-kex step if you aren't able to get post-kex messages from all other group members (which may be the case for old accounts).
@@ -4146,13 +4146,6 @@ namespace tools | |||
er.message = "This wallet is not multisig"; | |||
return false; | |||
} | |||
|
|||
if (ready) |
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 remove this check?
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.
Existing multisig wallets (which have ready == true
) have no way to recover the post-kex verification message, which may be needed by other signers even after the local signer has done their post-kex verification round.
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.
Ok, so the hold up has been me confused by the naming scheme with the post-kex messaging. multisig_kex_rounds_required(...)
appears to be the number of kex messages, not including the "post-round" message to verify that all participants are active. multisig_is_ready()
only returns true after this additional message has been verified.
wallet2::multisig(...)
check calls the first function, which was the source of my confusion in my prior comments. I kept transposing that function call to the latter function. It's also confusing, because there's a sense in which the local wallet truly is ready - this particular wallet can immediately sign valid messages - but it is not certain about the status of the remaining wallets. Ouch, kind of a mess, but I think you've done the a decent job correcting all this.
6b2e453
to
125f093
Compare
Squashed commits |
@tmoravec I would like to include this in the next release, it would be great if you could test this in the next days :) |
Thanks for the reminder, selsta :) . I've added the new parameter to simplewallet to facilitate testing: UkoeHB#4 Trying to follow the Workflow 2, I'm getting an error: It looks like the check EDIT: Here are the commands (on stagenet):
|
// open kex messages | ||
std::vector<multisig::multisig_kex_msg> expanded_msgs; | ||
expanded_msgs.reserve(kex_messages.size()); | ||
|
||
for (const auto &msg : kex_messages) | ||
expanded_msgs.emplace_back(msg); | ||
|
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.
Moved this so expanded_msgs
is defined right before its use.
@tmoravec ok updated to hopefully fix that issue (also added your changes for simplewallet - note that I use the longer I am wondering if removing |
99c9e3d
to
2b6a716
Compare
Now it supports zero arguments and any number of arguments. I can't think of wrong usage that would trigger this generic error. Happy to put it back if we can make up the condition. FWIW There's always
|
I've tested this and it works 👍 . What I did:
Thank you, @UkoeHB ! |
2b6a716
to
4b0785f
Compare
squashed commits |
Motivation
In the default multisig key exchange (account setup) ceremony, every key exchange round requires a message from every signer. That requirement may not be strictly necessary in some real-world use-cases (where it may be safe to assume some or all signers are trustworthy during account setup), so this PR adds an option to 'force-update' key exchange.
Changes
force_update_use_with_caution
flag to themultisig_account::kex_update()
method (it defaults tofalse
). That interface change is propagated up the call stack to theexchange_multisig_keys()
method inwallet2
and the RPC.num_signers - current_round_num
messages from other signers (this is the bare minimum to actually make progress).gen_multisig.cpp
, unit tests, etc.).Future Work
simplewallet
and the MMS don't have an interface for the force update flag (I just defaulted it tofalse
). A future PR can update the interface there if it's desired (@rbrunner7 ).Dangers
The new flag is a foot-gun that can enable the following problems.