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

[Bug Report] Missing Transaction History for RGB Asset Transfers #4

Closed
k0k0ne opened this issue Sep 10, 2024 · 3 comments
Closed

[Bug Report] Missing Transaction History for RGB Asset Transfers #4

k0k0ne opened this issue Sep 10, 2024 · 3 comments

Comments

@k0k0ne
Copy link
Contributor

k0k0ne commented Sep 10, 2024

Description

We've identified two issues with the transaction history recording for RGB asset transfers:

  1. Incomplete transfer records between wallets:
    When transferring assets from Wallet A to Wallet B, only the sender's (Wallet A) transaction history shows the outgoing transfer. The recipient's (Wallet B) history does not reflect the incoming transfer, despite the assets being successfully received.

  2. Missing self-transfer records:
    When a wallet transfers assets to itself, neither the outgoing nor the incoming transaction is recorded in the wallet's history. The balance is updated correctly, but there's no trace of the transfer in the transaction history.

Steps to Reproduce

  1. Run the integration test located at tests/history-missing-bug.rs (Reproducing examples for the unexpected transfer history bug #3)
  2. Observe the output logs for both scenarios

Expected Behavior

  1. Inter-wallet transfers: Both the sender and recipient wallets should have transaction records reflecting the transfer.
  2. Self-transfers: The wallet should record both the outgoing and incoming transactions for self-transfers.

Actual Behavior

  1. Inter-wallet transfers: Only the sender's wallet shows the outgoing transaction. The recipient's wallet history is empty.
  2. Self-transfers: No transaction records are created for self-transfers in the wallet's history.

Additional Information:

  • The transfers are successful, and balances are updated correctly in both scenarios.
  • This issue affects the ability to track and audit asset movements within the system.
@k0k0ne
Copy link
Contributor Author

k0k0ne commented Sep 10, 2024

Log

---- missing_history_bug stdout ----
Starting test: missing_history_bug
starting test services...
waiting for indexer to sync with bitcoind...
wallet dir: "tests/tmp/1bfd3b97"
 keychain 0 .......... keychain 1 .......... keychain 9 ..........wallet dir: "tests/tmp/7acf740f"
 keychain 0 .......... keychain 1 .......... keychain 9 ..........Wallets created: wlt_1 and wlt_2
Initial amount: 100000
 keychain 0 .......... keychain 1 .......... keychain 9 ...........Contract issued - ID: ContractId(Array<32>(338b88a2a45510ca0f820a74af1341203861b91b18a3ba2732802f081134e798)), Interface type: RGB20Fixed
Initial height: 104
Amount  Counterparty    Witness Id
Transfer amount: 200
Invoice created: RgbInvoice { transports: [UnspecifiedMeans], contract: Some(ContractId(Array<32>(338b88a2a45510ca0f820a74af1341203861b91b18a3ba2732802f081134e798))), iface: Some(TypeName("RGB20Fixed")), operation: None, assignment: None, beneficiary: BitcoinRegtest(WitnessVout(Pay2Vout { method: OpretFirst, address: Wpkh(WPubkeyHash(Array<20>(2c640e65f331d9d012d4467ff617415cc2844cc2))) })), owned_state: Amount(Amount(200)), expiry: None, unknown_query: {} }
 keychain 0 .......... keychain 1 .......... keychain 9 ...........transfer txid: "197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98"
Height: 104
 keychain 0 .......... keychain 1 .......... keychain 9 ........... keychain 0 .......... keychain 1 .......... keychain 9 ............ keychain 0 .......... keychain 1 .......... keychain 9 ...........Height: 105
History 1:
Amount  Counterparty    Witness Id
-200,-Sa        none    bc:197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98
Balance 1:
Global:
  spec := (ticker=("NIATCKR"), name=("NIA asset name"), details=~, precision=2)
  terms := (text=("NIA terms"), media=~)
  issuedSupply := (100000)

Owned:
  assetOwner:
    amount=VccFc, utxo=bc:opret1st:197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98:1, witness=Some(Bitcoin(Array<32>(197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98))) # owned by the wallet
    amount=Mcdac, utxo=bc:opret1st:c32dd7038dd14b7de4972d1ec16d93a7cb59b3b28af586dc091ff0ea656bf8df:0, witness=None # owner unknown
    amount=Sa, utxo=bc:opret1st:197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98:0, witness=Some(Bitcoin(Array<32>(197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98))) # owner unknown

Height     Amount, ṩ    Outpoint                                                            
bcrt1q62g5jsuwg3uncu25u22mampvhyague7syggdqy    &9/1
105         99996766    197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98:1


Wallet total balance: 99996766 ṩ
()
History 2:
Amount  Counterparty    Witness Id
Balance 2:
Global:
  spec := (ticker=("NIATCKR"), name=("NIA asset name"), details=~, precision=2)
  terms := (text=("NIA terms"), media=~)
  issuedSupply := (100000)

Owned:
  assetOwner:
    amount=Mcdac, utxo=bc:opret1st:c32dd7038dd14b7de4972d1ec16d93a7cb59b3b28af586dc091ff0ea656bf8df:0, witness=None # owner unknown

Height     Amount, ṩ    Outpoint                                                            
bcrt1q93jque0nx8vaqyk5gellv96ptnpggnxztvwygq    &9/0
105             2000    197b2005e5822d831285cca9e406e5f65c82b48db5c7199bb7f272b69dd16a98:0


Wallet total balance: 2000 ṩ
()


---- self_transfer_example stdout ----
Starting test: self_transfer_example
starting test services...
waiting for indexer to sync with bitcoind...
wallet dir: "tests/tmp/21563e33"
 keychain 0 .......... keychain 1 .......... keychain 9 ..........Wallet created: wlt
Initial amount: 100000
 keychain 0 .......... keychain 1 .......... keychain 9 ...........Contract issued - ID: ContractId(Array<32>(053e1566d7b1cb7e043e835dd57b9683563b0e355424ca19d8b788bafd2df411)), Interface type: RGB20Fixed
Amount  Counterparty    Witness Id
Transfer amount: 300
Invoice created: RgbInvoice { transports: [UnspecifiedMeans], contract: Some(ContractId(Array<32>(053e1566d7b1cb7e043e835dd57b9683563b0e355424ca19d8b788bafd2df411))), iface: Some(TypeName("RGB20Fixed")), operation: None, assignment: None, beneficiary: BitcoinRegtest(WitnessVout(Pay2Vout { method: OpretFirst, address: Wpkh(WPubkeyHash(Array<20>(2bb6bd3344e75ee6eab70dd16fa5c06b3567cbba))) })), owned_state: Amount(Amount(300)), expiry: None, unknown_query: {} }
 keychain 0 .......... keychain 1 .......... keychain 9 ...........transfer txid: "a2eee953dbb1794ae6e9cb0c8b47b3c18c1199913e8883ed345c875ed5bb34f8"
Height: 104
 keychain 0 .......... keychain 1 .......... keychain 9 ............ keychain 0 .......... keychain 1 .......... keychain 9 ............Height after sync: 105
Final History:
Amount  Counterparty    Witness Id
Balance:
Global:
  spec := (ticker=("NIATCKR"), name=("NIA asset name"), details=~, precision=2)
  terms := (text=("NIA terms"), media=~)
  issuedSupply := (100000)

Owned:
  assetOwner:
    amount=Mcdac, utxo=bc:opret1st:dcabd0c11a310ef8a0887a1cc5e83cb6b1b3967dae2bb9f5f0101a3044423c6a:0, witness=None # owner unknown

Height     Amount, ṩ    Outpoint                                                            
bcrt1q9wmt6v6yua0wd64hphgklfwqdv6k0ja60whw06    &9/0
105             2000    a2eee953dbb1794ae6e9cb0c8b47b3c18c1199913e8883ed345c875ed5bb34f8:0

bcrt1q5t6kqnnyzk8cytvedzpdzafher0mrlcxlgkue8    &9/1
105         99996766    a2eee953dbb1794ae6e9cb0c8b47b3c18c1199913e8883ed345c875ed5bb34f8:1


Wallet total balance: 99998766 ṩ
()

@zoedberg
Copy link
Collaborator

This is not an issue of the integration tests so I would move this to https://github.com/RGB-WG/rgb

@zoedberg
Copy link
Collaborator

Closing this in favor of RGB-WG/rgb#252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants