-
Notifications
You must be signed in to change notification settings - Fork 122
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
EVM backend overlay #2611
EVM backend overlay #2611
Conversation
}) | ||
} | ||
|
||
pub fn increase_tx_count(&mut self) { |
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.
Will renaming this method to something like cache_state make it more readable?
if let Some(existing_storage) = self.storage(&address) { | ||
for (k, v) in existing_storage { | ||
storage.entry(*k).or_insert_with(|| *v); | ||
} | ||
} |
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.
Not sure if I am seeing this correctly, but it seems like by doing this, we could potentially overwrite the current storage state with an old value with the same key in the existing storage?
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.
Yes, in the case where we would write multiple time to the same storage slot in a block (such as TD total_supply), we would overwrite the current storage with the updated value
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.
Isn't existing_storage the old value? Meaning that we are overwriting the updated value with the old value?
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.
So it keeps the storage
entry as is with .entry(*k)
or if the key does not exist in storage, insert the existing key val from existing_storage. Feels correct but we can add some test if needed
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.
Logic could probably be reversed since we can assume that existing_storage
will grow and be on average bigger than storage
This reverts commit 07ba855.
* Revert "EVM backend overlay (#2611)" This reverts commit 07ba855. * Pass str copy to prevent incorrect lambda optimizations * Add pre-cache with minimal locking * fmt * Revert "Revert "EVM backend overlay (#2611)"" This reverts commit f8106f2. * Minor refactors, eager caching * Add WaitForCompletion --------- Co-authored-by: jouzo <[email protected]> Co-authored-by: Jouzo <[email protected]>
Summary
EVMBackend
inBlockTemplate
construct_block
remove_txs_above_hash
)