-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
Implement CoinJoin preauthorization and siging flow #1127
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.
unrelated to preauthorization: i'm wondering if change detection and friends shouldn't also be part of the approver?
overall looks good, I have some minor style comments and some questions
also let's think of some unit tests for all this? |
I had the same thought, but it would mean that then we should make the |
I think the device tests currently test the most important stuff, like that the fees get subtracted from the authorized amount and even the fair sharing of mining fees. So that seems pretty sufficient. I wouldn't want to go all out on testing everything there is to test at the moment, because I don't think the the transaction checks are set in stone yet. I wouldn't be surprised if we tweaked and revised them as the integration of the CoinJoin feature develops. |
i think some very basic tests for the Authorization object in separation would be good, and for the Approvers as well; basically functioning as smoke tests plus the place to put more extensive checks and/or regression tests in the future. I also think that with the approvers, it would be good to move out some parts of the existing |
This is a reasonable basis - worth writing down somewhere, I think |
Added a comment: de34cf9. |
LGTM on existing code now, all that remains is some basic unit tests (see #1127 (comment)) |
e13abfc
to
fef6937
Compare
@matejcik, I added basic unit tests for |
…icApprover class.
… the user's outputs a gain in anonymity.
a0069ea
to
225ca32
Compare
This is fantastic - thanks and congrats!! FYI...
In fact, this happens rather often, specifically when there is more than one user of the first CoinJoin registering to remix in the second CoinJoin. The input value of these users is equivalent, because it comes from the same CoinJoin, and their change output is equivalent too, as the equal denomination in the second CoinJoin is the same for them too. |
This PR implements #1053 and replaces the draft PR #1094.
The implementation enables the following flow:
AuthorizeCoinJoin
message. The parameters for user approval include:i. Client sends a
DoPreauthorized
message (no parameters).ii. If there is an active authorization, then the client receives a
PreauthorizedRequest
message from the device, otherwiseProcessError
.iii. Client sends the desired command and communication continues as usual for that command.
At most one authorization per session is allowed to exist at any one time. If a new authorization is confirmed, it replaces any previous one. Multiple authorizations are currently possible by having them in different sessions. The
DoPreauthorized
flow can be performed multiple times for one authorization. It supports two commands:GetOwnershipProof
:user_confirmed
bit can and should be set to True, indicating that the user confirmed participation in any CoinJoin round organized by the given coordinator.SignTx
:nLockTime
.Further notes:
AuthorizeCoinJoin
message processing. If a non-standard chain value is used in the BIP32 path, then theSignTx
request will be declined. Once we have a final decision on the paths we will be using for CoinJoin, the code should be updated to take that into account.CancelAuthorization
message (without parameters) to the management messages.AuthorizeCoinJoin
message would need to return an authorization ID. Currently it returnsSuccess
, which only has a stringmessage
parameter.