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

fix: call create_end for all code paths #362

Merged
merged 2 commits into from
Feb 12, 2023
Merged

Conversation

Wodann
Copy link
Contributor

@Wodann Wodann commented Feb 8, 2023

No description provided.

interpreter.gas,
bytes,
)
};
Copy link
Member

Choose a reason for hiding this comment

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

This is not exactly the pattern used elsewhere

if INSPECT {
let (ret, address, gas, out) = self.inspector.create(&mut self.data, inputs);
if ret != InstructionResult::Continue {
return self
.inspector
.create_end(&mut self.data, inputs, ret, address, gas, out);
}
}

by default create_end would return ::Continue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't Inspector::create_end supposed to be called for every possible reason the create function might end?

Copy link
Contributor Author

@Wodann Wodann Feb 10, 2023

Choose a reason for hiding this comment

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

by default create_end would return ::Continue

And doesn't the default implementation of create_end return ret?

fn create_end(
&mut self,
_data: &mut EVMData<'_, DB>,
_inputs: &CreateInputs,
ret: InstructionResult,
address: Option<B160>,
remaining_gas: Gas,
out: Bytes,
) -> (InstructionResult, Option<B160>, Gas, Bytes) {
(ret, address, remaining_gas, out)
}

@Wodann
Copy link
Contributor Author

Wodann commented Feb 10, 2023

I made sure create_end is now called for all return code paths

@Wodann Wodann changed the title fix: call create_end when contract size exceeds limit fix: call create_end for all code paths Feb 10, 2023
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

nice pattern!

@rakita rakita merged commit e22c3f3 into bluealloy:main Feb 12, 2023
@Wodann Wodann mentioned this pull request May 3, 2023
7 tasks
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