DeFiCh / ain

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

v 3.0.0 reindex testnet from 0 stops at 1372460 with bad custom tx #1611

Closed bernd-mack closed 1 year ago

bernd-mack commented 1 year ago

What happened:

Sync from block 0 with latest relase 3.0.0 on testnet stopped at height=1372460

reconsiderblock e25c037c402ab8327e5a88021c839145d073128eca37e9dcbb6be04f538d5085
bad-custom-tx (code 68)
2022-11-27T13:26:47Z ERROR: ConnectBlock: ApplyCustomTx on 59e2b91d69879f22b2cc25be2d5468f928fffe2d730cf39e858bc6d6c8ad3baf failed with SetGovVariableTx: ATTRIBUTES: Cannot be set before GrandCentralHeight
2022-11-27T13:26:47Z InvalidChainFound: invalid block=e25c037c402ab8327e5a88021c839145d073128eca37e9dcbb6be04f538d5085  height=1372461  log2_work=78.428139  date=2022-11-15T16:28:42Z
2022-11-27T13:26:47Z InvalidChainFound:  current best=ec66376440b3de28a6144f2d44d022a91c7cdf9fe8404239d04af9957b12bf64  height=1372460  log2_work=78.428138  date=2022-11-15T16:26:34Z
2022-11-27T13:26:47Z ERROR: ConnectTip: ConnectBlock e25c037c402ab8327e5a88021c839145d073128eca37e9dcbb6be04f538d5085 failed, bad-custom-tx (code 68)

What you expected to happen:

sync from 0 to birthday ocean latest block

How to reproduce it (as minimally and precisely as possible):

set up testnet Node with 3.0.0

What are your environment parameters:

getversioninfo { "name": "DeFiChain", "version": "3.0.0", "numericVersion": 3000000, "fullVersion": "DeFiChain:3.0.0", "userAgent": "/DeFiChain:3.0.0/", "protoVersion": 70034, "protoVersionMin": 70023, "rpcVersion": "1", "rpcVersionMin": "1", "spv": { "btc": { "version": 70013, "min": 70002, "userAgent": "/bread:2.1/" } } }

Anything else we need to know?:

defichain-bot commented 1 year ago

@bernd-mack: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details I am a bot created to help the [DeFiCh](https://github.com/DeFiCh) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/DeFiCh/ain/blob/master/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [DeFiCh/oss-governance-bot](https://github.com/DeFiCh/oss-governance-bot) repository.
prasannavl commented 1 year ago

Hmm.. It's a setgov TX.

The only setgov TX that should throw that error is if there's a Grand Central value that's being set before on testnet: https://github.com/defich/ain/blob/pvl/debug-2/src/masternodes/govvariables/attributes.cpp/#L1505-L1513.

The other plausibility is if there's a key clash that's on testnet. Full sync on mainnet is smooth - so we know that doesn't have conflicting TXs. Looking into it.

prasannavl commented 1 year ago

TX 59e2b91d69879f22b2cc25be2d5468f928fffe2d730cf39e858bc6d6c8ad3baf

040000000100030929fff63aa476df7925f8039472292b72eb4486e997ff9a000f23f5bc84010000006a473044022016cfa770cada2fa90de7883575fe9c64155db394773fb979fde6987c7f03d1b60220681c6e427632c9d6d6f8bb9c9666f0f594c4b28187b4da9825757197803ebabe0121030e73d57cc3cd9a450d6d34ba68b1b241e9a427f4ff929ed92c333a990315e4b9ffffffff020000000000000000226a2044665478470a41545452494255544553010000000061680000006b0000000001002ea1394a000000001976a914e5ed1bfa532e2358e964381a70e0df6d4dd0041988ac0000000000

Which is:

{
  "txid": "59e2b91d69879f22b2cc25be2d5468f928fffe2d730cf39e858bc6d6c8ad3baf",
  "type": "SetGovVariable",
  "valid": true,
  "results": {
    "ATTRIBUTES": {
      "v0/params/feature/gov-foundation": "true"
    }
  }
}

So, the v3.0.0 node is correct to reject the block. Looking deeper to see if/how/why 2.11.1 node accepted this TX to be a part of the 2.11 testnet chain

bernd-mack commented 1 year ago

fresh reindex with 3.0.1 results in new invalid transaction, this time we know exactly who it was :) @Jouzo https://explore-defichain.com/transactions/f43079fa1b94149471d731e9c24b3493a171c7580a454327bf03966252d5af4c?network=mydefichain+TestNet

2022-11-28T12:39:15Z ERROR: ConnectBlock: ApplyCustomTx on f43079fa1b94149471d731e9c24b3493a171c7580a454327bf03966252d5af4c failed with CreateVocTx: proposal cycles should be 1
2022-11-28T12:39:15Z InvalidChainFound: invalid block=b393ed09a0e51906c23fa25cb9602c121c0b638f4a1e05b2987b7cab8816aa12  height=1386352  log2_work=78.451697  date=2022-11-25T17:40:19Z
2022-11-28T12:39:15Z InvalidChainFound:  current best=d258e80301a44040ace3f4818a87a71c49f034c334c7a2607d890d218865b235  height=1386351  log2_work=78.451696  date=2022-11-25T17:32:45Z
2022-11-28T12:39:15Z ERROR: ConnectTip: ConnectBlock b393ed09a0e51906c23fa25cb9602c121c0b638f4a1e05b2987b7cab8816aa12 failed, bad-custom-tx (code 68)
2022-11-28T12:39:15Z ERROR: ProcessNewBlock: ActivateBestChain failed (bad-custom-tx (code 68))

which path should we take? a: new release? b: new chain from this block on without this transaction?

Jouzo commented 1 year ago

There's a new chain without this transaction. Blockhash for block 1386352 is e1dd25391cf27fa04adb9b67990cae788fbb302f06d57ea144a83a13e36725dd