lightninglabs / taproot-assets

A layer 1 daemon, for the Taproot Assets Protocol specification, written in Go (golang)
MIT License
463 stars 111 forks source link

[bug]: Unable to send+receive assets. Getting [ERR] GRDN: unable to recv proof: rpc error: code = Unknown desc = no universe proof found #601

Closed snow884 closed 1 year ago

snow884 commented 1 year ago

Background

When I set up two nodes on two separate hosts and try sending assets from the first one to the second one the amount is subtracted from the sending node but the balance is not added to the receiving node.

The receiving node displays the error

[ERR] GRDN: unable to recv proof: rpc error: code = Unknown desc = no universe proof found

Your environment

$tapcli getinfo       
{
    "version": "0.3.0-alpha.rc3 commit=v0.3.0-alpha.rc3",
    "lnd_version": "0.16.99-beta",
    "network": "testnet3",
    "lnd_identity_pubkey": "031195a51aecf469cecef23f9028472957b380b250de41cd21b8dffb1bd631c0ec",
    "node_alias": "031195a51aecf469cece",
    "block_height": 2533921,
    "block_hash": "0000000000000061b1ea22fc3088e873355e9cfb0771bb6eb765417c6549ed60",
    "sync_to_chain": true
}
uname -mrsv                                          # operating system 
Linux 6.1.29-50.88.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun  6 00:47:06 UTC 2023 x86_64
Bitcoin Core version v22.0.0

Steps to reproduce

Tell us how to reproduce this issue. Please provide stacktraces and links to code in question.

On receiving node:

$tapcli addrs new --asset_id=a394c455f6ce8a385c32d21bed7cfac927617d4ae962be46e2cba2014ea8c83e  --amt=1001
{
    "encoded": "taptb1qqqsqqspqqzzpgu5c32ldn528pwr95sma4704jf8v97546tzherw9jazq9823jp7qcssytrd98l35dmqx8r8tz7n2dv4vrcledeun2ujcrtxt425g250l7zwpqss9kfx3g2rxghl8tc0pd88v3vq4p8t0kj3k6xhncg5ce9xs8d0cmnzpgpl6qlfpsm82mnfwejhyum9wfcxxw309a6x2um5dejhgtn4de5hvetjwdjjumrfva58gmnfdenjuenfdeskucm98gcnqvpj8yqyq4au",
    "asset_id": "a394c455f6ce8a385c32d21bed7cfac927617d4ae962be46e2cba2014ea8c83e",
    "asset_type": "NORMAL",
    "amount": "1001",
    "group_key": "",
    "script_key": "022c6d29ff1a376031c6758bd35359560f1fcb73c9ab92c0d665d55442a8fff84e",
    "internal_key": "02d9268a143322ff3af0f0b4e764580a84eb7da51b68d79e114c64a681dafc6e62",
    "tapscript_sibling": "",
    "taproot_output_key": "d825cc2c98ef1e4d85991c1e4927e5e91f05bdcc9fd7d6b6501d03c7494557be",
    "proof_courier_addr": "universerpc://testnet.universe.lightning.finance:10029",
    "asset_version": "ASSET_VERSION_V0"
}

On sending node:

tapcli assets send --addr= taptb1qqqsqqspqqzzpgu5c32ldn528pwr95sma4704jf8v97546tzherw9jazq9823jp7qcssytrd98l35dmqx8r8tz7n2dv4vrcledeun2ujcrtxt425g250l7zwpqss9kfx3g2rxghl8tc0pd88v3vq4p8t0kj3k6xhncg5ce9xs8d0cmnzpgpl6qlfpsm82mnfwejhyum9wfcxxw309a6x2um5dejhgtn4de5hvetjwdjjumrfva58gmnfdenjuenfdeskucm98gcnqvpj8yqyq4au

TAPD log on the receiving node

