-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add Require Spend Subaddress #989
Conversation
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #989 +/- ##
==========================================
- Coverage 60.12% 55.61% -4.51%
==========================================
Files 88 124 +36
Lines 12356 16290 +3934
Branches 2010 2796 +786
==========================================
+ Hits 7429 9060 +1631
- Misses 3238 5145 +1907
- Partials 1689 2085 +396 ☔ View full report in Codecov by Sentry. |
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.
All the initial pass plumbing for subaddress_to_spend_from and subaddress_to_spend_from_mode looks good.
The description says that the PR "Adds logic to enforce building a transaction with an account with this enabled or not uses the correct params". But I'm not seeing the code that implements that logic. Maybe I'm missing it somehow. If not, should it be part of the PR?
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
full-service/migrations/2024-05-21-035622_subaddress-only-account/down.sql
Show resolved
Hide resolved
...son_rpc/v2/e2e_tests/transaction/build_submit/build_and_submit_with_spend_from_subaddress.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
...son_rpc/v2/e2e_tests/transaction/build_submit/build_and_submit_with_spend_from_subaddress.rs
Outdated
Show resolved
Hide resolved
@sugargoat I like the renaming, and while we are at it, what about if we make it:
This would be consistent and concise. If you are ok with this, I'd be happy to do the search-replace and push a commit. |
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.
Renaming and init defaults look good to me!
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.
Everything looks good, just need:
- The build_unsigned_transaction @holtzman mentioned
- Be sure we want to prevent one from spending from a subaddress if the account is not a require subaddress spend
...son_rpc/v2/e2e_tests/transaction/build_submit/build_and_submit_with_spend_from_subaddress.rs
Outdated
Show resolved
Hide resolved
...son_rpc/v2/e2e_tests/transaction/build_submit/build_and_submit_with_spend_from_subaddress.rs
Outdated
Show resolved
Hide resolved
...son_rpc/v2/e2e_tests/transaction/build_submit/build_and_submit_with_spend_from_subaddress.rs
Outdated
Show resolved
Hide resolved
...son_rpc/v2/e2e_tests/transaction/build_submit/build_and_submit_with_spend_from_subaddress.rs
Outdated
Show resolved
Hide resolved
No worries - happy to get the renaming in order! |
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
…pe, and clean up tests Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
Signed-off-by: sugargoat <sugargoat@mobilecoin.com>
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.
Looks good. Thanks!
Motivation
We would like to provide a guard rail for the use of subaddress_to_spend_from, so that an account can enforce that transactions using the Txos within the account adhere to the scheme of spending from any Txo regardless of which subaddress it was sent to (the turnstile model), or requiring that a subaddress to spend from is always specified (so the Txos don’t get mixed together and create inconsistent subaddress balances)
In this PR
require_spend_subaddresses
to the Account db as bool columnrequire_spend_subaddresses
to the APIs for create and import accountsubaddress_to_spend_from
tospend_from_subaddress
for brevity & clarityspend_from_subaddress
to correctly initialize the account withrequire_spend_subaddress
Test Plan
spend_from_subaddress
testsAdd new unittests for require subaddress functionality inGoing with minimum viable e2e testingtransaction
serviceFuture Work
--strict-params
mode to prevent misspellings from accidentally omitting the parameter