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: implement Jumpdest caching in account storage #839

Open
Tracked by #825
enitrat opened this issue Aug 20, 2024 · 4 comments
Open
Tracked by #825

feat: implement Jumpdest caching in account storage #839

enitrat opened this issue Aug 20, 2024 · 4 comments
Assignees
Labels
blocked timebox-1hr 1 Hour exploration - tinkering

Comments

@enitrat
Copy link
Collaborator

enitrat commented Aug 20, 2024

In an effort to optimize step consumption when executing transactions, we can run analysis on bytecode upon deployment of a contract and save all valid jumpdests indexes in a contract's storage.

When a jump is performed later on, we can load whether the jump index is valid by reading the contract storage, and caching this value for later uses.

References:
https://github.com/kkrt-labs/kakarot/blob/65e333a0d3475e81b0a6367b0f00561c763da0a0/src/kakarot/evm.cairo#L314-L338
https://github.com/kkrt-labs/kakarot/blob/65e333a0d3475e81b0a6367b0f00561c763da0a0/src/kakarot/accounts/library.cairo#L413-L430
https://github.com/kkrt-labs/kakarot/blob/65e333a0d3475e81b0a6367b0f00561c763da0a0/src/kakarot/accounts/library.cairo#L403-L411
https://github.com/kkrt-labs/kakarot/blob/65e333a0d3475e81b0a6367b0f00561c763da0a0/src/backend/starknet.cairo#L214-L221

@enitrat enitrat changed the title Implement Jumpdest caching in account storage feat: implement Jumpdest caching in account storage Aug 20, 2024
@enitrat enitrat added good first issue Good for newcomers timebox-1hr 1 Hour exploration - tinkering labels Aug 22, 2024
@ScottyDavies
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have a background in building efficient and responsive user experiences, can be greatly leveraged in the context of the Kakarot project. Understanding the optimization techniques used in the backend allows me to create a user interface that seamlessly complements the performance-driven approach of the Kakarot team.

How I plan on tackling this issue

I would approach this issue with following steps

1 Performance Optimization:
My experience in optimizing web application performance will enable me to integrate the backend's caching mechanism in a way that minimizes the computational overhead on the frontend. This will result in faster transaction processing and a more responsive application, providing users with a smooth and efficient experience.
2 User Feedback:
Leveraging the cached jump destination information, I can design intuitive user interfaces that provide clear and meaningful feedback to users during the transaction process. This could include displaying dynamic loading indicators, progress bars, and other visual cues that keep users informed about the status of their transactions.
3 Error Handling:
By understanding the backend's validation of jump destinations, I can develop robust error handling mechanisms on the frontend. This will allow me to present users with informative error messages that guide them on how to troubleshoot issues, improving the overall user experience.
4 Caching and Optimization:
Drawing on my expertise in frontend optimization, I can explore ways to further cache and reuse the validated jump destination information on the client-side. This will reduce the need for repeated backend calls, leading to improved responsiveness and a more efficient user interface.
5 Integration and Collaboration:
My background in frontend development and my understanding of the backend optimization techniques will enable me to work closely with the Kakarot team, fostering a collaborative environment. This collaboration will ensure that the user interface seamlessly integrates with the performance-driven backend, creating a cohesive and user-friendly application.

@ShantelPeters
Copy link

ShantelPeters commented Aug 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a frontend and smart contract developer . with this experience i will tackle the issue as expected this will be done between 3 to 4 working days please assign

How I plan on tackling this issue

To solve this problem i would do the following ;

  1. Bytecode Analysis: Implement a mechanism to analyze the contract's bytecode during deployment to identify all valid jumpdest indexes.

  2. Store Valid Jumpdests: Save these valid jumpdest indexes in the contract's storage for efficient retrieval during transaction execution.

  3. Optimize Jumps: During a jump, load the jump index from storage to check its validity. Implement caching to reduce storage read operations in future jumps.

  4. Reference Existing Code: Leverage the provided code references to integrate this functionality within

@DIWAKARKASHYAP
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a full stack web and blockchain developer on ethereum chain and also a opensource contributor https://diwakar-portfolio.vercel.app/, i think i am a perfect fit for this issue

@obatirou obatirou self-assigned this Aug 27, 2024
@obatirou
Copy link
Contributor

obatirou commented Sep 2, 2024

This issue is blocked by starkware-libs/cairo#6265
It could be implemented with an array with .contains but might be expensive. A benchmark could be done with end2end tests once integrated (#848) but not planned for now due a possible monorepo migration.

WIP implementation (far from ready, needs refactoring and improvements but can be used as inspiration): main...obatirou:kakarot-ssj:cache-jumpdest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked timebox-1hr 1 Hour exploration - tinkering
Projects
Status: 🆕 Backlog
Development

No branches or pull requests

5 participants