Skip to content

Commit

Permalink
eof: Fix EOF builtin names unintentionally reserved outside of EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Jan 9, 2025
1 parent 3c94682 commit 7c98754
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libyul/backends/evm/EVMDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,15 @@ std::set<std::string, std::less<>> createReservedIdentifiers(langutil::EVMVersio
(
_instr == evmasm::Instruction::EXTCALL ||
_instr == evmasm::Instruction::EXTSTATICCALL ||
_instr == evmasm::Instruction::EXTDELEGATECALL
_instr == evmasm::Instruction::EXTDELEGATECALL ||
_instr == evmasm::Instruction::DATALOADN ||
_instr == evmasm::Instruction::EOFCREATE ||
_instr == evmasm::Instruction::RETURNCONTRACT ||
_instr == evmasm::Instruction::RJUMP ||
_instr == evmasm::Instruction::RJUMPI ||
_instr == evmasm::Instruction::CALLF ||
_instr == evmasm::Instruction::JUMPF ||
_instr == evmasm::Instruction::RETF
);
};

Expand Down
20 changes: 20 additions & 0 deletions test/libyul/yulSyntaxTests/eof/eof_builtins_names_reserved.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
object "a" {
code {
function dataloadn() {}
function rjump() {}
function rjumpi() {}
function callf() {}
function jumpf() {}
function retf() {}
}
}

// ====
// bytecodeFormat: >=EOFv1
// ----
// DeclarationError 5017: (32-55): The identifier "dataloadn" is reserved and can not be used.
// DeclarationError 5017: (64-83): The identifier "rjump" is reserved and can not be used.
// DeclarationError 5017: (92-112): The identifier "rjumpi" is reserved and can not be used.
// DeclarationError 5017: (121-140): The identifier "callf" is reserved and can not be used.
// DeclarationError 5017: (149-168): The identifier "jumpf" is reserved and can not be used.
// DeclarationError 5017: (177-195): The identifier "retf" is reserved and can not be used.
8 changes: 8 additions & 0 deletions test/libyul/yulSyntaxTests/eof/eof_identifiers_in_legacy.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
object "a" {
code {
function dataloadn() {}
function eofcreate() {}
function returncontract() {}
function rjump() {}
function rjumpi() {}
function callf() {}
function jumpf() {}
function retf() {}
function extcall() {}
function extstaticcall() {}
function extdelegatecall() {}
Expand Down

0 comments on commit 7c98754

Please sign in to comment.