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

gas-optimize deposit #390

Merged
merged 2 commits into from
Jan 3, 2024
Merged

gas-optimize deposit #390

merged 2 commits into from
Jan 3, 2024

Conversation

drortirosh
Copy link
Contributor

update storage mapping for major use-case (handleOps)
deposit as uint256 makes handling deposit in handleOps slightly cheaper (300gas per op).
probably makes stake() cost a little higher (up to 15000 more, though didn't check its cost) - but that's one-time, even for the paymaster...

update storage mapping for major use-case (handleOps)
if (x == 123) {
return;
unchecked{
uint g = gasleft();
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's going on here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its a code to waste some gas... we must make sure that the simulation contract always takes more gas, otherwise, it can be used to attack the bundler.
The previous "gas waster" didn't pass the tests, but wasn't easily adaptable, so I changed it to waste gas in a loop.
Strangely, the different functions (with/without value, using fallback or "depositTo") have different delta from the real entrypoint code. so I had to make sure it is above for all.

@drortirosh drortirosh merged commit 67b5099 into develop Jan 3, 2024
8 checks passed
@drortirosh drortirosh deleted the optimize-deposit branch January 3, 2024 14:52
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