mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Yul proto fuzzer: Additional blockchain opcodes
This commit is contained in:
parent
7dd77784b7
commit
6b27ef8fcb
@ -337,6 +337,12 @@ void ProtoConverter::visit(UnaryOp const& _x)
|
||||
case UnaryOp::EXTCODEHASH:
|
||||
m_output << "extcodehash";
|
||||
break;
|
||||
case UnaryOp::BALANCE:
|
||||
m_output << "balance";
|
||||
break;
|
||||
case UnaryOp::BLOCKHASH:
|
||||
m_output << "blockhash";
|
||||
break;
|
||||
}
|
||||
m_output << "(";
|
||||
visit(_x.operand());
|
||||
@ -385,6 +391,36 @@ void ProtoConverter::visit(NullaryOp const& _x)
|
||||
case NullaryOp::RETURNDATASIZE:
|
||||
m_output << "returndatasize()";
|
||||
break;
|
||||
case NullaryOp::ADDRESS:
|
||||
m_output << "address()";
|
||||
break;
|
||||
case NullaryOp::ORIGIN:
|
||||
m_output << "origin()";
|
||||
break;
|
||||
case NullaryOp::CALLER:
|
||||
m_output << "caller()";
|
||||
break;
|
||||
case NullaryOp::CALLVALUE:
|
||||
m_output << "callvalue()";
|
||||
break;
|
||||
case NullaryOp::GASPRICE:
|
||||
m_output << "gasprice()";
|
||||
break;
|
||||
case NullaryOp::COINBASE:
|
||||
m_output << "coinbase()";
|
||||
break;
|
||||
case NullaryOp::TIMESTAMP:
|
||||
m_output << "timestamp()";
|
||||
break;
|
||||
case NullaryOp::NUMBER:
|
||||
m_output << "number()";
|
||||
break;
|
||||
case NullaryOp::DIFFICULTY:
|
||||
m_output << "difficulty()";
|
||||
break;
|
||||
case NullaryOp::GASLIMIT:
|
||||
m_output << "gaslimit()";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -947,6 +983,9 @@ void ProtoConverter::visit(Statement const& _x)
|
||||
if (!m_inForInitScope)
|
||||
visit(_x.funcdef());
|
||||
break;
|
||||
case Statement::kPop:
|
||||
visit(_x.pop());
|
||||
break;
|
||||
case Statement::STMT_ONEOF_NOT_SET:
|
||||
break;
|
||||
}
|
||||
@ -1233,6 +1272,13 @@ void ProtoConverter::visit(FunctionDef const& _x)
|
||||
createFunctionDefAndCall(_x, numInParams, numOutParams);
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(PopStmt const& _x)
|
||||
{
|
||||
m_output << "pop(";
|
||||
visit(_x.expr());
|
||||
m_output << ")\n";
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(Program const& _x)
|
||||
{
|
||||
// Initialize input size
|
||||
|
@ -85,6 +85,7 @@ private:
|
||||
void visit(TerminatingStmt const&);
|
||||
void visit(FunctionCall const&);
|
||||
void visit(FunctionDef const&);
|
||||
void visit(PopStmt const&);
|
||||
void visit(Program const&);
|
||||
|
||||
/// Creates a new scope, and adds @a _funcParams to it if it
|
||||
|
@ -129,6 +129,8 @@ message UnaryOp {
|
||||
CALLDATALOAD = 4;
|
||||
EXTCODESIZE = 5;
|
||||
EXTCODEHASH = 6;
|
||||
BALANCE = 7;
|
||||
BLOCKHASH = 8;
|
||||
}
|
||||
required UOp op = 1;
|
||||
required Expression operand = 2;
|
||||
@ -172,6 +174,16 @@ message NullaryOp {
|
||||
CALLDATASIZE = 4;
|
||||
CODESIZE = 5;
|
||||
RETURNDATASIZE = 6;
|
||||
ADDRESS = 7;
|
||||
ORIGIN = 8;
|
||||
CALLER = 9;
|
||||
CALLVALUE = 10;
|
||||
GASPRICE = 11;
|
||||
COINBASE = 12;
|
||||
TIMESTAMP = 13;
|
||||
NUMBER = 14;
|
||||
DIFFICULTY = 15;
|
||||
GASLIMIT = 16;
|
||||
}
|
||||
required NOp op = 1;
|
||||
}
|
||||
@ -287,6 +299,10 @@ message FunctionDef {
|
||||
required Block block = 3;
|
||||
}
|
||||
|
||||
message PopStmt {
|
||||
required Expression expr = 1;
|
||||
}
|
||||
|
||||
message Statement {
|
||||
oneof stmt_oneof {
|
||||
VarDecl decl = 1;
|
||||
@ -305,6 +321,7 @@ message Statement {
|
||||
FunctionCall functioncall = 14;
|
||||
BoundedForStmt boundedforstmt = 15;
|
||||
FunctionDef funcdef = 16;
|
||||
PopStmt pop = 17;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user