Consensys / linea-tracer

Part of the Linea stack responsible for extracting data from the execution of an EVM client in order to construct large matrices called execution traces.
https://linea.build
Other
35 stars 22 forks source link

Incorrect Balance on some Replays #1047

Closed DavePearce closed 1 month ago

DavePearce commented 2 months ago

For example, for rlprcptManyTopicsWoLogData() we get this when result checking is enabled:

   java.lang.RuntimeException: tx 0xfc101cd3e88876de3176b428226014d06c88fefdd854c0624752947e5aec514f balance of account 0x0000000000000000000000000000000000000000 (776153018587787272) does not match expected value (775913456386696799)
      at net.consensys.linea.zktracer.ReplayTests.replay(ReplayTests.java:75)
DavePearce commented 2 months ago

So, two blocks illustrating the problem:

DavePearce commented 2 months ago

Observations:

tx 0x90d947da9f51698a99cc2e178dfb7e53bde0c9a92c40ff27492c524fd4335750 balance of account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e (6718674392457320274) does not match expected value (6718801508324469274)


- [6569423](https://lineascan.build/block/6569423) has this:

0x1f735e3fe0d4e5c1561fa4c771c54587ddb905bb => 0x0000000000000000000000000000000000000000[0xc0a2a606913a49a0b0a02f682c833eff3829b4ba] (gas: 1853)

tx 0xfc101cd3e88876de3176b428226014d06c88fefdd854c0624752947e5aec514f balance of account 0x0000000000000000000000000000000000000000 (776153018587787272) does not match expected value (775913456386696799)

- [8718468](https://lineascan.build/block/8718468)

TX 0x1d5abf4610cdd9933cb8579da7f4e353b2e770b92f9bc7d06a2aa1e6a77be5d7 FROM 0x89ce6221e97d38bdab7ee948973a20a5a7d751c2 TO Optional[0x508ca82df566dcd1b0de8296e70a96332cd644ec] 0x89ce6221e97d38bdab7ee948973a20a5a7d751c2 => 0x508ca82df566dcd1b0de8296e70a96332cd644ec[0x508ca82df566dcd1b0de8296e70a96332cd644ec] (gas: 172779) 0x89ce6221e97d38bdab7ee948973a20a5a7d751c2 => 0x9899f25bdd0785b2b47c1bd29711d88406c3b54d[0x508ca82df566dcd1b0de8296e70a96332cd644ec] (gas: 163057) 0x508ca82df566dcd1b0de8296e70a96332cd644ec => 0x0000000000000000000000000000000000000000[0x0000000000000000000000000000000000000000] (gas: 128054)

tx 0x1d5abf4610cdd9933cb8579da7f4e353b2e770b92f9bc7d06a2aa1e6a77be5d7 balance of account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e (3295769155838684224) does not match expected value (3295871151918684224)


- [8718673](https://lineascan.build/block/8718673)

PROCESSING: COINBASE 0x0000000000000000000000000000000000000000 0x508ca82df566dcd1b0de8296e70a96332cd644ec => 0x0000000000000000000000000000000000000000[0x0000000000000000000000000000000000000000] (gas: 34615)

tx 0x053f45108d5b645f4979074f3df942346d5f3431f27d165735f8054f499015c4 balance of account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e (3314526399214139348) does not match expected value (3314646746013486275)


- [8718853](https://lineascan.build/block/8718853) (diff `4A0309604CA00000`)

0x508ca82df566dcd1b0de8296e70a96332cd644ec => 0x0000000000000000000000000000000000000000[0x0000000000000000000000000000000000000000] (gas: 10185) PROCESSING: CALLER 0x7e63a5f1a8f0b4d0934b2f2327daed3f6bb2ee75 PROCESSING: CALLER 0xf7bac63fc7ceacf0589f25454ecf5c2ce904997c PROCESSING: CALLER 0xf7bac63fc7ceacf0589f25454ecf5c2ce904997c

tx 0xe17a78bf9a3255d222e9e1c97a44d7831cd63fc7648e31d5dd764e0152ef6472 balance of account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e (3324670382505014379) does not match expected value (3329073418551925371)



So, it feels like the `COINBASE` address (`0x00`) is somehow involved here.  Furthermore, for block [8718468](https://lineascan.build/block/8718468)
 we're expecting the last call to be to `0x8f81e2e3f8b46467523463835f965ffe476e1c9e` and this is the account which is missing funds.  In addition [`0x508ca82df566dcd1b0de8296e70a96332cd644ec`](https://lineascan.build/address/0x508ca82df566dcd1b0de8296e70a96332cd644ec) is the Linea L2 message service.
DavePearce commented 2 months ago
DavePearce commented 1 month ago

So, there is something odd here. In blocks 6020028, 8718468, 8718673 and 8718853 the affected account is 0x8f81e2e3f8b46467523463835f965ffe476e1c9e.

DavePearce commented 1 month ago

Looking at the transactions for account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e we can find problematic transactions quite easily. Examples:

Basically, every transaction appears to be problematic.

DavePearce commented 1 month ago

Note, for block 5104826 we have this:

tx 0x3ca3a47c2ffc4a5b4d00066ff4782c16cbf4c54d87dec75604574621caea49c0 balance of account 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f (25082442646191152207757) does not match expected value (25082450246191152207757)

And for block 5104842 we have:

tx 0x2f3b5f0a2a2b47a00d77f4b87efc7735382030efbdb7d9e9f27312e8fc145e98 balance of account 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f (25076950645027344627137) does not match expected value (25076969845027344627137)

Likewise for 5105647.

NOTE: 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f is Wrapped Ether.

DavePearce commented 1 month ago

Also, for tx 0x83024ff531ee51e6b0b55792501c57c7835fac9695d07e066a444abe2ce50013 we have:

tx 0x83024ff531ee51e6b0b55792501c57c7835fac9695d07e066a444abe2ce50013 storage at 0xc5cb997016c9a3ac91cbe306e59b048a812c056f:0x0000000000000000000000000000000000000000000000000000000000000035(0x000000000000000000000000000000000000000000000000000000007c70085c) does not match expected value (0x000000000000000000000000000000000000000000000000000000007c700956)

Likewise for these txs:

0x73d1270e35c14a4d1485b85f674ac3abd075224bc4b4a2c702f594d225a31407
0x6a0cf4967998da5aba3cbefe192dd6abdb808ad49a4f37aae51275afd0b469c2
0xce8a0a00883ab3d5b6db659451c0b5fb758d0ff17d6df08e033bd399141f4aba
0x659585bcbf31c223ec07f507d17c072be0674cc8accd6255cf3727ef2ad3b56e
0xfc23c0354ba65c90bc59d871b606da06e56ce8a1a64bfe514c8f32a03a793537
0x4aa475a5b5959fd918cfee3873e63f70683cc3edcac0f810d26676a1654f3d1f
DavePearce commented 1 month ago

NOTES (problem 1)

NOTES (Problem 2)

Other

DavePearce commented 1 month ago

See #1200 for problem 2 above.