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: Fix issue with incorrect recognition of initial writes #247

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

mm-zk
Copy link
Collaborator

@mm-zk mm-zk commented Dec 19, 2023

What 💻

  • Fixed a bug with incorrect marking of initial writes, which resulted in larger pubdata estimation when replaying transactions

Why ✋

  • Each write to storage means, that we have to charge user some pubdata, to cover the cost of writing this data down to L1. But the costs are a little bit lower, if we had written this key in the past (we charge 32 bytes for the first write of the key, and 4 bytes for subsequents writes)
  • This improves the gas computation correctness - which is important when replaying the transactions that use close to their gas limit (like the one below - 0xb0f917b869172db5123e7a63bc0f9ef4fa7498f1db34d094250087578136fde6)

Evidence 📷

We are still around 100 gas off, but before this fix, the delta was over 50k

image

image

@mm-zk mm-zk requested a review from a team as a code owner December 19, 2023 08:43
Copy link
Collaborator

@MexicanAce MexicanAce left a comment

Choose a reason for hiding this comment

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

LGTM, worst case we over estimate once.

Thought about adding a warning about this in the console, but don't know if it's really worth it

@mm-zk mm-zk changed the title Fix issue with incorrect recognition of initial writes fix: Fix issue with incorrect recognition of initial writes Dec 19, 2023
@mm-zk mm-zk merged commit b4a7c06 into main Dec 19, 2023
11 of 12 checks passed
@mm-zk mm-zk deleted the 1219_fix_initial_writes branch December 19, 2023 14:14
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