mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Introduce block.chainid
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
contract C {
|
||||
function f() public returns (uint) {
|
||||
return block.chainid;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=istanbul
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1
|
||||
// f() -> 1
|
||||
// f() -> 1
|
||||
@@ -11,6 +11,11 @@ contract C {
|
||||
function i() public view returns (uint) {
|
||||
return block.timestamp;
|
||||
}
|
||||
function j() public view returns (uint) {
|
||||
return block.chainid;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: <istanbul
|
||||
// ----
|
||||
// TypeError 3081: (420-433): "chainid" is not supported by the VM version.
|
||||
|
||||
@@ -11,6 +11,9 @@ contract C {
|
||||
function i() public view returns (uint) {
|
||||
return block.timestamp;
|
||||
}
|
||||
function j() public view returns (uint) {
|
||||
return block.chainid;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=istanbul
|
||||
|
||||
@@ -2,8 +2,12 @@ contract C {
|
||||
function f() public pure {
|
||||
assembly { pop(chainid()) }
|
||||
}
|
||||
function g() public pure returns (uint) {
|
||||
return block.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".
|
||||
// TypeError 2527: (147-160): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
|
||||
@@ -2,6 +2,9 @@ contract C {
|
||||
function f() public view {
|
||||
assembly { pop(chainid()) }
|
||||
}
|
||||
function g() public view returns (uint) {
|
||||
return block.chainid;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=istanbul
|
||||
|
||||
Reference in New Issue
Block a user