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,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".
|
||||
Reference in New Issue
Block a user