mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
wipAdd VM Version Paris and new built in function `prevrandaoAdd VM Version Paris and new built in function prevrandao`
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let prevrandao := sload(0)
|
||||
ret := prevrandao
|
||||
}
|
||||
}
|
||||
function g() public pure returns (uint ret) {
|
||||
assembly {
|
||||
function prevrandao() -> r {
|
||||
r := 1000
|
||||
}
|
||||
ret := prevrandao()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: <paris
|
||||
// ----
|
||||
// f() -> 0
|
||||
// g() -> 1000
|
||||
@@ -0,0 +1,6 @@
|
||||
function f() view returns (uint) {
|
||||
return block.difficulty;
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: <paris
|
||||
// ----
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let difficulty := sload(0)
|
||||
ret := difficulty
|
||||
}
|
||||
}
|
||||
function g() public pure returns (uint ret) {
|
||||
assembly {
|
||||
function difficulty() -> r {
|
||||
r := 1000
|
||||
}
|
||||
ret := difficulty()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 5568: (98-108): Cannot use builtin function name "difficulty" as identifier name.
|
||||
@@ -0,0 +1,7 @@
|
||||
function f() view returns (uint) {
|
||||
return block.difficulty;
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=paris
|
||||
// ----
|
||||
// Warning 8417: (43-59): "difficulty" was renamed and supplanted by "prevrandao" in the VM version paris.
|
||||
@@ -0,0 +1,6 @@
|
||||
function f() view returns (uint) {
|
||||
return block.prevrandao;
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=paris
|
||||
// ----
|
||||
@@ -0,0 +1,20 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let prevrandao := sload(0)
|
||||
ret := prevrandao
|
||||
}
|
||||
}
|
||||
function g() public pure returns (uint ret) {
|
||||
assembly {
|
||||
function prevrandao() -> r {
|
||||
r := 1000
|
||||
}
|
||||
ret := prevrandao()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=paris
|
||||
// ----
|
||||
// ParserError 5568: (98-108): Cannot use builtin function name "prevrandao" as identifier name.
|
||||
@@ -0,0 +1,7 @@
|
||||
function f() view returns (uint) {
|
||||
return block.prevrandao;
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: <paris
|
||||
// ----
|
||||
// Warning 9432: (43-59): "prevrandao" is not supported by the VM version and will be treated like "difficulty".
|
||||
@@ -2,9 +2,6 @@ contract C {
|
||||
function f() public view returns (address payable) {
|
||||
return block.coinbase;
|
||||
}
|
||||
function g() public view returns (uint) {
|
||||
return block.difficulty;
|
||||
}
|
||||
function h() public view returns (uint) {
|
||||
return block.gaslimit;
|
||||
}
|
||||
|
||||
+1
@@ -74,6 +74,7 @@ contract C {
|
||||
//pop(timestamp())
|
||||
//pop(number())
|
||||
//pop(difficulty())
|
||||
//pop(prevrandao())
|
||||
//pop(gaslimit())
|
||||
|
||||
// NOTE: msize() is allowed only with optimizer disabled
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ contract C {
|
||||
pop(coinbase())
|
||||
pop(timestamp())
|
||||
pop(number())
|
||||
pop(difficulty())
|
||||
pop(prevrandao())
|
||||
pop(gaslimit())
|
||||
|
||||
// NOTE: msize() is allowed only with optimizer disabled
|
||||
@@ -83,7 +83,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=london
|
||||
// EVMVersion: >=paris
|
||||
// ----
|
||||
// Warning 5740: (94-1733): Unreachable code.
|
||||
// Warning 5740: (1746-1758): Unreachable code.
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
assembly {
|
||||
// Renamed in paris
|
||||
pop(difficulty())
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =london
|
||||
// ----
|
||||
// Warning 5740: (94-1733): Unreachable code.
|
||||
// Warning 5740: (1746-1758): Unreachable code.
|
||||
// Warning 5740: (1801-1810): Unreachable code.
|
||||
// Warning 5740: (1978-2244): Unreachable code.
|
||||
+2
-2
@@ -32,7 +32,7 @@ contract C {
|
||||
pop(coinbase())
|
||||
pop(timestamp())
|
||||
pop(number())
|
||||
pop(difficulty())
|
||||
pop(prevrandao())
|
||||
pop(gaslimit())
|
||||
|
||||
// These two are disallowed too but the error suppresses other errors.
|
||||
@@ -42,7 +42,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=london
|
||||
// EVMVersion: >=paris
|
||||
// ----
|
||||
// Warning 5740: (672-1083): Unreachable code.
|
||||
// TypeError 2527: (79-87): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
// Renamed in paris
|
||||
pop(difficulty())
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =london
|
||||
// ----
|
||||
// Warning 5740: (672-1083): Unreachable code.
|
||||
// TypeError 2527: (79-87): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 8961: (101-113): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 2527: (130-135): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (153-162): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (180-190): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (208-221): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (239-247): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (265-276): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (294-308): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (322-345): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (362-376): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 8961: (394-409): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (427-446): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (464-489): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (507-536): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (554-584): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 2527: (602-630): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 8961: (644-659): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (672-682): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (695-708): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (721-737): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (750-769): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 8961: (782-804): Function cannot be declared as pure because this expression (potentially) modifies the state.
|
||||
// TypeError 2527: (821-830): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (848-857): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (875-883): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (901-911): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (929-941): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (959-969): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (987-998): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (1016-1024): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (1042-1054): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
// TypeError 2527: (1072-1082): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
Reference in New Issue
Block a user