DeFiCh / ain

DeFi Blockchain - enabling decentralized finance on Bitcoin
https://defichain.com
MIT License
406 stars 121 forks source link

Can not send DFI via Floppynet #2011

Closed DeFiChainNFTs closed 1 year ago

DeFiChainNFTs commented 1 year ago

Summary

I tried to send DFI to another address but I am always getting this error. image

kuegi commented 1 year ago

same error here. trying to send DFI {"value":{"code":-32603,"data":{"code":-32001,"message":"Custom error: Could not publish raw transaction: 0xf871188502540be40082808d9414b6dc5dae34bfc7bef1f97e07f124eedfdf00d2872386f26fc100008444df8e708208fba01a4fe090bcf8ba7c9e128a298dd8d0d586989948d1ea27f69f982e6eb5b6e87ea07a7b5eb102dde1770e64cb214fd29ccaf37d290f4f84de69b09b33840ed7ac2d"}}} (also getting the same error when trying to deploy a SC)

edit: weirdly enough: it works on different pc with same metamask address: txId 0xcb7bd274966285aa4b9de0a2b1002e37ff06f4f4471daf03de4f7eb260718397

edit2: once the other pc also reached 24 tx (the nonce the first pc stopped before the rollback) it also started showing the error. now I can't send txs anywhere anymore

kuegi commented 1 year ago

Looks like it really is connected to the nonce. I just created a local chainsplit (my local node does not accept a block from the network). The invalid tx is one I made locally. How: I tried to send a second tx before the first was confirmed, which failed, but also seemed to mess the nonce within my node.

[2023-05-26T04:49:03Z DEBUG ain_evm::evm] [validate_raw_tx] raw transaction : "f86e1c8502540be400825208941fb0c631df78c4bb723e293d04d687bc0cefc869880de0b6b3a7640000808208fba0b9b7ed5a6548788828cb8521cee32719e44ed68073c2f7f4f37f8c98caf1aedda06de5beb95ed3c37df4b6cab68147eaa43d02e1ad3315837e6f0536a2cf0d9157"
[2023-05-26T04:49:03Z DEBUG ain_evm::evm] [validate_raw_tx] TransactionV2 : Legacy(
        LegacyTransaction {
            nonce: 28,
            gas_price: 10000000000,
            gas_limit: 21000,
            action: Call(
                0x1fb0c631df78c4bb723e293d04d687bc0cefc869,
            ),
            value: 1000000000000000000,
            input: [],
            signature: TransactionSignature {
                v: TransactionRecoveryId(
                    2299,
                ),
                r: 0xb9b7ed5a6548788828cb8521cee32719e44ed68073c2f7f4f37f8c98caf1aedd,
                s: 0x6de5beb95ed3c37df4b6cab68147eaa43d02e1ad3315837e6f0536a2cf0d9157,
            },
        },
    )
[2023-05-26T04:49:03Z DEBUG ain_evm::evm] [validate_raw_tx] block_number : 5131
[vsdb]: The `write_buffer_size` of rocksdb is 512MB, per column family
[2023-05-26T04:49:03Z DEBUG ain_evm::evm] Account 0x4bc7db8708719b35ab9a4afd0d32d07c91549359 nonce 27
[2023-05-26T04:49:03Z DEBUG ain_evm::evm] [validate_raw_tx] signed_tx.sender : 0x4bc7db8708719b35ab9a4afd0d32d07c91549359
[2023-05-26T04:49:03Z DEBUG ain_evm::evm] [validate_raw_tx] signed_tx nonce : 28
[2023-05-26T04:49:03Z DEBUG ain_evm::evm] [validate_raw_tx] nonce : 27
[2023-05-26T04:49:03Z DEBUG ain_rs_exports] evm_prevalidate_raw_tx fails with error: Invalid nonce. Account nonce 27, signed_tx nonce 28
2023-05-26T04:49:03Z ERROR: ConnectBlock: ApplyCustomTx on be4c1308747ae7cbb6bc41b756a77607f0277839edfa9a1a2cb9f9fd102c8ec9 failed with EvmTxTx: evm tx failed to validate
2023-05-26T04:49:03Z InvalidChainFound: invalid block=dd8a390f6902b209c6a1146f0fa3e0619bb61964fe9211f7afa08661311ce51f  height=1591893  log2_work=78.994073  date=2023-05-26T04:37:26Z
2023-05-26T04:49:03Z InvalidChainFound:  current best=50cfcd60f328714618f32241a0a16ebc6d4920324b724ed090880546824302c6  height=1591892  log2_work=78.994072  date=2023-05-26T04:34:48Z

is there a way that I can reset the nonce without resyncing the whole chain again?

kuegi commented 1 year ago

