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
Labels
Easy Pickings Used to denote issues that should be easy to implement VIP: Approved VIP Approved

Comments

@fubuloubu
Copy link
Member

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 the Easy Pickings Used to denote issues that should be easy to implement label Oct 24, 2019
@fubuloubu fubuloubu self-assigned this Oct 24, 2019
@fubuloubu
Copy link
Member Author

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 VIP: Approved VIP 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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Pickings Used to denote issues that should be easy to implement VIP: Approved VIP Approved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant