Merge pull request #10550 from ethereum/chainIdView

[BREAKING] Mark chainid as view.
This commit is contained in:
chriseth
2020-12-09 17:41:27 +01:00
committed by GitHub
6 changed files with 15 additions and 2 deletions
@@ -1,5 +1,5 @@
contract C {
function f() pure external returns (uint id) {
function f() view external returns (uint id) {
assembly {
id := chainid()
}
@@ -0,0 +1,9 @@
contract C {
function f() public pure {
assembly { pop(chainid()) }
}
}
// ====
// EVMVersion: >=istanbul
// ----
// TypeError 2527: (67-76): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
@@ -1,5 +1,5 @@
contract C {
function f() public pure {
function f() public view {
assembly { pop(chainid()) }
}
}