diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 2f25fb486..6531c1ff0 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -554,6 +554,63 @@ void ProtoConverter::visit(SwitchStmt const& _x) } } +void ProtoConverter::visit(StopInvalidStmt const& _x) +{ + switch (_x.stmt()) + { + case StopInvalidStmt::STOP: + m_output << "stop()\n"; + break; + case StopInvalidStmt::INVALID: + m_output << "invalid()\n"; + break; + } +} + +void ProtoConverter::visit(RetRevStmt const& _x) +{ + switch (_x.stmt()) + { + case RetRevStmt::RETURN: + m_output << "return"; + break; + case RetRevStmt::REVERT: + m_output << "revert"; + break; + } + m_output << "("; + visit(_x.pos()); + m_output << ", "; + visit(_x.size()); + m_output << ")\n"; +} + +void ProtoConverter::visit(SelfDestructStmt const& _x) +{ + m_output << "selfdestruct"; + m_output << "("; + visit(_x.addr()); + m_output << ")\n"; +} + +void ProtoConverter::visit(TerminatingStmt const& _x) +{ + switch (_x.term_oneof_case()) + { + case TerminatingStmt::kStopInvalid: + visit(_x.stop_invalid()); + break; + case TerminatingStmt::kRetRev: + visit(_x.ret_rev()); + break; + case TerminatingStmt::kSelfDes: + visit(_x.self_des()); + break; + case TerminatingStmt::TERM_ONEOF_NOT_SET: + break; + } +} + void ProtoConverter::visit(Statement const& _x) { switch (_x.stmt_oneof_case()) @@ -596,6 +653,9 @@ void ProtoConverter::visit(Statement const& _x) case Statement::kExtcodeCopy: visit(_x.extcode_copy()); break; + case Statement::kTerminatestmt: + visit(_x.terminatestmt()); + break; case Statement::STMT_ONEOF_NOT_SET: break; } diff --git a/test/tools/ossfuzz/protoToYul.h b/test/tools/ossfuzz/protoToYul.h index 620b0d511..ab25e0466 100644 --- a/test/tools/ossfuzz/protoToYul.h +++ b/test/tools/ossfuzz/protoToYul.h @@ -71,6 +71,10 @@ private: void visit(LogFunc const&); void visit(CopyFunc const&); void visit(ExtCodeCopy const&); + void visit(StopInvalidStmt const&); + void visit(RetRevStmt const&); + void visit(SelfDestructStmt const&); + void visit(TerminatingStmt const&); template void visit(google::protobuf::RepeatedPtrField const& _repeated_field); diff --git a/test/tools/ossfuzz/yulProto.proto b/test/tools/ossfuzz/yulProto.proto index 3d3fd698f..4919d2eab 100644 --- a/test/tools/ossfuzz/yulProto.proto +++ b/test/tools/ossfuzz/yulProto.proto @@ -223,6 +223,36 @@ message SwitchStmt { message BreakStmt {} message ContinueStmt {} +message StopInvalidStmt { + enum Type { + STOP = 0; + INVALID = 1; + } + required Type stmt = 1; +} + +message RetRevStmt { + enum Type { + RETURN = 0; + REVERT = 1; + } + required Type stmt = 1; + required Expression pos = 2; + required Expression size = 3; +} + +message SelfDestructStmt { + required Expression addr = 1; +} + +message TerminatingStmt { + oneof term_oneof { + StopInvalidStmt stop_invalid = 1; + RetRevStmt ret_rev = 2; + SelfDestructStmt self_des = 3; + } +} + message Statement { oneof stmt_oneof { VarDecl decl = 1; @@ -237,6 +267,7 @@ message Statement { LogFunc log_func = 10; CopyFunc copy_func = 11; ExtCodeCopy extcode_copy = 12; + TerminatingStmt terminatestmt = 13; } }