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

feat(sc): improved bytecode compression validity checks #193

Conversation

benceharomi
Copy link
Member

@benceharomi benceharomi commented Feb 2, 2024

What ❔

Improved the publishCompressedBytecode function to have better compressed bytecode validity checks.

Now it also reverts if there are more dictionary entries than encoded data entries.

Created a connecting PR that fixes the example found in the documentation that explains bytecode compression: matter-labs/zksync-era#1013

Why ❔

We would like to assure that the operators are not able to consume all of the gas payed by the user without receiving any execution.

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.

system-contracts/contracts/Compressor.sol Outdated Show resolved Hide resolved
system-contracts/contracts/Compressor.sol Outdated Show resolved Hide resolved
system-contracts/contracts/Compressor.sol Outdated Show resolved Hide resolved
@benceharomi benceharomi changed the base branch from dev to kl-factory March 4, 2024 11:29
@vladbochok vladbochok merged commit 2118e77 into kl-factory Mar 5, 2024
11 checks passed
@vladbochok vladbochok deleted the bh-evm-321-enforce-correct-relatively-optimal-compression-for-bytecodes branch March 5, 2024 14:57
github-merge-queue bot pushed a commit to matter-labs/zksync-era that referenced this pull request Apr 18, 2024
## What ❔
Updated the bytecode compression explanation example, to be valid and
working.

In the connecting contracts PR:
matter-labs/era-contracts#193 I added a test
that checks the bytecode and runs the `publishCompressBytecode` function
with the bytecode from this example.

## Why ❔
The previous example was not valid, it could confuse newcomers, because
the example had different bytecode compared to what was described.

## Checklist
- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk fmt` and `zk lint`.
- [x] Spellcheck has been run via `zk spellcheck`.
- [x] Linkcheck has been run via `zk linkcheck`.
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.

None yet

2 participants