2023-10-18 11:59:45.912 [INF] RPCS: Starting RPC Server
2023-10-18 11:59:45.912 [INF] RPCS: RPC server listening on 0.0.0.0:10029
2023-10-18 11:59:45.913 [INF] CONF: Starting HTTPS REST proxy listener at 0.0.0.0:8089
2023-10-18 11:59:45.913 [INF] RPCS: gRPC proxy started at 0.0.0.0:8089
2023-10-18 11:59:45.913 [INF] SRVR: Taproot Asset Daemon fully active!
2023-10-18 11:59:54.484 [INF] RPCS: [NewAddr]: making new addr: asset_id=a394c455f6ce8a385c32d21bed7cfac927617d4ae962be46e2cba2014ea8c83e, amt=1001
2023-10-18 11:59:54.485 [DBG] TAPD: Deriving new key for fam_family=212
2023-10-18 11:59:54.491 [DBG] TAPD: Deriving new key for fam_family=212
2023-10-18 11:59:54.509 [WRN] GRDN: Taproot addr tb1pmqjuctycau0ympvers0yjfl9ay0st0wvnltaddjsr5puwj2927lqujm4ka was already added to wallet before, skipping
2023-10-18 11:59:54.510 [INF] GRDN: Imported Taproot Asset address taptb1qqqsqqspqqzzpgu5c32ldn528pwr95sma4704jf8v97546tzherw9jazq9823jp7qcssytrd98l35dmqx8r8tz7n2dv4vrcledeun2ujcrtxt425g250l7zwpqss9kfx3g2rxghl8tc0pd88v3vq4p8t0kj3k6xhncg5ce9xs8d0cmnzpgpl6qlfpsm82mnfwejhyum9wfcxxw309a6x2um5dejhgtn4de5hvetjwdjjumrfva58gmnfdenjuenfdeskucm98gcnqvpj8yqyq4au into wallet, watching p2tr address tb1pmqjuctycau0ympvers0yjfl9ay0st0wvnltaddjsr5puwj2927lqujm4ka on chain
2023-10-18 12:00:25.086 [DBG] GRDN: Inspecting tx 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba for Taproot Asset address outputs
2023-10-18 12:00:25.087 [INF] GRDN: Found inbound asset transfer (asset_id=a394c455f6ce8a385c32d21bed7cfac927617d4ae962be46e2cba2014ea8c83e) for Taproot Asset address taptb1qqqsqqspqqzzpgu5c32ldn528pwr95sma4704jf8v97546tzherw9jazq9823jp7qcssytrd98l35dmqx8r8tz7n2dv4vrcledeun2ujcrtxt425g250l7zwpqss9kfx3g2rxghl8tc0pd88v3vq4p8t0kj3k6xhncg5ce9xs8d0cmnzpgpl6qlfpsm82mnfwejhyum9wfcxxw309a6x2um5dejhgtn4de5hvetjwdjjumrfva58gmnfdenjuenfdeskucm98gcnqvpj8yqyq4au in 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba:1
2023-10-18 12:00:25.090 [DBG] GRDN: Waiting to receive proof for script key 022c6d29ff1a376031c6758bd35359560f1fcb73c9ab92c0d665d55442a8fff84e
2023-10-18 12:00:30.171 [ERR] GRDN: unable to recv proof: rpc error: code = Unknown desc = no universe proof found

TAPD log on the sending node

