Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

docs: evm-machine design doc #351

Merged
merged 6 commits into from
Sep 22, 2023
Merged

docs: evm-machine design doc #351

merged 6 commits into from
Sep 22, 2023

Conversation

enitrat
Copy link
Contributor

@enitrat enitrat commented Sep 14, 2023

Pull Request type

In this design document, we dive into a refactor of the Kakarot's EVM-Machine implementation, compatible with Cairo's limitations raised in starkware-libs/cairo#4032.
The accepted proposed design will need to:

  • Be easily refactorable
  • Have a low overhead cost compared to the one originally planned
  • Not introduce development complexity in other parts of the code

I believe that the proposed one performs well in all the points mentioned above. Please discuss it extensively!

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Resolves: #

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Copy link
Member

@Eikix Eikix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the limitations of this approach?

@enitrat
Copy link
Contributor Author

enitrat commented Sep 15, 2023

What are the limitations of this approach?

It's a bit more expensive as we need to track each stack/memory's context-related segment length in a dict instead of as a simple variable.
Also, this imposes a limit on the maximum amount of memory space a context can allocate.

@Eikix
Copy link
Member

Eikix commented Sep 15, 2023

What are the limitations of this approach?

It's a bit more expensive as we need to track each stack/memory's context-related segment length in a dict instead of as a simple variable.

Also, this imposes a limit on the maximum amount of memory space a context can allocate.

Let's discuss it in our weekly
What is the limit on memory space per context?

@enitrat
Copy link
Contributor Author

enitrat commented Sep 15, 2023

the gas costs required to have a memory containing
125000 words is above the 30M gas limit. We will use this heuristic to bound the
maximum size of the memory to 125000 256-bits words. Therefore, we will bound
the maximum size of the memory to 125000 256-bits words.

@enitrat enitrat changed the title [WIP] docs: evm-machine design doc docs: evm-machine design doc Sep 18, 2023
@enitrat enitrat marked this pull request as ready for review September 18, 2023 11:29
@enitrat
Copy link
Contributor Author

enitrat commented Sep 19, 2023

@Eikix If you're okay with it I propose to merge the current design proposal, and to apply any modifications from SW's feedback in a new PR

@enitrat
Copy link
Contributor Author

enitrat commented Sep 21, 2023

@Eikix Reworked this:

  • Changes brought to the ExecutionContext docs
  • The Storage section has been entirely reworked

@enitrat
Copy link
Contributor Author

enitrat commented Sep 22, 2023

@Eikix Changes applied

Copy link
Member

@Eikix Eikix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🔥

Copy link
Member

@Eikix Eikix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb just noticed this PR does not have mentions of "dirtyStorage"?
is dirtyStorage the equivalent of local_changes?
should we modify the other pr #360

@enitrat
Copy link
Contributor Author

enitrat commented Sep 22, 2023

mb just noticed this PR does not have mentions of "dirtyStorage"?
is dirtyStorage the equivalent of local_changes?
should we modify the other pr #360

dirtyStorage is a name that is unique to Geth. For us, it's the combination of local_changes and global_changes.

@Eikix Eikix added this pull request to the merge queue Sep 22, 2023
Merged via the queue into main with commit 4026372 Sep 22, 2023
@Eikix Eikix deleted the docs/evm-design-doc branch September 22, 2023 11:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants