Skip to content
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

Tweak CoinJoin transaction checks #1160

Closed
andrewkozlik opened this issue Aug 3, 2020 · 2 comments · Fixed by #2180
Closed

Tweak CoinJoin transaction checks #1160

andrewkozlik opened this issue Aug 3, 2020 · 2 comments · Fixed by #2180
Assignees
Labels
bitcoin Bitcoin related core Trezor Core firmware. Runs on Trezor Model T and T2B1. R&D Research and development team related

Comments

@andrewkozlik
Copy link
Contributor

As the integration of the CoinJoin feature develops we should revise and tweak the rules for CoinJoin transaction validation in Trezor which were implemented in #1127:

  • The implementation assumes standard account paths are being used (purposes 44, 45, 48, 49, 84). If a different purpose value is used in the BIP32 path, then the user will need to explicitly confirm this as part of the AuthorizeCoinJoin message processing. If a non-standard chain value is used in the BIP32 path, then the SignTx 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.

  • Decide what checks should Trezor perform on the transaction. Currently we have the following:

    • All of the user's inputs must come from the approved account path and have the approved script type.
    • All of the user's outputs should go back into the same account the inputs came from, otherwise they are treated as external outputs, i.e. fees.
    • The sum of all fees paid by the user doesn't exceed the authorized limit.
    • The overall mining fee must not exceed the standard threshold for which we would normally show a warning. It might be better to drop this requirement, especially once we have Introduce hard limit on transaction fee (core) #1087.
    • The user must not pay more than the sum of their fair share of the total mining fees and of the coordinator fee at the approved rate per anonymity set. This might need some tweaking to conform with the way Wasabi computes the mining fees, because it apparently counts 67 bytes per input (seems slightly lower than expected), 33 bytes per output (seems slightly higher than expected) and then there are some rules around exempting users who don't have enough change from paying mining fees etc. Also, I am not sure who pays the mining fee share for the coordinator's output. The current implementation effectively assumes it gets deducted from the coordinator's output.
    • The transaction must improve the anonymity of at least one of the user's outputs, i.e. it must have the same denomination as another output which is not owned by the user. Just a basic sanity check.
    • nLockTime must be 0. I don't see a use-case for allowing a non-zero value, but neither do I see any danger in it.
@andrewkozlik andrewkozlik added core Trezor Core firmware. Runs on Trezor Model T and T2B1. bitcoin Bitcoin related enhancement labels Aug 3, 2020
@andrewkozlik andrewkozlik self-assigned this Aug 3, 2020
@prusnak prusnak added this to the 2020-09 milestone Aug 4, 2020
@tsusanka tsusanka modified the milestones: 2020-09, 2020-10 Aug 19, 2020
@tsusanka
Copy link
Contributor

Tokens/credits will alter most of these points so we do not want to deal with this at this moment.

@tsusanka tsusanka modified the milestones: 2020-10, backlog Aug 21, 2020
@tsusanka tsusanka removed this from the backlog milestone Oct 6, 2021
@matejcik matejcik removed the HIGH label Oct 7, 2021
@tsusanka tsusanka added the R&D Research and development team related label Oct 22, 2021
@andrewkozlik
Copy link
Contributor Author

andrewkozlik commented Dec 2, 2021

We will also need to tweak the format of the commitment data in the ownership proofs. Currently we use coordinator URL + round ID, but the WabiSabi backend uses len(URL) + URL + round ID, which is better.

Update: Done in #2122.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bitcoin Bitcoin related core Trezor Core firmware. Runs on Trezor Model T and T2B1. R&D Research and development team related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants