mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Updated evmc to version tracked by evmone v0.1.0
This commit is contained in:
@@ -61,12 +61,10 @@ if (OSSFUZZ)
|
||||
abiV2Proto.pb.cc
|
||||
)
|
||||
target_include_directories(abiv2_proto_ossfuzz PRIVATE
|
||||
/src/LPM/external.protobuf/include
|
||||
/src/libprotobuf-mutator
|
||||
/src/evmone/include
|
||||
/usr/include/libprotobuf-mutator
|
||||
)
|
||||
target_link_libraries(abiv2_proto_ossfuzz PRIVATE solidity
|
||||
evmone intx ethash keccak evmc-instructions evmc
|
||||
evmone intx ethash evmc-instructions
|
||||
protobuf-mutator-libfuzzer.a
|
||||
protobuf-mutator.a
|
||||
protobuf.a
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <libsolidity/interface/CompilerStack.h>
|
||||
|
||||
#include <libyul/AssemblyStack.h>
|
||||
|
||||
#include <liblangutil/Exceptions.h>
|
||||
#include <liblangutil/SourceReferenceFormatter.h>
|
||||
|
||||
#include <libdevcore/Keccak256.h>
|
||||
|
||||
namespace dev
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
#include <test/EVMHost.h>
|
||||
#include <test/tools/ossfuzz/abiV2FuzzerCommon.h>
|
||||
#include <test/tools/ossfuzz/protoToAbiV2.h>
|
||||
|
||||
#include <evmone/evmone.h>
|
||||
#include <src/libfuzzer/libfuzzer_macro.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
static evmc::vm evmone = evmc::vm{evmc_create_evmone()};
|
||||
|
||||
@@ -300,7 +300,7 @@ void ProtoConverter::visit(DynamicByteArrayType const& _x)
|
||||
visitType(
|
||||
(_x.type() == DynamicByteArrayType::BYTES) ? DataType::BYTES : DataType::STRING,
|
||||
bytesArrayTypeAsString(_x),
|
||||
bytesArrayValueAsString()
|
||||
bytesArrayValueAsString(getNextCounter())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ std::string ProtoConverter::typedParametersAsString(CalleeType _calleeType)
|
||||
}
|
||||
}
|
||||
|
||||
// Function that is called by the factory contract
|
||||
/// Test function to be called externally.
|
||||
void ProtoConverter::visit(TestFunction const& _x)
|
||||
{
|
||||
m_output << R"(
|
||||
@@ -672,12 +672,12 @@ void ProtoConverter::writeHelperFunctions()
|
||||
// memory/calldata and check if decoded value matches storage value
|
||||
// return true on successful match, false otherwise
|
||||
m_output << Whiskers(R"(
|
||||
function coder_public(<parameters_memory>) public view returns (uint) {
|
||||
function coder_public(<parameters_memory>) public pure returns (uint) {
|
||||
<equality_checks>
|
||||
return 0;
|
||||
}
|
||||
|
||||
function coder_external(<parameters_calldata>) external view returns (uint) {
|
||||
function coder_external(<parameters_calldata>) external pure returns (uint) {
|
||||
<equality_checks>
|
||||
return 0;
|
||||
}
|
||||
@@ -693,13 +693,6 @@ void ProtoConverter::visit(Contract const& _x)
|
||||
m_output << R"(pragma solidity >=0.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract Factory {
|
||||
function test() external returns (uint) {
|
||||
C c = new C();
|
||||
return c.test();
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
)";
|
||||
// TODO: Support more than one but less than N state variables
|
||||
|
||||
@@ -14,18 +14,10 @@
|
||||
* pragma solidity >=0.0;
|
||||
* pragma experimental ABIEncoderV2;
|
||||
*
|
||||
* contract Factory {
|
||||
* // Factory test function. Called by EVM client
|
||||
* function test() external returns (uint) {
|
||||
* C c = new C();
|
||||
* return c.test();
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* contract C {
|
||||
* // State variable
|
||||
* string x_0;
|
||||
* // Test function. Called by Factory test function
|
||||
* // Test function that is called by the VM.
|
||||
* function test() public returns (uint) {
|
||||
* // Local variable
|
||||
* bytes x_1 = "1";
|
||||
@@ -45,7 +37,7 @@
|
||||
*
|
||||
* // Public function that is called by test() function. Accepts one or more arguments and returns
|
||||
* // a uint value (zero if abi en/decoding was successful, non-zero otherwise)
|
||||
* function coder_public(string memory c_0, bytes memory c_1) public view returns (uint) {
|
||||
* function coder_public(string memory c_0, bytes memory c_1) public pure returns (uint) {
|
||||
* if (!bytesCompare(bytes(c_0), "044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d"))
|
||||
* return 1;
|
||||
* if (!bytesCompare(c_1, "1"))
|
||||
@@ -55,7 +47,7 @@
|
||||
*
|
||||
* // External function that is called by test() function. Accepts one or more arguments and returns
|
||||
* // a uint value (zero if abi en/decoding was successful, non-zero otherwise)
|
||||
* function coder_external(string calldata c_0, bytes calldata c_1) external view returns (uint) {
|
||||
* function coder_external(string calldata c_0, bytes calldata c_1) external pure returns (uint) {
|
||||
* if (!stringCompare(c_0, "044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d"))
|
||||
* return 1;
|
||||
* if (!bytesCompare(c_1, "1"))
|
||||
@@ -243,9 +235,9 @@ private:
|
||||
|
||||
// String and bytes literals are derived by hashing a monotonically increasing
|
||||
// counter and enclosing the said hash inside double quotes.
|
||||
std::string bytesArrayValueAsString()
|
||||
std::string bytesArrayValueAsString(unsigned _counter)
|
||||
{
|
||||
return "\"" + toHex(hashUnsignedInt(getNextCounter()), HexPrefix::DontAdd) + "\"";
|
||||
return "\"" + toHex(hashUnsignedInt(_counter), HexPrefix::DontAdd) + "\"";
|
||||
}
|
||||
|
||||
std::string getQualifier(DataType _dataType)
|
||||
|
||||
Reference in New Issue
Block a user