diff --git a/liblangutil/EVMVersion.cpp b/liblangutil/EVMVersion.cpp index c953eda0f..7b34fe7d2 100644 --- a/liblangutil/EVMVersion.cpp +++ b/liblangutil/EVMVersion.cpp @@ -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; } } - diff --git a/scripts/test_antlr_grammar.sh b/scripts/test_antlr_grammar.sh index 51e0df0cb..333cea0df 100755 --- a/scripts/test_antlr_grammar.sh +++ b/scripts/test_antlr_grammar.sh @@ -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=() diff --git a/test/libsolidity/semanticTests/inlineAssembly/basefee_berlin_function.sol b/test/libsolidity/semanticTests/inlineAssembly/basefee_berlin_function.sol new file mode 100644 index 000000000..81c1ee431 --- /dev/null +++ b/test/libsolidity/semanticTests/inlineAssembly/basefee_berlin_function.sol @@ -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 diff --git a/test/libsolidity/syntaxTests/inlineAssembly/basefee_reserved_london.sol b/test/libsolidity/syntaxTests/inlineAssembly/basefee_reserved_london.sol new file mode 100644 index 000000000..00ecaf01a --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/basefee_reserved_london.sol @@ -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.