-
Notifications
You must be signed in to change notification settings - Fork 177
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
Fix class cache serving non-declared classes in some edge cases #1571
Conversation
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.
Nice. A comment explaining why it's <
and not <=
might be helpful.
Above explanation is in the commit message as well. If you think that is not enough, I can copy it as a comment as well. |
I feel a comment is warranted here since it's kind of counter-intuitive and not explained by the code immediately surrounding the change. |
340d0a3
to
eab2ee5
Compare
The initial assumption here was that `self.height` uniquely identifies and strictly orders the underlying state instances. The first assumption doesn't necessarily hold, because we can pass different state instaces with the same height. This most commonly happens with call/estimate/simulate and trace flows. Trace flow calls the VM for block number N with the state at the beginning of the block, while call/estimate/simulate flows call the VM with the same block number but with the state at the end of that block. That is why, we cannot use classes from cache if they are cached on the same height that we are executing on. Because they might be cached using a state instance that is in the future compared to the state that we are currently executing on, even tho they have the same height.
eab2ee5
to
b94cdf9
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1571 +/- ##
=======================================
Coverage 72.97% 72.98%
=======================================
Files 97 97
Lines 10017 10017
=======================================
+ Hits 7310 7311 +1
+ Misses 2165 2164 -1
Partials 542 542 ☔ View full report in Codecov by Sentry. |
The initial assumption here was that `self.height` uniquely identifies and strictly orders the underlying state instances. The first assumption doesn't necessarily hold, because we can pass different state instaces with the same height. This most commonly happens with call/estimate/simulate and trace flows. Trace flow calls the VM for block number N with the state at the beginning of the block, while call/estimate/simulate flows call the VM with the same block number but with the state at the end of that block. That is why, we cannot use classes from cache if they are cached on the same height that we are executing on. Because they might be cached using a state instance that is in the future compared to the state that we are currently executing on, even tho they have the same height.
The initial assumption here was that `self.height` uniquely identifies and strictly orders the underlying state instances. The first assumption doesn't necessarily hold, because we can pass different state instaces with the same height. This most commonly happens with call/estimate/simulate and trace flows. Trace flow calls the VM for block number N with the state at the beginning of the block, while call/estimate/simulate flows call the VM with the same block number but with the state at the end of that block. That is why, we cannot use classes from cache if they are cached on the same height that we are executing on. Because they might be cached using a state instance that is in the future compared to the state that we are currently executing on, even tho they have the same height.
The initial assumption here was that `self.height` uniquely identifies and strictly orders the underlying state instances. The first assumption doesn't necessarily hold, because we can pass different state instaces with the same height. This most commonly happens with call/estimate/simulate and trace flows. Trace flow calls the VM for block number N with the state at the beginning of the block, while call/estimate/simulate flows call the VM with the same block number but with the state at the end of that block. That is why, we cannot use classes from cache if they are cached on the same height that we are executing on. Because they might be cached using a state instance that is in the future compared to the state that we are currently executing on, even tho they have the same height.
The initial assumption here was that
self.height
uniquely identifies and strictly orders the underlying state instances. The first assumption doesn't necessarily hold, because we can pass different state instaces with the same height. This most commonly happens with call/estimate/simulate and trace flows. Trace flow calls the VM for block number N with the state at the beginning of the block, while call/estimate/simulate flows call the VM with the same block number but with the state at the end of that block. That is why, we cannot use classes from cache if they are cached on the same height that we are executing on. Because they might be cached using a state instance that is in the future compared to the state that we are currently executing on, even tho they have the same height.