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

Add helper methods to EvmContext #1156

Closed
DaniPopes opened this issue Mar 5, 2024 · 0 comments · Fixed by #1158
Closed

Add helper methods to EvmContext #1156

DaniPopes opened this issue Mar 5, 2024 · 0 comments · Fixed by #1158
Labels
feature New feature or lib ability good first issue Good for newcomers

Comments

@DaniPopes
Copy link
Collaborator

Helper wrapper methods can be added to all of the methods in JournaledState that require a DB on EvmContext by just passing along all arguments to self.journaled_state.<method>(..., &mut self.db).

E.g. load_code:

// JournaledState
impl JournaledState {
    pub fn load_code<DB: Database>(
        &mut self,
        address: Address,
        db: &mut DB,
    ) -> Result<(&mut Account, bool), EVMError<DB::Error>> { /* ... */ }
}

// Wrapper in EvmContext
impl<DB: Database> EvmContext<DB> {
    pub fn load_code(
        &mut self,
        address: Address
    ) -> Result<(&mut Account, bool), EVMError<DB::Error>> { // same result
        self.journaled_state.load_code(address, &mut self.db)
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or lib ability good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant