-
Notifications
You must be signed in to change notification settings - Fork 39
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
Invalid state root calculation #202
Comments
How did you obtain the trace? I believe this block is part of the ones @praetoriansentry ran (fetching block traces from Jerigon) and it got proven fine, at least on a given version of |
I generated the trace using the |
I just tested against the mentioned Jerigon witness we used previously and latest 2024-04-30T16:06:04.309309Z INFO p_gen: evm_arithmetization::generation::state: CPU halted after 177526 cycles id="b19240674 - 144"
2024-04-30T16:06:04.311728Z INFO p_gen: ops: txn proof (f272b5c901812d981a57ee366d0b25cb68835be82fe25068f99f763b5e0bc3ef) took 159.025625ms id="b19240674 - 144" so the issue may be coming from your end. I'll have a look. Would you happen to have the block trace / kernel trace logs? |
Kernel trace logs for this transaction: Will produce block trace now. Yep, sounds like its something on my end. |
It seems you're not having a valid state trie to begin with (although you are passing to the kernel witness that reconstructs the same trie). Cycle 28699, ctx=0, pc=45084, below hash_initial_tries, instruction=MloadGeneral, stack=[21474836487, 15624320678034521268530137619419123205812357239735782298755735174456886811719, 911]
Cycle 28700, ctx=0, pc=45085, below hash_initial_tries, instruction=BinaryArithmetic(Sub), stack=[15624320678034521268530137619419123205812357239735782298755735174456886811719, 15624320678034521268530137619419123205812357239735782298755735174456886811719, 911] Your state trie root pre-txn execution is On Jerigon side, it is Cycle 28699, ctx=0, pc=45084, below hash_initial_tries, instruction=MloadGeneral, stack=[21474836487, 95304458244551979935727276103143456771384068114772563680996672004691695516135, 911] id="b19240674 - 144"
Cycle 28700, ctx=0, pc=45085, below hash_initial_tries, instruction=BinaryArithmetic(Sub), stack=[95304458244551979935727276103143456771384068114772563680996672004691695516135, 95304458244551979935727276103143456771384068114772563680996672004691695516135, 911] id="b19240674 - 144" i.e. I've attached the jerigon block payload and txn trace. |
Hmm that is peculiar. I'll try and investigate what is going on. I've attached the native block witness. It's hard to compare the |
I may be wrong on this, but I believe the underlying reason is because if we need to perform a SSTORE (regardless of the value), we'll need to access the storage slot and hence need to provide its witness. |
Yeah we certainly need to include it in the state witness (which we do in the native tracer) but I don't think we need to include it in storage_writes of tx info. I believe in some cases it also includes nonce even when it doesn't change. |
I think there may be a bug in the I have attached a zip with the source code used to run this test along with the jerigon and native tries. You can compile and run with: Logs
Source |
@BGluth I haven't followed this topic very closely. Have we started investigating the cause of the |
Yeah sorry, I probably should have posted an update here. This was discussed on Slack with @frisitano, and the cause is the infamous issue of the full node providing this:
when a txn ends up deleting the leaf So yeah. I guess in short, this is an issue with the full node and I think we're good to close this. As an aside, we really need to document this somewhere as this is not very obvious and critical for full node implementators. |
I think you had proposed raising an error in the case in which we do not have sufficient information to collapse the branch node instead of producing an incorrect trie. Has this error logic been implemented? |
Ah right, that did come up. I haven't impled this yet, but I opened an issue (#237). |
It may be happening with Jerigon as well. The state trie obtained after application of the deltas of the first txn in this block below is invalid. Testable with the |
I am running into what appears to be an invalid state root calculation when executing the following transaction.
Transaction trace:
Logs:
The text was updated successfully, but these errors were encountered: