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

Direct fail create tx rather than throwing exceptions #7436

Merged
merged 3 commits into from
Sep 16, 2024
Merged

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Sep 15, 2024

Changes

  • Direct fail create tx rather than throwing exceptions (which are expensive) to immediately catch

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

@@ -526,8 +526,7 @@ protected virtual void ExecuteEvmCall(

if (substate.ShouldRevert || substate.IsError)
{
if (Logger.IsTrace)
Logger.Trace("Restoring state from before transaction");
if (Logger.IsTrace) Logger.Trace("Restoring state from before transaction");
Copy link
Member

Choose a reason for hiding this comment

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

goto Fail; here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

You get redund on revert would cause it to skip

spentGas = Refund...

}
catch (Exception ex) when (ex is EvmException or OverflowException) // TODO: OverflowException? still needed? hope not
{
if (Logger.IsTrace) Logger.Trace($"EVM EXCEPTION: {ex.GetType().Name}:{ex.Message}");
WorldState.Restore(snapshot);
Copy link
Member

Choose a reason for hiding this comment

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

goto Fail; here too? (probably not needed as it is next instruction?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Just falls through

@benaadams benaadams merged commit f601699 into master Sep 16, 2024
66 checks passed
@benaadams benaadams deleted the fail-create-tx branch September 16, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants