Tests for basefee as identifier in inline assembly

Also added basefee to `EVMVersion::hasOpcode(...)`
This commit is contained in:
hrkrshnn 2021-08-09 12:45:28 +02:00
parent 7f1a2be0fe
commit 892700d769
4 changed files with 39 additions and 2 deletions

View File

@ -46,8 +46,9 @@ bool EVMVersion::hasOpcode(Instruction _opcode) const
return hasChainID();
case Instruction::SELFBALANCE:
return hasSelfBalance();
case Instruction::BASEFEE:
return hasBaseFee();
default:
return true;
}
}

View File

@ -118,7 +118,9 @@ done < <(
grep -v -E 'literals/.*_direction_override.*.sol' |
# Skipping a test with "revert E;" because ANTLR cannot distinguish it from
# a variable declaration.
grep -v -E 'revertStatement/non_called.sol'
grep -v -E 'revertStatement/non_called.sol' |
# Skipping a test with "let basefee := ..."
grep -v -E 'inlineAssembly/basefee_berlin_function.sol'
)
YUL_FILES=()

View File

@ -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

View File

@ -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.