Magickbase / neuron-public-issues

Neuron Issues
6 stars 3 forks source link

Transaction of the same wallet is recognized differently in several neuron #329

Open Keith-CY opened 1 year ago

Keith-CY commented 1 year ago

Package: https://github.com/nervosnetwork/neuron/actions/runs/6978628219 Wallet: david.json Network: Testnet

Tx: 0x56313e625d978c85636f306e493ec8f25c05173f8238fd2c4e4e5aacc60b9b63 image

The same transaction is treated as an income in Neuron running on Linux and Windows, but as an expense on MacOS. The result is steady after clear cache.

Thus the balance is incorrect image

Checking the balance of the change address https://pudge.explorer.nervos.org/address/ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2yuuc0tnwnhytd0e6p8ur63m03an6xa9gq08v25

image

Obviously, David.json on Linux and Windows lost balance of ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2yuuc0tnwnhytd0e6p8ur63m03an6xa9gq08v25

Search the address in history and get 3 results

image

It's probably caused by dirty data on Linux and Windows, e.g. synced data of an unpublished neuron that has a known bug. But the data are left for further debugging, and we'd better verify David.json on other platforms.

silySuper commented 1 year ago

start block number is same in both mac and windows:11,377,640 sync process is 100% both mac and windows.

The balance between mac and windows is different: mac:10212.94513794 windows:14416.77926062

ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqd9grz2p0fy98dq2m2hnaaeugfshrg08fqejjqaz is lost in windows.

and windows has two balance which mac does not have.

截屏2023-11-27 17 04 42

After clear cache: The balance between mac and windows is different: mac:10212.94513794 windows:16988.78824545

silySuper commented 1 year ago

After clear cache: mac: transactions_1701077538974.csv

windows: transactions_1701077621475.csv

FrederLu commented 1 year ago

When using light nodes to synchronize data, it was found that neither the input nor the changes in the Nervos dao operation were recognized as this wallet address, only the first output was recognized. It should be that when synchronizing to this transaction, the input and output are not exported. Missing confirmation after export that the transaction has been synchronized. Preliminary confirmation is that when optimizing input and output storage, when deriving addresses, there was a lack of verification of whether there were synchronization exceptions in previous transactions.

yanguoyu commented 1 year ago

https://github.com/nervosnetwork/neuron/pull/2965

yanguoyu commented 1 year ago

I have verified with my local start Neuron. The remote Linux is syncing with https://github.com/nervosnetwork/neuron/pull/2965#issuecomment-1833158839

yanguoyu commented 1 year ago

I have verified the Light client with https://github.com/nervosnetwork/neuron/pull/2965#issuecomment-1835820718. Here are the results: Remote Linux tx table: remote_linux_863.csv Local Virtual Linux tx table: local_virtual_linux_863.csv Local Mac tx table: local_863.csv

And here is the full node result with https://github.com/nervosnetwork/neuron/pull/2965#issuecomment-1835820718: full_local_863.csv

yanguoyu commented 11 months ago

There are two conditions that the light client will miss some tx.

  1. When the transaction has not synced, it appears on another TX's input. Then we will call fetch_transaction to get the input detail, after calling fetch_transaction with the input's tx, the tx will not return by get_transactions
  2. The light will miss some transactions for an unknown reason. I have provided feedback to the core team, they will try to recurrent this problem. And they suggest I call set_script with partial for better performance.

So, I will update the light node synchronization from the following two aspects:

  1. When syncing the block's tx to the local DB, ensure that all of the scripts have synced to greater than the block number
  2. Use partial to call set_script when some addresses are derived. And use all to call set_script when switching wallets.
yanguoyu commented 11 months ago

https://github.com/nervosnetwork/neuron/pull/2992

silySuper commented 10 months ago

Verified