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

SIGHASH opcode #259

Merged
merged 1 commit into from
Jan 11, 2018
Merged

SIGHASH opcode #259

merged 1 commit into from
Jan 11, 2018

Conversation

jannikluhn
Copy link
Contributor

Adds the SIGHASH opcode that puts the hash of the transaction excluding the data field on the stack.

Closes #226

@@ -189,3 +189,7 @@ def returndatacopy(computation):
value = computation.return_data[returndata_start_position: returndata_start_position + size]

computation.memory.write(mem_start_position, size, value)


def sighash(computation):
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There isn't, unfortunately.

gas=gas,
gas_price=self.msg.gas_price,
origin=self.msg.origin,
sig_hash=self.msg.sig_hash,
Copy link
Member

Choose a reason for hiding this comment

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

This has a "bad smell".

The sighash falls into the same category as the block data which indicates there should be a single location this value is stored. Yet it is copied for each level of computation.

After some investigation, the same is true for msg.gas_price and msg.origin. This isn't something we need to fix now, but I think it's worth investigating how we can remove this duplication.

Issue opened here: #262

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I must admit that I simply copied the msg.origin behavior.

@jannikluhn jannikluhn merged commit 7797c39 into ethereum:sharding Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants