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] Incorrect spendable amount after melting (a meltable) CAT #17727

Closed
DrakoPensulo opened this issue Mar 18, 2024 · 6 comments · Fixed by #17764
Closed

[Bug] Incorrect spendable amount after melting (a meltable) CAT #17727

DrakoPensulo opened this issue Mar 18, 2024 · 6 comments · Fixed by #17764
Assignees
Labels
bug Something isn't working

Comments

@DrakoPensulo
Copy link

What happened?

The CAT coin which is melted is not marked as spent by the wallet. To reproduce do the following steps (on Testnet11).

  1. Mint a meltable CAT (for example this one ZerosTokenT11.clsp) with the CAT-admin-tool
    use the command
    cats --amount 1000000000 --fee 1000000000 --send-to txch1___YOUR___ADDRESS___HERE_ --tail 'ff02ffff01ff02ffff03ff2fffff01ff02ffff03ffff22ff0bffff09ffff11ff80ff2f80ff81bd8080ffff01ff04ffff04ff0cffff04ff0aff808080ff8080ffff01ff08ffff018c4472616b6f50656e73756c6f8080ff0180ffff01ff04ffff04ff08ffff04ff0eff808080ff808080ff0180ffff04ffff01ffff5753ff8304ef818407bfab2dff018080' --solution '()'
    That command gives
Testnet 0000... Zeros (T0000):
   -Total Balance:         1000000.0  (1000000000 mojo)
   -Pending Total Balance: 1000000.0  (1000000000 mojo)
   -Spendable:             1000000.0  (1000000000 mojo)
   -Type:                  CAT
   -Asset ID:              0000000062fccdc5df5dc44770a614f85154c27298e22bdcedbcb76af5056e5c
   -Wallet ID:             2

The coins in the CAT wallet are

Confirmed coins:
Coin ID: 0x0280518fc2bea9491e4e93cad33ad0ff5529309b8be12be236005387ac65ba67
        Address: txch1cfzql0skuvmj7tfckhref78vz30j9tytjjrshktkfcupz9guypssmq2dh0 Amount: 1000000.000000000000  (1000000000 mojo), Confirmed in block: 507255

(BTW. not that many decimal places needed there)

  1. Melt some amount of that CAT with my fork of the CAT-admin-tool CAT-admin-tool +melting using the command
    cats --amount -200000000 --fee 1000000000 --send-to txch1___YOUR___ADDRESS___HERE_ --tail 'ff02ffff01ff02ffff03ff2fffff01ff02ffff03ffff22ff0bffff09ffff11ff80ff2f80ff81bd8080ffff01ff04ffff04ff0cffff04ff0aff808080ff8080ffff01ff08ffff018c4472616b6f50656e73756c6f8080ff0180ffff01ff04ffff04ff08ffff04ff0eff808080ff808080ff0180ffff04ffff01ffff5753ff8304ef818407bfab2dff018080' --solution '()' --push
    Confirm few times by pressing ENTER and then Y, ENTER
    (note the negative amount above - that means melting negative of that amount)

After that we get.

Testnet 0000... Zeros (T0000):
   -Total Balance:         1800000.0  (1800000000 mojo)
   -Pending Total Balance: 1800000.0  (1800000000 mojo)
   -Spendable:             1800000.0  (1800000000 mojo)
   -Type:                  CAT
   -Asset ID:              0000000062fccdc5df5dc44770a614f85154c27298e22bdcedbcb76af5056e5c
   -Wallet ID:             2

and

Confirmed coins:
Coin ID: 0xd2c0bfcf38e9f6bb54de350335e76f7ca3210639b7adc4dd2feaef0d569634d8
        Address: txch143ul98aqn06u4p24xsz9r94gyd45t4peg6w4dy8vatnxpa95x20sl4zxhe Amount: 800000.000000000000  (800000000 mojo), Confirmed in block: 507296

Coin ID: 0x0280518fc2bea9491e4e93cad33ad0ff5529309b8be12be236005387ac65ba67
        Address: txch1cfzql0skuvmj7tfckhref78vz30j9tytjjrshktkfcupz9guypssmq2dh0 Amount: 1000000.000000000000  (1000000000 mojo), Confirmed in block: 507255

The coin 0x02805.... should not be on the list of unspent coins.

After resyncing the wallet the spendable amount is correct

Testnet 0000... Zeros (T0000):
   -Total Balance:         800000.0  (800000000 mojo)
   -Pending Total Balance: 800000.0  (800000000 mojo)
   -Spendable:             800000.0  (800000000 mojo)
   -Type:                  CAT
   -Asset ID:              0000000062fccdc5df5dc44770a614f85154c27298e22bdcedbcb76af5056e5c
   -Wallet ID:             2

and the list of unspent coins is also correct

Confirmed coins:
Coin ID: 0xd2c0bfcf38e9f6bb54de350335e76f7ca3210639b7adc4dd2feaef0d569634d8
        Address: txch143ul98aqn06u4p24xsz9r94gyd45t4peg6w4dy8vatnxpa95x20sl4zxhe Amount: 800000.000000000000  (800000000 mojo), Confirmed in block: 507296

Version

2.2.1

What platform are you using?

Windows

What ui mode are you using?

GUI

Relevant log output

No response

@DrakoPensulo DrakoPensulo added the bug Something isn't working label Mar 18, 2024
@wjblanke
Copy link
Contributor

Quex, it looks like the melted coin is not being marked as spent. But its correct on the chain obviously? Maybe the hinting is causing issues (like with the originating wallet not picking up new CATs bug from long ago)

@Quexington
Copy link
Contributor

@DrakoPensulo do you see any exceptions or anything peculiar in your logs? The fact that the correct history is picked up on resync suggests to me that something to do with the state effects you have on the wallet in the custom branch is off.

@DrakoPensulo
Copy link
Author

I see nothing peculiar in the logs, only

2024-03-20T13:29:31.741 wallet wallet_server              : WARNING  Banning 93.56.64.235 for 10 seconds
2024-03-20T13:29:31.742 wallet wallet_server              : WARNING  Invalid handshake with peer PeerInfo(_ip=IPv4Address('93.56.64.235'), _port=8444). Maybe the peer is running old software.

what is most likely unrelated (but note the port number while I am on testnet).

Anyway, I have just repeated the steps described above (on a new receive address) and after the first melting the CAT spendable amount was correct. However, after the second and third melting the CAT spendable amount was incorrect.

@Quexington
Copy link
Contributor

Do you have any pending transactions that are still pending after you do all of this?

@DrakoPensulo
Copy link
Author

DrakoPensulo commented Mar 20, 2024

No, there are no pending transactions (at least they are not shown in the GUI).

@Quexington
Copy link
Contributor

Hey @DrakoPensulo #17764 should take care of your issue. It's a bug in our wallet but I would recommend when you are interacting with the wallet the way you are that you push transaction records via the push_transactions endpoint so the wallet can accurately track the state of pending changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants