-
Notifications
You must be signed in to change notification settings - Fork 348
feat: pass StateOracle as a parameter to state_transition
#1371
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
Draft
kevaundray
wants to merge
11
commits into
ethereum:forks/osaka
Choose a base branch
from
kevaundray:kw/state-oracle
base: forks/osaka
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
974cbcf
add code
kevaundray c214f9f
revert format
kevaundray 4db099e
remove write
kevaundray 3112a1c
format
kevaundray a340007
formatting
kevaundray ed85d8f
python format
kevaundray ad9dd18
python lint
kevaundray d12c5d4
python lint
kevaundray 72df534
temp: hack
kevaundray c07b175
evm_tracer like approach
kevaundray 4a46cb5
tox
kevaundray 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
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 |
---|---|---|
|
@@ -19,7 +19,6 @@ | |
from ethereum.utils.numeric import ceil32 | ||
|
||
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. blockhash was not modified, but that should also likely be a part of "state" since 2935 has been implemented |
||
from ...fork_types import EMPTY_ACCOUNT | ||
from ...state import get_account | ||
from ...utils.address import to_address_masked | ||
from ...vm.memory import buffer_read, memory_write | ||
from .. import Evm | ||
|
@@ -84,8 +83,9 @@ def balance(evm: Evm) -> None: | |
charge_gas(evm, GAS_COLD_ACCOUNT_ACCESS) | ||
|
||
# OPERATION | ||
oracle = evm.message.block_env.oracle | ||
# Non-existent accounts default to EMPTY_ACCOUNT, which has balance 0. | ||
balance = get_account(evm.message.block_env.state, address).balance | ||
balance = oracle.get_account(address).balance | ||
|
||
push(evm.stack, balance) | ||
|
||
|
@@ -351,7 +351,8 @@ def extcodesize(evm: Evm) -> None: | |
charge_gas(evm, access_gas_cost) | ||
|
||
# OPERATION | ||
code = get_account(evm.message.block_env.state, address).code | ||
oracle = evm.message.block_env.oracle | ||
code = oracle.get_account(address).code | ||
|
||
codesize = U256(len(code)) | ||
push(evm.stack, codesize) | ||
|
@@ -393,7 +394,8 @@ def extcodecopy(evm: Evm) -> None: | |
|
||
# OPERATION | ||
evm.memory += b"\x00" * extend_memory.expand_by | ||
code = get_account(evm.message.block_env.state, address).code | ||
oracle = evm.message.block_env.oracle | ||
code = oracle.get_account(address).code | ||
|
||
value = buffer_read(code, code_start_index, size) | ||
memory_write(evm.memory, memory_start_index, value) | ||
|
@@ -479,7 +481,8 @@ def extcodehash(evm: Evm) -> None: | |
charge_gas(evm, access_gas_cost) | ||
|
||
# OPERATION | ||
account = get_account(evm.message.block_env.state, address) | ||
oracle = evm.message.block_env.oracle | ||
account = oracle.get_account(address) | ||
|
||
if account == EMPTY_ACCOUNT: | ||
codehash = U256(0) | ||
|
@@ -510,10 +513,9 @@ def self_balance(evm: Evm) -> None: | |
charge_gas(evm, GAS_FAST_STEP) | ||
|
||
# OPERATION | ||
oracle = evm.message.block_env.oracle | ||
# Non-existent accounts default to EMPTY_ACCOUNT, which has balance 0. | ||
balance = get_account( | ||
evm.message.block_env.state, evm.message.current_target | ||
).balance | ||
balance = oracle.get_account(evm.message.current_target).balance | ||
|
||
push(evm.stack, balance) | ||
|
||
|
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most changes look like this:
Before:
After: