Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Balance on some Replays #1047

Closed
DavePearce opened this issue Aug 30, 2024 · 9 comments
Closed

Incorrect Balance on some Replays #1047

DavePearce opened this issue Aug 30, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@DavePearce
Copy link
Collaborator

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 DavePearce added the bug Something isn't working label Aug 30, 2024
@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 3, 2024

So, two blocks illustrating the problem:

@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 3, 2024

Observations:

  • Block 6020028 has this at the end:
0x7b5780d6df85a7df96a3e1a019639a1dbde937db => 0x9899f25bdd0785b2b47c1bd29711d88406c3b54d[0x508ca82df566dcd1b0de8296e70a96332cd644ec] (gas: 357730)
0x508ca82df566dcd1b0de8296e70a96332cd644ec => 0x0000000000000000000000000000000000000000[0x0000000000000000000000000000000000000000] (gas: 295991)

tx 0x90d947da9f51698a99cc2e178dfb7e53bde0c9a92c40ff27492c524fd4335750 balance of account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e (6718674392457320274) does not match expected value (6718801508324469274)
0x1f735e3fe0d4e5c1561fa4c771c54587ddb905bb => 0x0000000000000000000000000000000000000000[0xc0a2a606913a49a0b0a02f682c833eff3829b4ba] (gas: 1853)

tx 0xfc101cd3e88876de3176b428226014d06c88fefdd854c0624752947e5aec514f balance of account 0x0000000000000000000000000000000000000000 (776153018587787272) does not match expected value (775913456386696799)
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)
PROCESSING: COINBASE 0x0000000000000000000000000000000000000000
0x508ca82df566dcd1b0de8296e70a96332cd644ec => 0x0000000000000000000000000000000000000000[0x0000000000000000000000000000000000000000] (gas: 34615)

tx 0x053f45108d5b645f4979074f3df942346d5f3431f27d165735f8054f499015c4 balance of account 0x8f81e2e3f8b46467523463835f965ffe476e1c9e (3314526399214139348) does not match expected value (3314646746013486275)
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
we're expecting the last call to be to 0x8f81e2e3f8b46467523463835f965ffe476e1c9e and this is the account which is missing funds. In addition 0x508ca82df566dcd1b0de8296e70a96332cd644ec is the Linea L2 message service.

@DavePearce
Copy link
Collaborator Author

  • 0xfb01f10181fb62d98b8152b976a0be0e4f83da5d0f58fa9b1126316db7ccea01 gas used does not match expected gas used (expected 293188, was 294985)

@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 3, 2024

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

@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 3, 2024

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

Basically, every transaction appears to be problematic.

@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 4, 2024

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
Copy link
Collaborator Author

DavePearce commented Sep 4, 2024

Also, for tx 0x83024ff531ee51e6b0b55792501c57c7835fac9695d07e066a444abe2ce50013 we have:

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

Likewise for these txs:

0x73d1270e35c14a4d1485b85f674ac3abd075224bc4b4a2c702f863d225a31407
0x6a0cf4967998da5aba3cbefe192dd6abdb808ad49a4f37aae51275afd0b469c2
0xce8a0a00883ab3d5b6db686351c0b5fb758d0ff17d6df08e033bd399141f4aba
0x659585bcbf31c223ec07f507d17c072be0674cc8accd6255cf3727ef2ad3b56e
0xfc23c0354ba65c90bc59d871b606da06e56ce8a1a64bfe514c8f32a03a793537
0x4aa475a5b5959fd918cfee3873e63f70683cc3edcac0f810d26676a1654f3d1f

@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 11, 2024

NOTES (problem 1)

  • Block 8718853 has problematic first tx 0xe17a78bf9a3255d222e9e1c97a44d7831cd63fc7648e31d5dd764e0152ef6472

  • For block 8718853, the balance of account 0x8F81e2E3F8b46467523463835F965fFE476E1c9E is incorrect.

  • Last CALL for this transaction should be to 0x8F81e2E3F8b46467523463835F965fFE476E1c9E, but it is to 0x0.

  • COINBASE instruction is called before last CALL and returns 0x0. Changing this to 0x8F81e2E3F8b46467523463835F965fFE476E1c9E and this transaction executes correctly.

  • The account 0x8F81e2E3F8b46467523463835F965fFE476E1c9E is the miner account for that block.

NOTES (Problem 2)

Other

  • ConflationAwareOperationTracer does not handle exceptions correctly.

@DavePearce
Copy link
Collaborator Author

DavePearce commented Sep 16, 2024

See #1200 for problem 2 above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant