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: return min refund when gas_price=0 #3363

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dimazhornyk
Copy link
Contributor

What ❔

Return the minimal possible refund when effective_gas_price=0 to avoid division by zero

Why ❔

When we set the gas fees to zero, the execution breaks at this point due to division by zero

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zkstack dev fmt and zkstack dev lint.

@@ -116,6 +116,9 @@ impl<S> RefundsTracer<S> {

// For now, bootloader charges only for base fee.
let effective_gas_price = get_batch_base_fee(&self.l1_batch);
if effective_gas_price == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Talked in private: it is a breaking change, but most likely it is fine. Still, it is better to be able to somehow check that the partners (and Era itself) are not affected

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @StanislavBreadless

  • What if we safeguard it behind a feature toggle?
  • What is the scenario that we need to check for?

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.

3 participants