Use evmone for testing.

This commit is contained in:
chriseth
2019-08-08 17:35:44 +02:00
parent 7401fbabd9
commit 3dec3af638
16 changed files with 462 additions and 950 deletions
+22 -26
View File
@@ -23,7 +23,6 @@
#pragma once
#include <test/Options.h>
#include <test/RPCSession.h>
#include <libsolidity/interface/OptimiserSettings.h>
@@ -38,24 +37,26 @@ namespace dev
{
namespace test
{
using rational = boost::rational<dev::bigint>;
/// An Ethereum address: 20 bytes.
/// @NOTE This is not endian-specific; it's just a bunch of bytes.
using Address = h160;
class EVMHost;
// The various denominations; here for ease of use where needed within code.
static const u256 wei = 1;
static const u256 shannon = u256("1000000000");
static const u256 szabo = shannon * 1000;
static const u256 finney = szabo * 1000;
static const u256 ether = finney * 1000;
using rational = boost::rational<dev::bigint>;
/// An Ethereum address: 20 bytes.
/// @NOTE This is not endian-specific; it's just a bunch of bytes.
using Address = h160;
// The various denominations; here for ease of use where needed within code.
static const u256 wei = 1;
static const u256 shannon = u256("1000000000");
static const u256 szabo = shannon * 1000;
static const u256 finney = szabo * 1000;
static const u256 ether = finney * 1000;
class ExecutionFramework
{
public:
ExecutionFramework();
explicit ExecutionFramework(std::string const& _ipcPath, langutil::EVMVersion _evmVersion);
explicit ExecutionFramework(langutil::EVMVersion _evmVersion);
virtual ~ExecutionFramework() = default;
virtual bytes const& compileAndRunWithoutCheck(
@@ -200,9 +201,7 @@ public:
u256 gasLimit() const;
u256 gasPrice() const;
u256 blockHash(u256 const& _blockNumber) const;
u256 const& blockNumber() const {
return m_blockNumber;
}
u256 blockNumber() const;
template<typename Range>
static bytes encodeArray(bool _dynamicallySized, bool _dynamicallyEncoded, Range const& _elements)
@@ -257,26 +256,23 @@ protected:
bool storageEmpty(Address const& _addr);
bool addressHasCode(Address const& _addr);
RPCSession& m_rpc;
struct LogEntry
{
Address address;
std::vector<h256> topics;
bytes data;
};
size_t numLogs() const;
size_t numLogTopics(size_t _logIdx) const;
h256 logTopic(size_t _logIdx, size_t _topicIdx) const;
Address logAddress(size_t _logIdx) const;
bytes const& logData(size_t _logIdx) const;
langutil::EVMVersion m_evmVersion;
solidity::OptimiserSettings m_optimiserSettings = solidity::OptimiserSettings::minimal();
bool m_showMessages = false;
std::shared_ptr<EVMHost> m_evmHost;
bool m_transactionSuccessful = true;
Address m_sender;
Address m_sender = account(0);
Address m_contractAddress;
u256 m_blockNumber;
u256 const m_gasPrice = 100 * szabo;
u256 const m_gas = 100000000;
bytes m_output;
std::vector<LogEntry> m_logs;
u256 m_gasUsed;
};