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: access initial state in the middle of a transaction #32

Closed
ClementWalter opened this issue Sep 18, 2024 · 0 comments · Fixed by #249
Closed

feat: access initial state in the middle of a transaction #32

ClementWalter opened this issue Sep 18, 2024 · 0 comments · Fixed by #249
Assignees

Comments

@ClementWalter
Copy link
Member

ClementWalter commented Sep 18, 2024

Why

In the kakarot implementation, we use Starknet contract storage as the backend for data and fetch data on the fly when required.

What

  • In the os.cairo, create a initial_state = state before apply_transactions
  • give this in implicit argument to apply_transactions and Interpreter.execute
  • add to the Message struct the initial_state
  • when finalizing a context, the parent message needs to be updated with the initial_state of the child
  • in the end of the os, after apply_transactions, finalize the initial_state
  • read from the initial_state in exec_sstore instead of Account.fetch_original_storage :
tempvar initial_state = evm.message.initial_state
State.read_storage{state=initial_state}(evm.message.address, key)
tempvar message = Message(..., initial_state=initial_state, ...)
  • remove Account.fetch_original_storage
  • for the test, add in test_memory_operations.cairo 2 cases for sstore: one with original_value == current_value and one with original_value != current_value
@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Kakarot on Starknet Sep 18, 2024
@ClementWalter ClementWalter changed the title fix: use parent.state whene kakarot fetches from starknet fix: use parent.state when kakarot fetches from starknet Sep 18, 2024
@ClementWalter ClementWalter removed this from Keth Nov 28, 2024
@ClementWalter ClementWalter removed this from Keth Nov 28, 2024
@ClementWalter ClementWalter moved this to Todo in Keth Nov 28, 2024
@ClementWalter ClementWalter added this to the EF tests no state root milestone Nov 28, 2024
@ClementWalter ClementWalter moved this from Todo to Backlog in Keth Nov 28, 2024
@ClementWalter ClementWalter changed the title fix: use parent.state when kakarot fetches from starknet feat: access initial state in the middle of a transaction Nov 28, 2024
@ClementWalter ClementWalter moved this from Backlog to Todo in Keth Dec 6, 2024
@obatirou obatirou self-assigned this Dec 9, 2024
@obatirou obatirou moved this from Todo to In progress in Keth Dec 10, 2024
@obatirou obatirou moved this from In progress to In review in Keth Dec 11, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Keth Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Status: 🆕 Backlog
Development

Successfully merging a pull request may close this issue.

2 participants