synced chain again, but got another nonce related chainsplit again. (my node didn't accept a block cause the used nonce was 0, but my node thought account is at 10). seems that there is some topic with the nonce handling @shohamc1 ?

[2023-05-26T07:55:16Z DEBUG ain_evm::evm] [validate_raw_tx] block_number : 5913
[2023-05-26T07:55:16Z DEBUG ain_evm::evm] Account 0xc1e0649415b4e59a5cc980feefc005929f90fdeb nonce 10
[2023-05-26T07:55:16Z DEBUG ain_evm::evm] [validate_raw_tx] signed_tx.sender : 0xc1e0649415b4e59a5cc980feefc005929f90fdeb
[2023-05-26T07:55:16Z DEBUG ain_evm::evm] [validate_raw_tx] signed_tx nonce : 0
[2023-05-26T07:55:16Z DEBUG ain_evm::evm] [validate_raw_tx] nonce : 10
[2023-05-26T07:55:16Z DEBUG ain_rs_exports] evm_prevalidate_raw_tx fails with error: Invalid nonce. Account nonce 10, signed_tx nonce 0
2023-05-26T07:55:16Z ERROR: ConnectBlock: ApplyCustomTx on 2729ff4b3ddcf3b2943b7d51606164fc9128fb4777ba3959d4a4c0e80debc7e7 failed with EvmTxTx: evm tx failed to validate
2023-05-26T07:55:16Z InvalidChainFound: invalid block=361bb340baebd767f465a92f294350cb583625fe471d3257d05f0938237a69cd  height=1587544  log2_work=78.993535  date=2023-05-16T03:00:54Z
Jouzo commented 1 year ago

There's a snapshot you can use : https://storage.googleapis.com/team-drop/snapshots/devnet/snapshot-1586749.tar.gz instead of syncing the whole chain again. That's the snapshot we re-deploy the main devnet node from

shohamc1 commented 1 year ago

@kuegi did you perform a rollback sometime? If you did, which commit were you on at the time?

This possibly happened if a rollback was done before https://github.com/DeFiCh/ain/commit/fc87ff269272b29308d5cc7c0aef87e99fc93f54. The best way to fix this would be to wipe the devnet folder (minus wallet) and run a fresh sync. You can use this snapshot to speed up the sync. The node should sync on the latest commit.

kuegi commented 1 year ago

did not do a rollback, freshly synced for the first time yesterday. will use snapshot and see if I can reproduce it.

kuegi commented 1 year ago

managed to kill my node by sending a tx with lower nonce

[2023-05-26T09:18:56Z DEBUG rpc] [send_raw_transaction] Sending raw transaction: "0xf86e1d8502540be400825208941fb0c631df78c4bb723e293d04d687bc0cefc869880de0b6b3a7640000808208fca0ce7bd4ade7edfe98d41ca08080b63dd66f59ecdd295c846a8954cac3702952fca06c37604b3dffadadfdb97b52168a77b722a85ce142dcee2af4dd329a15a50773"
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] [validate_raw_tx] raw transaction : "f86e1d8502540be400825208941fb0c631df78c4bb723e293d04d687bc0cefc869880de0b6b3a7640000808208fca0ce7bd4ade7edfe98d41ca08080b63dd66f59ecdd295c846a8954cac3702952fca06c37604b3dffadadfdb97b52168a77b722a85ce142dcee2af4dd329a15a50773"
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] [validate_raw_tx] TransactionV2 : Legacy(
        LegacyTransaction {
            nonce: 29,
            gas_price: 10000000000,
            gas_limit: 21000,
            action: Call(
                0x1fb0c631df78c4bb723e293d04d687bc0cefc869,
            ),
            value: 1000000000000000000,
            input: [],
            signature: TransactionSignature {
                v: TransactionRecoveryId(
                    2300,
                ),
                r: 0xce7bd4ade7edfe98d41ca08080b63dd66f59ecdd295c846a8954cac3702952fc,
                s: 0x6c37604b3dffadadfdb97b52168a77b722a85ce142dcee2af4dd329a15a50773,
            },
        },
    )
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] [validate_raw_tx] block_number : 5560
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] Account 0x4bc7db8708719b35ab9a4afd0d32d07c91549359 nonce 32
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] [validate_raw_tx] signed_tx.sender : 0x4bc7db8708719b35ab9a4afd0d32d07c91549359
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] [validate_raw_tx] signed_tx nonce : 29
[2023-05-26T09:18:56Z DEBUG ain_evm::evm] [validate_raw_tx] nonce : 32
[2023-05-26T09:18:56Z DEBUG ain_rs_exports] evm_prevalidate_raw_tx fails with error: Invalid nonce. Account nonce 32, signed_tx nonce 29
libc++abi: terminating with uncaught exception of type UniValue
Abort trap: 6

freshly build on commit 9d9a25c419f8a2ec1d06d0b0ee25e1e9d6940919

100% reproducible here. I also get same error when sending nonce 33 sending the "correct" nonce of 32 works normally.

kuegi commented 1 year ago

same error happening when I want to send 2 txs in the same block. nonce get increased which leads to the abort and node crash.

kuegi commented 1 year ago

@shohamc1 should I make a new issue for the nonce crash or ok to keep it here?

shohamc1 commented 1 year ago

The node crash should be solved as of https://github.com/DeFiCh/ain/commit/0fb4e7786656df398c945be5a538e99588363947.

kuegi commented 1 year ago

can confirm. no longer crashes but tx just gets rejected. thx 👍 you can close the ticket now as all points are resolved IMHO.