Revert "Allow basefee as Yul identifier for EVMVersion < london"

This reverts commit 7f1a2be0fe.

Added changes to changelog to include Make basfee as a reserved identifier

added changes under the breaking changes rst file

Update Changelog.md

Co-authored-by: Harikrishnan Mulackal <webmail.hari@gmail.com>

Update 090-breaking-changes.rst

moved the changes under "New restrictions" section

Update Changelog.md

avoided removing  line no 6

Update docs/090-breaking-changes.rst

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
This commit is contained in:
Sreekesh V 2021-08-25 11:58:02 +05:30 committed by wechman
parent 0801c48e11
commit 9188e658d8
4 changed files with 13 additions and 15 deletions

View File

@ -15,7 +15,7 @@ Silent Changes of the Semantics
New Restrictions New Restrictions
================ ================
... - Make ``basefee`` a reserved identifier in assembly.
Interface Changes Interface Changes
================= =================

View File

@ -109,22 +109,14 @@ pair<YulString, BuiltinFunctionForEVM> createFunction(
return {name, f}; return {name, f};
} }
set<YulString> createReservedIdentifiers(langutil::EVMVersion _evmVersion) set<YulString> createReservedIdentifiers()
{ {
// TODO remove this in 0.9.0. We allow creating functions or identifiers in Yul with the name
// basefee for VMs before london.
auto baseFeeException = [&](evmasm::Instruction _instr) -> bool
{
return _instr == evmasm::Instruction::BASEFEE && _evmVersion < langutil::EVMVersion::london();
};
set<YulString> reserved; set<YulString> reserved;
for (auto const& instr: evmasm::c_instructions) for (auto const& instr: evmasm::c_instructions)
{ {
string name = instr.first; string name = instr.first;
transform(name.begin(), name.end(), name.begin(), [](unsigned char _c) { return tolower(_c); }); transform(name.begin(), name.end(), name.begin(), [](unsigned char _c) { return tolower(_c); });
if (!baseFeeException(instr.second)) reserved.emplace(name);
reserved.emplace(name);
} }
reserved += vector<YulString>{ reserved += vector<YulString>{
"linkersymbol"_yulstring, "linkersymbol"_yulstring,
@ -292,7 +284,7 @@ EVMDialect::EVMDialect(langutil::EVMVersion _evmVersion, bool _objectAccess):
m_objectAccess(_objectAccess), m_objectAccess(_objectAccess),
m_evmVersion(_evmVersion), m_evmVersion(_evmVersion),
m_functions(createBuiltins(_evmVersion, _objectAccess)), m_functions(createBuiltins(_evmVersion, _objectAccess)),
m_reserved(createReservedIdentifiers(_evmVersion)) m_reserved(createReservedIdentifiers())
{ {
} }

View File

@ -201,8 +201,7 @@ def examine_id_coverage(top_dir, source_id_to_file_names, new_ids_only=False):
# The warning may or may not exist in a compiler build. # The warning may or may not exist in a compiler build.
"4591", # "There are more than 256 warnings. Ignoring the rest." "4591", # "There are more than 256 warnings. Ignoring the rest."
# Due to 3805, the warning lists look different for different compiler builds. # Due to 3805, the warning lists look different for different compiler builds.
"1834", # Unimplemented feature error, as we do not test it anymore via cmdLineTests "1834" # Unimplemented feature error, as we do not test it anymore via cmdLineTests
"5430" # basefee being used in inline assembly for EVMVersion < london
} }
assert len(test_ids & white_ids) == 0, "The sets are not supposed to intersect" assert len(test_ids & white_ids) == 0, "The sets are not supposed to intersect"
test_ids |= white_ids test_ids |= white_ids

View File

@ -2,8 +2,15 @@ contract C {
function f() public view returns (uint) { function f() public view returns (uint) {
return block.basefee; 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 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").
// DeclarationError 8678: (176-192): Variable count for assignment to "ret" does not match number of values (1 vs. 0)