-
Notifications
You must be signed in to change notification settings - Fork 649
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
SIGHASH opcode #259
SIGHASH opcode #259
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ | |
EXTCODECOPY = 0x3c | ||
RETURNDATASIZE = 0x3d | ||
RETURNDATACOPY = 0x3e | ||
SIGHASH = 0x3f | ||
|
||
|
||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import copy | ||
from cytoolz import merge | ||
|
||
from evm import opcode_values | ||
from evm import mnemonics | ||
|
||
from evm.opcode import as_opcode | ||
from evm.logic import ( | ||
context, | ||
) | ||
|
||
from evm.vm.forks.byzantium import BYZANTIUM_OPCODES | ||
|
||
|
||
NEW_OPCODES = { | ||
opcode_values.SIGHASH: as_opcode( | ||
logic_fn=context.sighash, | ||
mnemonic=mnemonics.SIGHASH, | ||
gas_cost=0, | ||
), | ||
} | ||
|
||
|
||
SHARDING_OPCODES = merge( | ||
copy.deepcopy(BYZANTIUM_OPCODES), | ||
NEW_OPCODES | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
validate_uint256, | ||
validate_is_boolean, | ||
validate_access_list, | ||
validate_sig_hash, | ||
) | ||
|
||
|
||
|
@@ -148,6 +149,7 @@ def __init__(self, | |
gas, | ||
gas_price, | ||
to, | ||
sig_hash, | ||
sender, | ||
value, | ||
data, | ||
|
@@ -178,6 +180,32 @@ def __init__(self, | |
validate_is_boolean(is_create, title="Message.is_create") | ||
self.is_create = is_create | ||
|
||
validate_sig_hash(sig_hash, title="Message.sig_hash") | ||
self.sig_hash = sig_hash | ||
|
||
if access_list is not None: | ||
validate_access_list(access_list) | ||
self.access_list = access_list | ||
|
||
def prepare_child_message(self, | ||
gas, | ||
to, | ||
value, | ||
data, | ||
code, | ||
**kwargs): | ||
kwargs.setdefault('sender', self.msg.storage_address) | ||
|
||
child_message = ShardingMessage( | ||
gas=gas, | ||
gas_price=self.msg.gas_price, | ||
origin=self.msg.origin, | ||
sig_hash=self.msg.sig_hash, | ||
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. This has a "bad smell". The After some investigation, the same is true for Issue opened here: #262 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 agree. I must admit that I simply copied the |
||
to=to, | ||
value=value, | ||
data=data, | ||
code=code, | ||
depth=self.msg.depth + 1, | ||
**kwargs | ||
) | ||
return child_message |
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.
Is there an EIP for this? If so, could we link it in the docstring.
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.
There isn't, unfortunately.