Skip to content

Commit

Permalink
fix: typos in binary layout document (#144)
Browse files Browse the repository at this point in the history
<!--

Thank you for contributing to the ZKsync Docs!

Before submitting the PR, please make sure you do the following:

- Update your PR title to follow [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- Read the [Contributing
Guide](https://github.com/matter-labs/zksync-docs/blob/main/CONTRIBUTING.md).
- Understand our [Code of
Conduct](https://github.com/matter-labs/zksync-docs/blob/main/CODE_OF_CONDUCT.md)
- Please delete any unused parts of the template when submitting your PR

-->

# Description

Correct typos in the binary layout description.
<!-- Please describe what are the changes and what they are solving for
in this PR. -->

Co-authored-by: Sabrina <[email protected]>
  • Loading branch information
sayon and itsacoyote authored Jun 26, 2024
1 parent 2ae8367 commit 8fb623b
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The `.cell` directive defines data:

```asm
.rodata
.cell 0
.cell -1
.cell 23090
.data
.cell 1213
Expand Down Expand Up @@ -274,7 +274,7 @@ Will be translated as if it were written this way:
.text
init_globals:
incsp 1
add stack[0], code[@global_init_0]
add code[@global_init_0], r0, stack[0]
some_label:
sub! r0, r0, r0
Expand Down Expand Up @@ -337,18 +337,23 @@ DEFAULT_FAR_REVERT:

#### Code padding

The code section starts at 0, if we count the initializing code as its part.
Therefore, it is aligned on a 32 byte boundary.
If the total number of instructions, with the landing pads, is not divisible by
4, the assembler emits 1 to 3 `INVALID` instructions as a padding.
This way, the instructions will fill a certain number of words completely.
This way, the instructions will fill a certain number of words completely, and
the following region (constant pool region) is aligned on a 32 byte boundary as
well.

### Constant pool region

The constant pool region is placed immediately after the code region and contains:
The constant pool region is aligned on a 32 byte boundary.
It is placed immediately after the code region and contains:

- Constants defined in `.rodata` section.
- Initializers for mutable globals.
- Padding: nothing or a zero-word to ensure, that the length of the binary file
measures as an odd number of words.
measures as an odd number of words.
- **Metadata Hash**.

### Metadata Hash
Expand Down

0 comments on commit 8fb623b

Please sign in to comment.