mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11763 from ethereum/basefee-hasOpcode
Allow basefee as Yul identifier for EVMVersion < london
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let basefee := sload(0)
|
||||
ret := basefee
|
||||
}
|
||||
}
|
||||
function g() public pure returns (uint ret) {
|
||||
assembly {
|
||||
function basefee() -> r {
|
||||
r := 1000
|
||||
}
|
||||
ret := basefee()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: <=berlin
|
||||
// ----
|
||||
// f() -> 0
|
||||
// g() -> 1000
|
||||
@@ -0,0 +1,12 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let basefee := sload(0)
|
||||
ret := basefee
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =london
|
||||
// ----
|
||||
// ParserError 5568: (98-105): Cannot use builtin function name "basefee" as identifier name.
|
||||
@@ -2,14 +2,8 @@ contract C {
|
||||
function f() public view returns (uint) {
|
||||
return block.basefee;
|
||||
}
|
||||
function g() public view returns (uint ret) {
|
||||
assembly {
|
||||
ret := basefee()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =berlin
|
||||
// EVMVersion: <=berlin
|
||||
// ----
|
||||
// TypeError 5921: (74-87): "basefee" is not supported by the VM version.
|
||||
// TypeError 5430: (183-190): The "basefee" instruction is only available for London-compatible VMs (you are currently compiling for "berlin").
|
||||
|
||||
Reference in New Issue
Block a user