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

Use 16kib leaf sizes when calculating code roots #434

Closed
Voxelot opened this issue May 2, 2023 · 3 comments · Fixed by #450
Closed

Use 16kib leaf sizes when calculating code roots #434

Voxelot opened this issue May 2, 2023 · 3 comments · Fixed by #450
Assignees

Comments

@Voxelot
Copy link
Member

Voxelot commented May 2, 2023

Spec change: FuelLabs/fuel-specs#476

Improve the performance of calculating code roots by using a larger leaf size in the merkle tree to 16kib.

  • Chunk bytecode and predicate code by 16kib chunks.
  • Zero pad chunks out to the nearest multiple of 8 bytes if they are < 16kib. For example: if a predicate is only 500bytes, it should be padded out to 504 bytes no 16 kib.
@freesig
Copy link
Contributor

freesig commented May 18, 2023

@Voxelot What is the purpose of the padding?

@bvrooman
Copy link
Contributor

Zero pad chunks out to the nearest multiple of 8 bytes if they are < 16kib. For example: if a predicate is only 500bytes, it should be padded out to 508 bytes no 16 kib.

To be clear: 500 is already not divisible by 8; i.e. 500 mod 8 = 4. Do you mean that 500 bytes would be zero padded to 504 bytes, since 504 mod 8 = 0?

@Voxelot
Copy link
Member Author

Voxelot commented May 25, 2023

@Voxelot What is the purpose of the padding?

To preserve the original padding we used of 8 bytes. This is likely somewhat arbitrary though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants