Skip to content

Commit 53b6733

Browse files
committed
YulRunner: Add support for memoryguard() and literal parameters
1 parent 1730e43 commit 53b6733

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

test/tools/yulInterpreter/EVMInstructionInterpreter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ u256 EVMInstructionInterpreter::evalBuiltin(
475475
);
476476
return 0;
477477
}
478+
else if (fun == "memoryguard")
479+
return _evaluatedArguments.at(0);
478480
else
479481
yulAssert(false, "Unknown builtin: " + fun);
480482
return 0;

test/tools/yulInterpreter/Interpreter.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,19 @@ void ExpressionEvaluator::evaluateArgs(
351351
if (!_literalArguments || !_literalArguments->at(_expr.size() - i - 1))
352352
visit(expr);
353353
else
354-
m_values = {0};
354+
{
355+
string literal = std::get<Literal>(expr).value.str();
356+
357+
try
358+
{
359+
m_values = {u256(literal)};
360+
}
361+
catch (exception&)
362+
{
363+
m_values = {u256(0)};
364+
}
365+
}
366+
355367
values.push_back(value());
356368
++i;
357369
}

0 commit comments

Comments
 (0)