Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

chore: Introduce end handle #35

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Conversation

rakita
Copy link

@rakita rakita commented Oct 24, 2023

Introduce end_handle that allows handler to catch all errors.

used inside Optimism to catch deposit transaction error and make into Halt.

Comment on lines 172 to 184
#[inline]
fn transact_preverified(&mut self) -> EVMResult<DB::Error> {
let output = self.transact_preverified_inner();
self.handler.end(&mut self.data, output)
}

#[inline]
fn transact(&mut self) -> EVMResult<DB::Error> {
let output = self
.preverify_transaction()
.and_then(|()| self.transact_preverified());
self.handler.end(&mut self.data, output)
}
Copy link

Choose a reason for hiding this comment

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

This looks safe since OP's end handler will convert the Transaction error over to a Halt variant, making the double-run not happen, but is a bit confusing at first glance. Is there a reason we've split up the end handler calls like this rather than just chaining in transact?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, this is not correct, and we should use *_inner() calls. Will make the change.

Copy link

@clabby clabby left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@clabby clabby merged commit e7ce395 into op-rs:cl/op-exec-patches Oct 25, 2023
@rakita rakita deleted the end_handle branch October 25, 2023 15:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants