Merging account with trustlines
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- blockchain
Research direction
Start by reviewing the accountMerge, payment, and change trust operations described in the issue, then read the comment thread for discussion of the two proposed solutions. Done would require a settled protocol design for handling non-native trustline assets during account merging, rather than an isolated code change.
Written by the indexing model from the issue text.
Description
In order to merge an account that has a trustline first the following operations need to be executed:
- a payment operation that transfers the remaining balance of the trusted asset to some other account
- a change trust operation to remove the trustline
Certain smart contract schemes (such as payment channels) involve refund transactions for escrow accounts that are created and signed well before they are submitted on chain. If such a scheme deals with an assets different from the native asset, then these refund transactions need to contain the following operations (as stated above):
- a payment operation to clear the balance of that asset
- remove the trustline of that asset
- merge account
The refund transaction will fail if the payment operation does not contain the correct balance of the trusted asset at the time the transaction is submitted. Since the refund transaction is created and signed a long time before, this would allow an attacker to invalidate the transaction by sending a single stroop of the trusted asset to the escrow account before the refund transaction is submitted.
A workaround would be to always set the trust limit of the asset to the current balance on the account. However, this has some downsides – e.g., topping up a payment channel would not be possible.
We propose any of the following solutions:
- Extend the accountMerge operation: if the account to be merged has trustlines and the account to be merged into has the same trustlines, then merge all assets into the latter account.
- Add a "merge asset" operation that behaves like a payment operation but does not specify an amount – it will transfer the complete remaining amount of the specified asset on the source account instead.
- Dominant language
- RPC
- Stars
- 632
- Forks
- 399
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-protocol
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
stellar/stellar-protocol#2010 ·
-
stale
Difficulty 5/5 Over a week Newbie friendliness 42/100
stellar/stellar-protocol#1928 · 6 comments ·
-
needs draft SEP
stellar/stellar-protocol#773 · 12 comments · 1 assignee ·
-
help wanted needs draft SEP
Difficulty 5/5 Over a week Newbie friendliness 25/100
stellar/stellar-protocol#316 · 4 comments ·
-
CAP enhancement needs draft
Difficulty 5/5 Over a week Newbie friendliness 35/100
stellar/stellar-protocol#296 · 2 comments · 2 reactions ·
All issues in stellar/stellar-protocol
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
rust-bitcoin/rust-bitcoin#6908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Merit-Systems/x402scan#1215 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Uniswap/default-token-list#2585 ·