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

VIP: Add support for Chain ID Opcode #1652

Closed
fubuloubu opened this issue Oct 24, 2019 · 2 comments · Fixed by #1763
Closed

VIP: Add support for Chain ID Opcode #1652

fubuloubu opened this issue Oct 24, 2019 · 2 comments · Fixed by #1763

Comments

@fubuloubu
Copy link
Member

@fubuloubu fubuloubu commented Oct 24, 2019

Simple Summary

Add support for the chain ID opcode through a new environment variable

Motivation

Being able to know what chain a contract is located on is valuable for many different kinds of signature verification operations because it is often used as a domain separator for message signing. Creating an environment variable that queries this value means there will be no human error involved in maintaining this value within contracts, so that contracts developed on testnets don't allow replay attacks when they are deployed on the mainnet.

Specification

The feature is described in full via EIP-1344. In vyper, this should appear as the chain.id env var, as it is derived from the chain context of the Ethereum client that executes this call (through it's Genesis config). It should have a type of uint256 and a gas cost of G_base.

Backwards Compatibility

No backwards incompatibilities

Dependencies

No dependencies

Copyright

Copyright and related rights waived via CC0

@fubuloubu fubuloubu added this to To do in Release Candidate! via automation Oct 24, 2019
@fubuloubu fubuloubu self-assigned this Oct 24, 2019
@fubuloubu

This comment has been minimized.

Copy link
Member Author

@fubuloubu fubuloubu commented Oct 24, 2019

Note: might be best to add this feature via #1230 ruleset switch so there it fails to compile under pre-Istanbul rules

@fubuloubu fubuloubu changed the title Add support for Chain ID Opcode VIP: Add support for Chain ID Opcode Oct 27, 2019
This was referenced Oct 27, 2019
@fubuloubu fubuloubu added the Approved label Oct 28, 2019
@fubuloubu fubuloubu removed their assignment Oct 28, 2019
fubuloubu added a commit to fubuloubu/vyper that referenced this issue Dec 12, 2019
@fubuloubu fubuloubu mentioned this issue Dec 12, 2019
fubuloubu added a commit to fubuloubu/vyper that referenced this issue Dec 12, 2019
@fubuloubu

This comment has been minimized.

Copy link
Member Author

@fubuloubu fubuloubu commented Dec 12, 2019

Note that #1763 will implement the opcode, but not in the preferred method of supporting multiple rulesets.

Release Candidate! automation moved this from To do to Done Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
1 participant
You can’t perform that action at this time.