Fantom-foundation / Tosca

Other
8 stars 14 forks source link

LFVM fails to process transaction 56239485 / 1 correctly #25

Closed HerbertJordan closed 1 year ago

HerbertJordan commented 1 year ago

Processing transaction 56239485 / 1 fails when using the LFVM implementation with the following error:

2023/05/17 15:39:19 CRITICAL replay/replayTask: inconsistent output: result
  Different status:
    want: 1
    have: 0
  Different gas usage:
    want: 1244928
    have: 577774
  Different log bloom filter:
    want: [0 0 4 0 0 0 0 0 8 0 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 0 0 0 0 0 8 2 64 0 0 0 0 32 0 0 4 0 0 0 4 0 0 0 32 0 0 0 0 0 0 0 0 0 2 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 1 0 0 0 0 0 0 0 0 0 2 34 0 0 0 0 0 0 0 2 0 128 0 0 2 0 0 0 0 10 2 0 16 0 0 0 0 4 0 0 0 0 0 2 0 0 64 96 0 0 0 1 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 0 0 72 0 0 0 0 0 0 64 1 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0 4 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 32 0 1 0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 64 0 0 0 0 0 0 0 0 128 0 0 0 0 0 0]
    have: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
  Different log size:
    want: 13
    have: 0
2023/05/17 15:39:19 CRITICAL replay/replayTask: inconsistent output: alloc
  Different substate alloc size:
    want: 11
    have: 4
    missing key=0x25cc8D861A912B2753a21b0A13932E28FC69bbCC
    missing key=0xdFF340Dd1a0C366274793580556Ac92Ec9C1b26C
    missing key=0xE4C2ed2617aBDaFb9B71FFc5686DE3d189fc509d
    missing key=0xe151c648DA10f8D7Cc8D0F066104c9BaBB6E167a
    missing key=0x0d09d8876BcEcb0Ab4570bF68acb4Fa0be7A32E0
    missing key=0x2453c8F3f8424c71fB3C6155600c61A285e572dC
    missing key=0x4599cf4534CbD4ea66B8664DB292B405Dc40C054
  Different key=0x9544e0500407dad0765b11c67D6c94645Cf343Ca:.Balance:
    want: 221480040718369917175
    have: 221571868157693570367
  Different key=0xf6CbA3BB7e67053aFb03753FfA1cc3d94591715A:.Nonce:
    want: 3
    have: 2
  Different len(key=0xf6CbA3BB7e67053aFb03753FfA1cc3d94591715A:.Storage):
    want: 13
    have: 9
    key=0xf6CbA3BB7e67053aFb03753FfA1cc3d94591715A:.Storage misses key 0x353f1746f3dae7991151c9a1aeef0d2e22e71219ffccded97f30e80e83dd1b34
    key=0xf6CbA3BB7e67053aFb03753FfA1cc3d94591715A:.Storage misses key 0x7d989d3f8c59bfc1b23074e5f99b02f7e0454e948b37fbda1a2b326577ce932b
    key=0xf6CbA3BB7e67053aFb03753FfA1cc3d94591715A:.Storage misses key 0x054a8cd5836d8b6084ef47cf2b19d0f5519b22eb3521bd7f3c0f6e42046053e7
    key=0xf6CbA3BB7e67053aFb03753FfA1cc3d94591715A:.Storage misses key 0x4b5f01724ef9b48f785b97ea48ad248a14a27e1af20c9fcfb613495806262c6c

Command to reproduce issue (requires 59M Aida DB):

./build/aida-substate replay --substate-db /var/data/herbert/aida-db --vm-impl lfvm --workers 32 56230000 60000000

The geth EVM passes the test.

HerbertJordan commented 1 year ago

It seems like the issue requires some context. Running it from block 56238000 works, while starting it from block 56237000 (1000 blocks earlier) reproduces the issue.

jenikd commented 1 year ago

There was contract creation and its direct call in failed transaction. When this same action was done with changed contract code, it made problem in the contract code cache for long form bytecode. Fixed with PR https://github.com/Fantom-foundation/Tosca/pull/26