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

dev: Explore how we architect "Contract Account" to store bytecode as 32 or 16 bytes instead of 1-byte / storage #55

Closed
1 of 2 tasks
danilowhk opened this issue Aug 7, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@danilowhk
Copy link
Contributor

danilowhk commented Aug 7, 2023

Describe the Feature Request

On Cairo 0, we are currently storing all bytecodes as 1-byte data. So for a 10Kb contract, we are triggering 10.000 stores(when deploying the contract) and also 10.000 reads(on any contract call), which is expensive as for every storage or read a hash is calculated.

With storage improvement to 32 or 16 bytes, we decrease the amount of store and reads.

Describe Preferred/Possible Solution

  1. Use storage index: Besides storing 32/16 bytes for each storage, once the hash for the storage location is calculated we can access up to 256 more slots by adding to the index.

  2. Use dw(currently not possible). We could use dw to store the code in the contract and just access them as needed.

Related Code

Additional Context

If the feature request is approved, would you be willing to submit a PR?
(Help can be provided if you need assistance submitting a PR)

  • Yes
  • No
@danilowhk danilowhk added the enhancement New feature or request label Aug 7, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Kakarot on Starknet Aug 7, 2023
@danilowhk danilowhk changed the title dev: Explore how we architect "Contract Contract" to store bytecode as 32 or 16 bytes instead of 1-byte / storage dev: Explore how we architect "Contract Account" to store bytecode as 32 or 16 bytes instead of 1-byte / storage Aug 7, 2023
@Eikix Eikix added this to the Kakarot Cairo Migration milestone Aug 29, 2023
@Eikix
Copy link
Member

Eikix commented Sep 6, 2023

Closing as PR and design will encompass it #279
Also this issue isn't accurate, as we already pack 16 bytes into storage for bytecode

@Eikix Eikix closed this as completed Sep 6, 2023
@github-project-automation github-project-automation bot moved this from 🆕 Backlog to ✅ Done in Kakarot on Starknet Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants