-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Feature] new network.id
opcode
#2419
Conversation
Should we add the network ID to the block-specific random seed? |
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.
Left some feedback and nits.
The main question we should answer is whether or not to allow network.id
in a non-finalize context.
69b5b17
to
56f5db7
Compare
It's not necessary for this PR, but could be a useful property. Networks with different IDs have different RNG state. |
Motivation
This PR introduces the opcode
network.id
to access the ID of the current network (ex:0
for mainnet, or3
for testnet3). This opcode can be used as a safeguard against replay attacks, as signatures or hashes of data can now be bound to a specific network. Users can now test program authorizations on testnet without worrying that the same authorizations be maliciously reused on mainnet.Open questions
network.id
be allowed in transition functions?network.id
as it could be obfuscated if it were involved in computation.