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

Impl eth_call state override feature #3027

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Pana
Copy link
Member

@Pana Pana commented Jan 2, 2025

This change is Reviewable

@Pana Pana requested a review from ChenxingLi January 2, 2025 07:36
Copy link
Contributor

@ChenxingLi ChenxingLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 18 files at r1, all commit messages.
Reviewable status: 11 of 18 files reviewed, 4 unresolved discussions (waiting on @Pana)


crates/cfxcore/executor/src/state/overlay_account/mod.rs line 187 at r1 (raw file):

    /// Inditcates if this account's storage entries and lazily loaded fields on
    /// db are marked invalid (so an entry is empty if not in cache).
    pub fn fresh_storage(&self) -> bool {

fresh_storage should take storage_overrided into consideration.


crates/cfxcore/executor/src/state/state_object/state_override.rs line 26 at r1 (raw file):

            };

            self.prefetch(&addr_with_space, RequireFields::Code)?;

I think the following logic should be in the initialization of OverlayAccount, by adding a function like new_loaded_with_overrided, rather than repeatedly modifying the OverlayAccount here through state.


crates/cfxcore/executor/src/state/overlay_account/storage.rs line 201 at r1 (raw file):

        Ok(if let Some(value) = self.cached_entry_at(key) {
            value
        } else if self.fresh_storage() || self.storage_overrided {

Update fresh_storage and remove this.


crates/cfxcore/executor/src/state/overlay_account/storage.rs line 245 at r1 (raw file):

    // used for state override.diff
    pub fn update_storage_read_cache(&mut self, key: Vec<u8>, value: U256) {
        let owner = if self.address.space == Space::Native {

Assert empty checkpoint here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants