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

chore: update document #601

Merged
merged 11 commits into from
Dec 5, 2023
12 changes: 6 additions & 6 deletions docs/advanced/bytecode_compression.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

As we are a rollup - all the bytecodes that contracts use in our chain must be copied into L1 (so that the chain can be
As we are a rollup - all the bytecodes that contracts used in our chain must be copied into L1 (so that the chain can be
reconstructed from L1 if needed).

Given the want/need to cutdown on space used, bytecode is compressed prior to being posted to L1. At a high level
Expand Down Expand Up @@ -31,7 +31,7 @@ Dictionary would be:
3 -> 0xC (count: 1)
```

Note that '1' maps to '0xD', as it occurs twice, and first occurrence is earlier than first occurrence of 0xB, that also
Note that '1' maps to '0xD', as it occurs twice, and first occurrence is earlier than first occurence of 0xB, that also
occurs twice.

Compressed bytecode:
Expand Down Expand Up @@ -99,10 +99,10 @@ with no change to the underlying algorithm.
### Verification & Publication

The function `publishCompressBytecode` takes in both the original `_bytecode` and the `_rawCompressedData` , the latter
of which comes from the output of the server’s compression algorithm. Looping over the encoded data, derived from
`_rawCompressedData` , the corresponding chunks are pulled from the dictionary and compared to the original byte code,
reverting if there is a mismatch. After the encoded data has been verified, it is published to L1 and marked accordingly
within the `KnownCodesStorage` contract.
of which comes from the server’s compression algorithm output. Looping over the encoded data, derived from
`_rawCompressedData` , the corresponding chunks are retrieved from the dictionary and compared to the original byte
code, reverting if there is a mismatch. After the encoded data has been verified, it is published to L1 and marked
accordingly within the `KnownCodesStorage` contract.

Pseudo-code implementation:

Expand Down