Skip to content

Commit

Permalink
Tests for basefee as identifier in inline assembly
Browse files Browse the repository at this point in the history
Also added basefee to `EVMVersion::hasOpcode(...)`
  • Loading branch information
hrkrshnn committed Aug 9, 2021
1 parent 9ba46bf commit 3f9fb52
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion liblangutil/EVMVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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()
}
}
}
// ====
// EVMVersion: =berlin
// ----
// f() -> 0
// g() -> 1000
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 3f9fb52

Please sign in to comment.