-
Notifications
You must be signed in to change notification settings - Fork 781
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
VM Bugfixes #870
VM Bugfixes #870
Conversation
…n the same block [VM] lint
…y padded buffers [VM] lint
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
WIP because: (1) will write unit tests for these situations (2) have to cleanup this padding stuff |
Added tests. The cache situation is rather complex, I wanted to find the situation which I found in the mainnet blocks, but it seems to be rather complex. It has to do with the final state not being committed (because if it is commited, then the cache was originally cleared too). If it is reverted the originally cache was not cleared. But this leads to a rather complex situation, so I have only added a simple test. |
Huh, this is confusing, now the tests are failing 😢 Will fix soon. |
Tests failing was #729-related again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a lot better than the first version, great, thanks Jochem for the update. And actually really important bug fixes since especially these "only occur under very special conditions" bugs are really hard to track but make the VM "feeling" less reliable since they WILL get triggered unpredictably every now and then.
So: really cool. 😄
Will merge and hopefully integrate correctly into #853
gas refund | ||
sstoreCleanRefundEIP2200 4200 | ||
gas used | ||
10012 - 4200 = 5812 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jochem, I am really learning a lot here on how to set up opcode based test cases (+ the associated gas cost analysis), really great!
@jochem-brouwer update: ah, just realize that you already removed these fixes from #853, thanks for doing that! 😄 Then I will just do a "normal" rebase on this branch and push-force to update to latest |
Update: just realizing that some API tests are still failing on this branch. A bit tricky, this was not triggered since not all API tests were running here. This is due to the @jochem-brouwer can you please have a look into this and open a fixing PR? It seems to me that some of the changes here might have had side effects which were not visible/triggered before. |
Hi @jochem-brouwer, can confirm that the failing API tests have been fixed along #872, so no worries here! 😄 |
@holgerd77 great thanks for letting me know! Is there also a CI fix in place somewhere which ensures all tests are being ran? |
@jochem-brouwer yes, that has been fixed along one of my last PRs (where I actually wasn't aware of myself, just discovered that this change is "in" and had to look this up myself 😅 ) |
This PR fixes two bugs in the VM which appeared when we ran mainnet blocks in #853
They both have to do with Istanbul SSTORE gas calculation: the first fixes that the storage cache is only wiped after a block (if two txs write the same storage, then this slot is cached and there are some gas refunds which you get in the VM which should not happen). The second is checking if the slot has the same value; they can have the same value, but due to wrongly padded Buffers the VM thinks that the values are different. (i.e. the buffers
0x01
and0x0001
are semantically in the VM the same value, but the Buffers are obviously not equal).