359560f1fcb73c9ab92c0d665d55442a8fff84e
2023-10-18 12:00:16.448 [INF] FRTR: Received funded PSBT packet
2023-10-18 12:00:16.449 [INF] FRTR: Adjusting send pkt by delta of 59 from 198 sats to 257 sats
2023-10-18 12:00:16.449 [DBG] FRTR: Signing PSBT
2023-10-18 12:00:16.453 [DBG] FRTR: Got signed PSBT
2023-10-18 12:00:16.453 [INF] FRTR: PSBT absolute fee: 257 sats
2023-10-18 12:00:16.453 [INF] FRTR: ChainPorter executing state: SendStateLogCommit
2023-10-18 12:00:16.486 [INF] FRTR: Committing pending parcel to disk
2023-10-18 12:00:16.492 [INF] FRTR: ChainPorter executing state: SendStateBroadcast
2023-10-18 12:00:16.496 [INF] FRTR: Broadcasting new transfer tx, txid=6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba
2023-10-18 12:00:16.505 [DBG] GRDN: Inspecting tx 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba for Taproot Asset address outputs
2023-10-18 12:00:16.524 [INF] FRTR: Outbound parcel with txid 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba now pending (num_inputs=1, num_outputs=2), delivering notification
2023-10-18 12:00:16.524 [INF] FRTR: ChainPorter executing state: SendStateWaitTxConf
2023-10-18 12:00:16.524 [INF] FRTR: Waiting for confirmation of transfer_txid=6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba
2023-10-18 12:05:41.008 [DBG] GRDN: Inspecting tx 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba for Taproot Asset address outputs
2023-10-18 12:05:41.025 [INF] GRDN: New block at height 2533920
2023-10-18 12:05:41.025 [INF] GRDN: Anchor TX 885bbd5afb86d09536551c049d6b32d9729c2d01b3cb94315a9181ed802b7e48 reached 6 confirmations, removing it from the re-org watcher
2023-10-18 12:05:41.026 [DBG] FRTR: Got chain confirmation: 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba
2023-10-18 12:05:41.026 [INF] FRTR: ChainPorter executing state: SendStateStoreProofs
2023-10-18 12:05:41.026 [INF] FRTR: Importing 0 passive asset proofs into local Proof Archive
2023-10-18 12:05:41.027 [INF] FRTR: Importing proof for output 0 into local Proof Archive
2023-10-18 12:05:41.027 [DBG] FRTR: Updated proofs for output 0 (new_len=9)
2023-10-18 12:05:41.028 [INF] GRDN: Watching new proof anchor TX 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba for 1 assets until it reaches 6 confirmations
2023-10-18 12:05:41.029 [INF] FRTR: Importing proof for output 1 into local Proof Archive
2023-10-18 12:05:41.029 [DBG] FRTR: Updated proofs for output 1 (new_len=9)
2023-10-18 12:05:41.029 [INF] FRTR: ChainPorter executing state: SendStateReceiverProofTransfer
2023-10-18 12:05:41.029 [DBG] GRDN: Anchor TX 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba was confirmed at height 2533920 (block_hash=000000000000003d90c35d571d9a00a822294db7fba86215da386ba80eb566cd), checking if 1 proof(s) need to be updated
2023-10-18 12:05:41.029 [DBG] GRDN: Anchor TX 6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba was already confirmed in block 2533920, ignoring confirmation for block 000000000000003d90c35d571d9a00a822294db7fba86215da386ba80eb566cd
2023-10-18 12:05:41.029 [DBG] FRTR: Attempting to deliver proof for script key 022c6d29ff1a376031c6758bd35359560f1fcb73c9ab92c0d665d55442a8fff84e
2023-10-18 12:05:41.029 [DBG] FRTR: Not transferring proof for local output script key 023160cdeff25962ff323161100b4b5e22585d64c8bbc65b189002b866c6aeaf46
2023-10-18 12:05:42.219 [INF] FRTR: Marking parcel (txid=6f82aae5315a3c65fcdff9a127011f5a8f3c3008af21e1aaaae364e6566e4cba) as confirmed!
2023-10-18 12:05:42.221 [DBG] TADB: Re-anchoring 0 passive assets
2023-10-18 12:05:42.224 [INF] GRDN: Received new proof file, version=0, num_proofs=9

Expected behavior

I would expect the balance to be correctly added on the receiving node after it is subtracted not he sending node.

Actual behavior

RPC Error message + lost assets

jharveyb commented 1 year ago

Feels like this should be fixed in rc3 and is part of the new itests + I see the proof in the universe.

Can you share the universe config for the receiver? tapcli u f c i

jharveyb commented 1 year ago

Confirmed from fresh rc3 setup that the global_sync_config for PROOF_TYPE_TRANSFER has allow_sync_insert=false.

@snow884 if you run tapcli u f c g --proof_type=transfer --allow_insert=true on the receiving node and retry, that should work.

snow884 commented 1 year ago

Feels like this should be fixed in rc3 and is part of the new itests + I see the proof in the universe.

Can you share the universe config for the receiver? tapcli u f c i

Thank you for quick reply. Here is the received config.

$ tapcli u f c i
{
    "global_sync_configs": [
        {
            "proof_type": "PROOF_TYPE_ISSUANCE",
            "allow_sync_insert": true,
            "allow_sync_export": true
        },
        {
            "proof_type": "PROOF_TYPE_TRANSFER",
            "allow_sync_insert": false,
            "allow_sync_export": true
        }
    ],
    "asset_sync_configs": []
}
jharveyb commented 1 year ago

I think this could also be fixed by setting universe.public-access=true in the config and restarting before the next send attempt. IIUC accepting transfer proofs is off by default.

snow884 commented 1 year ago

I have tried universe.public-access=true tapcli u f c g --proof_type=transfer --allow_insert=true

and restarting tapd

I keep getting the same error when receiving.

jharveyb commented 1 year ago

Sorry that was premature, that config actually shouldn't affect this case.

lnfi-network commented 1 year ago

the same with my daemon: [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: cannot fetch proof for input asset: unable to find proof if I try send asset again : [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: unable to list eligible coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again

And my daemon has a pending tx for 3days as the fee is 1sat. https://mempool.space/address/bc1pk72lzk6djlrx7gfqrs7j0er4yh36xrj9vqs2yxtwk6mvjrjmr4lqcumlxw

snow884 commented 1 year ago

the same with my daemon: [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: cannot fetch proof for input asset: unable to find proof if I try send asset again : [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: unable to list eligible coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again

Happy to see it is not just me 😛

jharveyb commented 1 year ago

the same with my daemon: [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: cannot fetch proof for input asset: unable to find proof if I try send asset again : [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: unable to list eligible coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again

This is from the sender or the receiver trying to send? This looks like a different issue actually.

And my daemon has a pending tx for 3days as the fee is 1sat. https://mempool.space/address/bc1pk72lzk6djlrx7gfqrs7j0er4yh36xrj9vqs2yxtwk6mvjrjmr4lqcumlxw

Were you set up with the Lightning Labs fee estimator? It looks like that may have been a valid fee estimate at the time but the fee market just moved up. Will discuss reducing the conf target so we default to higher fees.

lnfi-network commented 1 year ago

the same with my daemon: [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: cannot fetch proof for input asset: unable to find proof if I try send asset again : [tapcli] unable to send assets: rpc error: code = Unknown desc = unable to fund address send: unable to list eligible coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again

This is from the sender or the receiver trying to send? This looks like a different issue actually.

And my daemon has a pending tx for 3days as the fee is 1sat. https://mempool.space/address/bc1pk72lzk6djlrx7gfqrs7j0er4yh36xrj9vqs2yxtwk6mvjrjmr4lqcumlxw

Were you set up with the Lightning Labs fee estimator? It looks like that may have been a valid fee estimate at the time but the fee market just moved up. Will discuss reducing the conf target so we default to higher fees.

when I boardcasted the tx, there was a fee bug in v0.31-alpha, so the fee was set to 1sat

Roasbeef commented 1 year ago

I tried to repro, and was able to receive a grouped asset from two nodes np. This was on testnet FWIW. I confirmed they were using the same version (final version of v0.3.0) and also used the correct universe key.

Roasbeef commented 1 year ago

@nostrassets rn we don't support spending unconfirmed change. So if you only have a single UTXO in your wallet, you'll need to wait for it to confirm.

If you have something stuck on mainnet, then you can use lnd's BumpFee command lncli wallet bumpfee to increase the fee rate using CPFP.

Roasbeef commented 1 year ago

I'm gonna close this as we have #597. We have a good idea what the issue is here, basically a race condition.

snow884 commented 1 year ago

I'm gonna close this as we have #597. We have a good idea what the issue is here, basically a race condition.

Thank you for looking into this.