This repository was archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 270
Enforce ExecutionState transition
#110
Merged
han0110
merged 4 commits into
privacy-ethereum:master
from
han0110:feature/execution-state-transition
Mar 1, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2e2e3a7
feat: add all exceptions and prepare using ResponsibleOpcode for all
han0110 d7db010
feat: add constrain_execution_state_transition when not is_last_step
han0110 2501f3f
feat: add InvalidOpcode, StackOverflow, StackUnderflow, StateWrite in…
han0110 4a9df55
fix: typo of table_assignments
han0110 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,24 +15,26 @@ def verify_steps( | |||||||
| begin_with_first_step: bool = False, | ||||||||
| end_with_last_step: bool = False, | ||||||||
| ): | ||||||||
| # TODO: Enforce general ExecutionState transition constraint | ||||||||
| # For the last step, the next step is meaningless | ||||||||
| if end_with_last_step: | ||||||||
| steps += [None] | ||||||||
|
|
||||||||
| for idx in range(len(steps) - 1): | ||||||||
| curr, next = steps[idx], steps[idx + 1] | ||||||||
|
Comment on lines
+22
to
+23
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could do something like
Suggested change
This works even if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just found we still need the |
||||||||
|
|
||||||||
| for idx in range(len(steps) if end_with_last_step else len(steps) - 1): | ||||||||
| verify_step( | ||||||||
| Instruction( | ||||||||
| randomness=randomness, | ||||||||
| tables=tables, | ||||||||
| curr=steps[idx], | ||||||||
| next=steps[idx + 1] if idx + 1 < len(steps) else None, | ||||||||
| curr=curr, | ||||||||
| next=next, | ||||||||
| is_first_step=begin_with_first_step and idx == 0, | ||||||||
| is_last_step=idx + 1 == len(steps), | ||||||||
| ), | ||||||||
| is_last_step=end_with_last_step and next is None, | ||||||||
| ) | ||||||||
| ) | ||||||||
|
|
||||||||
|
|
||||||||
| def verify_step( | ||||||||
| instruction: Instruction, | ||||||||
| ): | ||||||||
| def verify_step(instruction: Instruction): | ||||||||
| if instruction.is_first_step: | ||||||||
| instruction.constrain_equal(instruction.curr.execution_state, ExecutionState.BeginTx) | ||||||||
|
|
||||||||
|
|
@@ -43,3 +45,5 @@ def verify_step( | |||||||
|
|
||||||||
| if instruction.is_last_step: | ||||||||
| instruction.constrain_equal(instruction.curr.execution_state, ExecutionState.EndBlock) | ||||||||
| else: | ||||||||
| instruction.constrain_execution_state_transition() | ||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.