mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
xMerge remote-tracking branch 'upstream/develop' into addTests
This commit is contained in:
commit
6c75c0bee0
88 files changed
+610
-51242
No files matched your search
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @author Christian R <c@ethdev.com>
|
||||
* @date 2015
|
||||
* Unit tests for the account holder used by the WebThreeStubServer.
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libweb3jsonrpc/AccountHolder.h>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(AccountHolderTest)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ProxyAccountUseCase)
|
||||
{
|
||||
AccountHolder h = AccountHolder(std::function<eth::Interface*()>());
|
||||
BOOST_CHECK(h.getAllAccounts().empty());
|
||||
BOOST_CHECK(h.getRealAccounts().empty());
|
||||
Address addr("abababababababababababababababababababab");
|
||||
Address addr2("abababababababababababababababababababab");
|
||||
int id = h.addProxyAccount(addr);
|
||||
BOOST_CHECK(h.getQueuedTransactions(id).empty());
|
||||
// register it again
|
||||
int secondID = h.addProxyAccount(addr);
|
||||
BOOST_CHECK(h.getQueuedTransactions(secondID).empty());
|
||||
|
||||
eth::TransactionSkeleton t1;
|
||||
eth::TransactionSkeleton t2;
|
||||
t1.from = addr;
|
||||
t1.data = fromHex("12345678");
|
||||
t2.from = addr;
|
||||
t2.data = fromHex("abcdef");
|
||||
BOOST_CHECK(h.getQueuedTransactions(id).empty());
|
||||
h.queueTransaction(t1);
|
||||
BOOST_CHECK_EQUAL(1, h.getQueuedTransactions(id).size());
|
||||
h.queueTransaction(t2);
|
||||
BOOST_REQUIRE_EQUAL(2, h.getQueuedTransactions(id).size());
|
||||
|
||||
// second proxy should not see transactions
|
||||
BOOST_CHECK(h.getQueuedTransactions(secondID).empty());
|
||||
|
||||
BOOST_CHECK(h.getQueuedTransactions(id)[0].data == t1.data);
|
||||
BOOST_CHECK(h.getQueuedTransactions(id)[1].data == t2.data);
|
||||
|
||||
h.clearQueue(id);
|
||||
BOOST_CHECK(h.getQueuedTransactions(id).empty());
|
||||
// removing fails because it never existed
|
||||
BOOST_CHECK(!h.removeProxyAccount(secondID));
|
||||
BOOST_CHECK(h.removeProxyAccount(id));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
}
|
||||
+32
-28
@@ -1,14 +1,39 @@
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
|
||||
aux_source_directory(. SRC_LIST)
|
||||
list(REMOVE_ITEM SRC_LIST "./createRandomVMTest.cpp")
|
||||
list(REMOVE_ITEM SRC_LIST "./createRandomStateTest.cpp")
|
||||
list(REMOVE_ITEM SRC_LIST "./checkRandomVMTest.cpp")
|
||||
list(REMOVE_ITEM SRC_LIST "./checkRandomStateTest.cpp")
|
||||
|
||||
if (NOT JSONRPC)
|
||||
list(REMOVE_ITEM SRC_LIST "./AccountHolder.cpp")
|
||||
endif()
|
||||
macro (add_sources)
|
||||
file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}/test" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
foreach (_src ${ARGN})
|
||||
if (_relPath)
|
||||
list (APPEND SRC "${_relPath}/${_src}")
|
||||
else()
|
||||
list (APPEND SRC "${_src}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (_relPath)
|
||||
# propagate SRCS to parent directory
|
||||
set (SRC ${SRC} PARENT_SCOPE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
add_subdirectory(fuzzTesting)
|
||||
add_subdirectory(libdevcore)
|
||||
add_subdirectory(libdevcrypto)
|
||||
add_subdirectory(libethcore)
|
||||
add_subdirectory(libethereum)
|
||||
add_subdirectory(libevm)
|
||||
add_subdirectory(libnatspec)
|
||||
add_subdirectory(libp2p)
|
||||
if (SOLIDITY)
|
||||
add_subdirectory(libsolidity)
|
||||
endif ()
|
||||
if (JSONRPC)
|
||||
add_subdirectory(libweb3jsonrpc)
|
||||
endif ()
|
||||
add_subdirectory(libwhisper)
|
||||
|
||||
set(SRC_LIST ${SRC_LIST} ${SRC})
|
||||
|
||||
include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS})
|
||||
include_directories(BEFORE ..)
|
||||
@@ -34,10 +59,6 @@ endforeach(file)
|
||||
|
||||
file(GLOB HEADERS "*.h")
|
||||
add_executable(testeth ${SRC_LIST} ${HEADERS})
|
||||
add_executable(createRandomVMTest createRandomVMTest.cpp vm.cpp TestHelper.cpp Stats.cpp)
|
||||
add_executable(createRandomStateTest createRandomStateTest.cpp TestHelper.cpp Stats.cpp)
|
||||
add_executable(checkRandomVMTest checkRandomVMTest.cpp vm.cpp TestHelper.cpp Stats.cpp)
|
||||
add_executable(checkRandomStateTest checkRandomStateTest.cpp TestHelper.cpp Stats.cpp)
|
||||
|
||||
target_link_libraries(testeth ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(testeth ${CURL_LIBRARIES})
|
||||
@@ -57,23 +78,6 @@ if (JSONRPC)
|
||||
target_link_libraries(testeth ${JSON_RPC_CPP_CLIENT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(createRandomVMTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(createRandomVMTest ethereum)
|
||||
target_link_libraries(createRandomVMTest ethcore)
|
||||
target_link_libraries(createRandomVMTest testutils)
|
||||
target_link_libraries(createRandomStateTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(createRandomStateTest ethereum)
|
||||
target_link_libraries(createRandomStateTest ethcore)
|
||||
target_link_libraries(createRandomStateTest testutils)
|
||||
target_link_libraries(checkRandomVMTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(checkRandomVMTest ethereum)
|
||||
target_link_libraries(checkRandomVMTest ethcore)
|
||||
target_link_libraries(checkRandomVMTest testutils)
|
||||
target_link_libraries(checkRandomStateTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(checkRandomStateTest ethereum)
|
||||
target_link_libraries(checkRandomStateTest ethcore)
|
||||
target_link_libraries(checkRandomStateTest testutils)
|
||||
|
||||
enable_testing()
|
||||
set(CTEST_OUTPUT_ON_FAILURE TRUE)
|
||||
|
||||
|
||||
-221
@@ -1,221 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file ClientBase.cpp
|
||||
* @author Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcore/CommonJS.h>
|
||||
#include "TestUtils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::test;
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(ClientBase, ParallelClientBaseFixture)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(blocks)
|
||||
{
|
||||
enumerateClients([](Json::Value const& _json, dev::eth::ClientBase& _client) -> void
|
||||
{
|
||||
auto compareState = [&_client](Json::Value const& _o, string const& _name, BlockNumber _blockNumber) -> void
|
||||
{
|
||||
Address address(_name);
|
||||
|
||||
// balanceAt
|
||||
u256 expectedBalance = u256(_o["balance"].asString());
|
||||
u256 balance = _client.balanceAt(address, _blockNumber);
|
||||
ETH_CHECK_EQUAL(expectedBalance, balance);
|
||||
|
||||
// countAt
|
||||
u256 expectedCount = u256(_o["nonce"].asString());
|
||||
u256 count = _client.countAt(address, _blockNumber);
|
||||
ETH_CHECK_EQUAL(expectedCount, count);
|
||||
|
||||
// stateAt
|
||||
for (string const& pos: _o["storage"].getMemberNames())
|
||||
{
|
||||
u256 expectedState = u256(_o["storage"][pos].asString());
|
||||
u256 state = _client.stateAt(address, u256(pos), _blockNumber);
|
||||
ETH_CHECK_EQUAL(expectedState, state);
|
||||
}
|
||||
|
||||
// codeAt
|
||||
bytes expectedCode = fromHex(_o["code"].asString());
|
||||
bytes code = _client.codeAt(address, _blockNumber);
|
||||
ETH_CHECK_EQUAL_COLLECTIONS(expectedCode.begin(), expectedCode.end(),
|
||||
code.begin(), code.end());
|
||||
};
|
||||
|
||||
for (string const& name: _json["postState"].getMemberNames())
|
||||
{
|
||||
Json::Value o = _json["postState"][name];
|
||||
compareState(o, name, PendingBlock);
|
||||
}
|
||||
|
||||
for (string const& name: _json["pre"].getMemberNames())
|
||||
{
|
||||
Json::Value o = _json["pre"][name];
|
||||
compareState(o, name, 0);
|
||||
}
|
||||
|
||||
// number
|
||||
unsigned expectedNumber = _json["blocks"].size();
|
||||
unsigned number = _client.number();
|
||||
ETH_CHECK_EQUAL(expectedNumber, number);
|
||||
|
||||
u256 totalDifficulty = u256(_json["genesisBlockHeader"]["difficulty"].asString());
|
||||
for (Json::Value const& block: _json["blocks"])
|
||||
{
|
||||
Json::Value blockHeader = block["blockHeader"];
|
||||
Json::Value uncles = block["uncleHeaders"];
|
||||
Json::Value transactions = block["transactions"];
|
||||
h256 blockHash = h256(fromHex(blockHeader["hash"].asString()));
|
||||
|
||||
// just update the difficulty
|
||||
for (Json::Value const& uncle: uncles)
|
||||
{
|
||||
totalDifficulty += u256(uncle["difficulty"].asString());
|
||||
}
|
||||
|
||||
// hashFromNumber
|
||||
h256 expectedHashFromNumber = h256(fromHex(blockHeader["hash"].asString()));
|
||||
h256 hashFromNumber = _client.hashFromNumber(jsToInt(blockHeader["number"].asString()));
|
||||
ETH_CHECK_EQUAL(expectedHashFromNumber, hashFromNumber);
|
||||
|
||||
// blockInfo
|
||||
auto compareBlockInfos = [](Json::Value const& _b, BlockInfo _blockInfo) -> void
|
||||
{
|
||||
LogBloom expectedBlockInfoBloom = LogBloom(fromHex(_b["bloom"].asString()));
|
||||
Address expectedBlockInfoCoinbase = Address(fromHex(_b["coinbase"].asString()));
|
||||
u256 expectedBlockInfoDifficulty = u256(_b["difficulty"].asString());
|
||||
bytes expectedBlockInfoExtraData = fromHex(_b["extraData"].asString());
|
||||
u256 expectedBlockInfoGasLimit = u256(_b["gasLimit"].asString());
|
||||
u256 expectedBlockInfoGasUsed = u256(_b["gasUsed"].asString());
|
||||
h256 expectedBlockInfoHash = h256(fromHex(_b["hash"].asString()));
|
||||
h256 expectedBlockInfoMixHash = h256(fromHex(_b["mixHash"].asString()));
|
||||
Nonce expectedBlockInfoNonce = Nonce(fromHex(_b["nonce"].asString()));
|
||||
u256 expectedBlockInfoNumber = u256(_b["number"].asString());
|
||||
h256 expectedBlockInfoParentHash = h256(fromHex(_b["parentHash"].asString()));
|
||||
h256 expectedBlockInfoReceiptsRoot = h256(fromHex(_b["receiptTrie"].asString()));
|
||||
u256 expectedBlockInfoTimestamp = u256(_b["timestamp"].asString());
|
||||
h256 expectedBlockInfoTransactionsRoot = h256(fromHex(_b["transactionsTrie"].asString()));
|
||||
h256 expectedBlockInfoUncldeHash = h256(fromHex(_b["uncleHash"].asString()));
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoBloom, _blockInfo.logBloom);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoCoinbase, _blockInfo.coinbaseAddress);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoDifficulty, _blockInfo.difficulty);
|
||||
ETH_CHECK_EQUAL_COLLECTIONS(
|
||||
expectedBlockInfoExtraData.begin(),
|
||||
expectedBlockInfoExtraData.end(),
|
||||
_blockInfo.extraData.begin(),
|
||||
_blockInfo.extraData.end()
|
||||
);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoGasLimit, _blockInfo.gasLimit);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoGasUsed, _blockInfo.gasUsed);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoHash, _blockInfo.hash());
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoMixHash, _blockInfo.mixHash);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoNonce, _blockInfo.nonce);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoNumber, _blockInfo.number);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoParentHash, _blockInfo.parentHash);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoReceiptsRoot, _blockInfo.receiptsRoot);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoTimestamp, _blockInfo.timestamp);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoTransactionsRoot, _blockInfo.transactionsRoot);
|
||||
ETH_CHECK_EQUAL(expectedBlockInfoUncldeHash, _blockInfo.sha3Uncles);
|
||||
};
|
||||
|
||||
BlockInfo blockInfo = _client.blockInfo(blockHash);
|
||||
compareBlockInfos(blockHeader, blockInfo);
|
||||
|
||||
// blockDetails
|
||||
unsigned expectedBlockDetailsNumber = jsToInt(blockHeader["number"].asString());
|
||||
totalDifficulty += u256(blockHeader["difficulty"].asString());
|
||||
BlockDetails blockDetails = _client.blockDetails(blockHash);
|
||||
ETH_CHECK_EQUAL(expectedBlockDetailsNumber, blockDetails.number);
|
||||
ETH_CHECK_EQUAL(totalDifficulty, blockDetails.totalDifficulty);
|
||||
|
||||
auto compareTransactions = [](Json::Value const& _t, Transaction _transaction) -> void
|
||||
{
|
||||
bytes expectedTransactionData = fromHex(_t["data"].asString());
|
||||
u256 expectedTransactionGasLimit = u256(_t["gasLimit"].asString());
|
||||
u256 expectedTransactionGasPrice = u256(_t["gasPrice"].asString());
|
||||
u256 expectedTransactionNonce = u256(_t["nonce"].asString());
|
||||
u256 expectedTransactionSignatureR = h256(fromHex(_t["r"].asString()));
|
||||
u256 expectedTransactionSignatureS = h256(fromHex(_t["s"].asString()));
|
||||
// unsigned expectedTransactionSignatureV = jsToInt(t["v"].asString());
|
||||
|
||||
ETH_CHECK_EQUAL_COLLECTIONS(
|
||||
expectedTransactionData.begin(),
|
||||
expectedTransactionData.end(),
|
||||
_transaction.data().begin(),
|
||||
_transaction.data().end()
|
||||
);
|
||||
ETH_CHECK_EQUAL(expectedTransactionGasLimit, _transaction.gas());
|
||||
ETH_CHECK_EQUAL(expectedTransactionGasPrice, _transaction.gasPrice());
|
||||
ETH_CHECK_EQUAL(expectedTransactionNonce, _transaction.nonce());
|
||||
ETH_CHECK_EQUAL(expectedTransactionSignatureR, _transaction.signature().r);
|
||||
ETH_CHECK_EQUAL(expectedTransactionSignatureS, _transaction.signature().s);
|
||||
// ETH_CHECK_EQUAL(expectedTransactionSignatureV, _transaction.signature().v); // 27 === 0x0, 28 === 0x1, not sure why
|
||||
};
|
||||
|
||||
Transactions ts = _client.transactions(blockHash);
|
||||
TransactionHashes tHashes = _client.transactionHashes(blockHash);
|
||||
unsigned tsCount = _client.transactionCount(blockHash);
|
||||
|
||||
ETH_REQUIRE(transactions.size() == ts.size());
|
||||
ETH_REQUIRE(transactions.size() == tHashes.size());
|
||||
|
||||
// transactionCount
|
||||
ETH_CHECK_EQUAL(transactions.size(), tsCount);
|
||||
|
||||
for (unsigned i = 0; i < tsCount; i++)
|
||||
{
|
||||
Json::Value t = transactions[i];
|
||||
|
||||
// transaction (by block hash and transaction index)
|
||||
Transaction transaction = _client.transaction(blockHash, i);
|
||||
compareTransactions(t, transaction);
|
||||
|
||||
// transaction (by hash)
|
||||
Transaction transactionByHash = _client.transaction(transaction.sha3());
|
||||
compareTransactions(t, transactionByHash);
|
||||
|
||||
// transactions
|
||||
compareTransactions(t, ts[i]);
|
||||
|
||||
// transactionHashes
|
||||
ETH_CHECK_EQUAL(transaction.sha3(), tHashes[i]);
|
||||
}
|
||||
|
||||
// uncleCount
|
||||
unsigned usCount = _client.uncleCount(blockHash);
|
||||
ETH_CHECK_EQUAL(uncles.size(), usCount);
|
||||
|
||||
for (unsigned i = 0; i < usCount; i++)
|
||||
{
|
||||
Json::Value u = uncles[i];
|
||||
|
||||
// uncle (by hash)
|
||||
BlockInfo uncle = _client.uncle(blockHash, i);
|
||||
compareBlockInfos(u, uncle);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
-1513
File diff suppressed because it is too large.
Load diff
@@ -1,24 +0,0 @@
|
||||
|
||||
n = 100
|
||||
|
||||
splitNumBegin = 128 - (n / 2)
|
||||
i = 1
|
||||
|
||||
template = """
|
||||
function right{0}(uint seed) returns (uint) {{
|
||||
var r = nextRand(seed);
|
||||
if (r >= 2**{2})
|
||||
return right{1}(r);
|
||||
return left{1}(r);
|
||||
}}
|
||||
|
||||
function left{0}(uint seed) returns (uint) {{
|
||||
var r = nextRand(nextRand(seed));
|
||||
if (r >= 2**{2})
|
||||
return left{1}(r);
|
||||
return right{1}(r);
|
||||
}}
|
||||
"""
|
||||
|
||||
for i in range(1, n):
|
||||
print template.format(i, i + 1, i + splitNumBegin)
|
||||
-482
@@ -1,482 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file MemTrie.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#include "MemTrie.h"
|
||||
|
||||
#include <libdevcrypto/TrieCommon.h>
|
||||
#include <libdevcrypto/SHA3.h>
|
||||
#include <libethcore/Common.h>
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
|
||||
#define ENABLE_DEBUG_PRINT 0
|
||||
|
||||
/*/
|
||||
#define APPEND_CHILD appendData
|
||||
/*/
|
||||
#define APPEND_CHILD appendRaw
|
||||
/**/
|
||||
|
||||
class MemTrieNode
|
||||
{
|
||||
public:
|
||||
MemTrieNode() {}
|
||||
virtual ~MemTrieNode() {}
|
||||
|
||||
virtual std::string const& at(bytesConstRef _key) const = 0;
|
||||
virtual MemTrieNode* insert(bytesConstRef _key, std::string const& _value) = 0;
|
||||
virtual MemTrieNode* remove(bytesConstRef _key) = 0;
|
||||
void putRLP(RLPStream& _parentStream) const;
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
void debugPrint(std::string const& _indent = "") const { std::cerr << std::hex << hash256() << ":" << std::dec << std::endl; debugPrintBody(_indent); }
|
||||
#endif
|
||||
|
||||
/// 256-bit hash of the node - this is a SHA-3/256 hash of the RLP of the node.
|
||||
h256 hash256() const { RLPStream s; makeRLP(s); return dev::sha3(s.out()); }
|
||||
bytes rlp() const { RLPStream s; makeRLP(s); return s.out(); }
|
||||
void mark() { m_hash256 = h256(); }
|
||||
|
||||
protected:
|
||||
virtual void makeRLP(RLPStream& _intoStream) const = 0;
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
virtual void debugPrintBody(std::string const& _indent = "") const = 0;
|
||||
#endif
|
||||
|
||||
static MemTrieNode* newBranch(bytesConstRef _k1, std::string const& _v1, bytesConstRef _k2, std::string const& _v2);
|
||||
|
||||
private:
|
||||
mutable h256 m_hash256;
|
||||
};
|
||||
|
||||
static const std::string c_nullString;
|
||||
|
||||
class TrieExtNode: public MemTrieNode
|
||||
{
|
||||
public:
|
||||
TrieExtNode(bytesConstRef _bytes): m_ext(_bytes.begin(), _bytes.end()) {}
|
||||
|
||||
bytes m_ext;
|
||||
};
|
||||
|
||||
class TrieBranchNode: public MemTrieNode
|
||||
{
|
||||
public:
|
||||
TrieBranchNode(std::string const& _value): m_value(_value)
|
||||
{
|
||||
memset(m_nodes.data(), 0, sizeof(MemTrieNode*) * 16);
|
||||
}
|
||||
|
||||
TrieBranchNode(byte _i1, MemTrieNode* _n1, std::string const& _value = std::string()): m_value(_value)
|
||||
{
|
||||
memset(m_nodes.data(), 0, sizeof(MemTrieNode*) * 16);
|
||||
m_nodes[_i1] = _n1;
|
||||
}
|
||||
|
||||
TrieBranchNode(byte _i1, MemTrieNode* _n1, byte _i2, MemTrieNode* _n2)
|
||||
{
|
||||
memset(m_nodes.data(), 0, sizeof(MemTrieNode*) * 16);
|
||||
m_nodes[_i1] = _n1;
|
||||
m_nodes[_i2] = _n2;
|
||||
}
|
||||
|
||||
virtual ~TrieBranchNode()
|
||||
{
|
||||
for (auto i: m_nodes)
|
||||
delete i;
|
||||
}
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
virtual void debugPrintBody(std::string const& _indent) const
|
||||
{
|
||||
|
||||
if (m_value.size())
|
||||
std::cerr << _indent << "@: " << m_value << std::endl;
|
||||
for (auto i = 0; i < 16; ++i)
|
||||
if (m_nodes[i])
|
||||
{
|
||||
std::cerr << _indent << std::hex << i << ": " << std::dec;
|
||||
m_nodes[i]->debugPrint(_indent + " ");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual std::string const& at(bytesConstRef _key) const override;
|
||||
virtual MemTrieNode* insert(bytesConstRef _key, std::string const& _value) override;
|
||||
virtual MemTrieNode* remove(bytesConstRef _key) override;
|
||||
virtual void makeRLP(RLPStream& _parentStream) const override;
|
||||
|
||||
private:
|
||||
/// @returns (byte)-1 when no active branches, 16 when multiple active and the index of the active branch otherwise.
|
||||
byte activeBranch() const;
|
||||
|
||||
MemTrieNode* rejig();
|
||||
|
||||
std::array<MemTrieNode*, 16> m_nodes;
|
||||
std::string m_value;
|
||||
};
|
||||
|
||||
class TrieLeafNode: public TrieExtNode
|
||||
{
|
||||
public:
|
||||
TrieLeafNode(bytesConstRef _key, std::string const& _value): TrieExtNode(_key), m_value(_value) {}
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
virtual void debugPrintBody(std::string const& _indent) const
|
||||
{
|
||||
assert(m_value.size());
|
||||
std::cerr << _indent;
|
||||
if (m_ext.size())
|
||||
std::cerr << toHex(m_ext, 1) << ": ";
|
||||
else
|
||||
std::cerr << "@: ";
|
||||
std::cerr << m_value << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual std::string const& at(bytesConstRef _key) const override { return contains(_key) ? m_value : c_nullString; }
|
||||
virtual MemTrieNode* insert(bytesConstRef _key, std::string const& _value) override;
|
||||
virtual MemTrieNode* remove(bytesConstRef _key) override;
|
||||
virtual void makeRLP(RLPStream& _parentStream) const override;
|
||||
|
||||
private:
|
||||
bool contains(bytesConstRef _key) const { return _key.size() == m_ext.size() && !memcmp(_key.data(), m_ext.data(), _key.size()); }
|
||||
|
||||
std::string m_value;
|
||||
};
|
||||
|
||||
class TrieInfixNode: public TrieExtNode
|
||||
{
|
||||
public:
|
||||
TrieInfixNode(bytesConstRef _key, MemTrieNode* _next): TrieExtNode(_key), m_next(_next) {}
|
||||
virtual ~TrieInfixNode() { delete m_next; }
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
virtual void debugPrintBody(std::string const& _indent) const
|
||||
{
|
||||
std::cerr << _indent << toHex(m_ext, 1) << ": ";
|
||||
m_next->debugPrint(_indent + " ");
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual std::string const& at(bytesConstRef _key) const override { assert(m_next); return contains(_key) ? m_next->at(_key.cropped(m_ext.size())) : c_nullString; }
|
||||
virtual MemTrieNode* insert(bytesConstRef _key, std::string const& _value) override;
|
||||
virtual MemTrieNode* remove(bytesConstRef _key) override;
|
||||
virtual void makeRLP(RLPStream& _parentStream) const override;
|
||||
|
||||
private:
|
||||
bool contains(bytesConstRef _key) const { return _key.size() >= m_ext.size() && !memcmp(_key.data(), m_ext.data(), m_ext.size()); }
|
||||
|
||||
MemTrieNode* m_next;
|
||||
};
|
||||
|
||||
void MemTrieNode::putRLP(RLPStream& _parentStream) const
|
||||
{
|
||||
RLPStream s;
|
||||
makeRLP(s);
|
||||
if (s.out().size() < 32)
|
||||
_parentStream.APPEND_CHILD(s.out());
|
||||
else
|
||||
_parentStream << dev::sha3(s.out());
|
||||
}
|
||||
|
||||
void TrieBranchNode::makeRLP(RLPStream& _intoStream) const
|
||||
{
|
||||
_intoStream.appendList(17);
|
||||
for (auto i: m_nodes)
|
||||
if (i)
|
||||
i->putRLP(_intoStream);
|
||||
else
|
||||
_intoStream << "";
|
||||
_intoStream << m_value;
|
||||
}
|
||||
|
||||
void TrieLeafNode::makeRLP(RLPStream& _intoStream) const
|
||||
{
|
||||
_intoStream.appendList(2) << hexPrefixEncode(m_ext, true) << m_value;
|
||||
}
|
||||
|
||||
void TrieInfixNode::makeRLP(RLPStream& _intoStream) const
|
||||
{
|
||||
assert(m_next);
|
||||
_intoStream.appendList(2);
|
||||
_intoStream << hexPrefixEncode(m_ext, false);
|
||||
m_next->putRLP(_intoStream);
|
||||
}
|
||||
|
||||
MemTrieNode* MemTrieNode::newBranch(bytesConstRef _k1, std::string const& _v1, bytesConstRef _k2, std::string const& _v2)
|
||||
{
|
||||
unsigned prefix = commonPrefix(_k1, _k2);
|
||||
|
||||
MemTrieNode* ret;
|
||||
if (_k1.size() == prefix)
|
||||
ret = new TrieBranchNode(_k2[prefix], new TrieLeafNode(_k2.cropped(prefix + 1), _v2), _v1);
|
||||
else if (_k2.size() == prefix)
|
||||
ret = new TrieBranchNode(_k1[prefix], new TrieLeafNode(_k1.cropped(prefix + 1), _v1), _v2);
|
||||
else // both continue after split
|
||||
ret = new TrieBranchNode(_k1[prefix], new TrieLeafNode(_k1.cropped(prefix + 1), _v1), _k2[prefix], new TrieLeafNode(_k2.cropped(prefix + 1), _v2));
|
||||
|
||||
if (prefix)
|
||||
// have shared prefix - split.
|
||||
ret = new TrieInfixNode(_k1.cropped(0, prefix), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string const& TrieBranchNode::at(bytesConstRef _key) const
|
||||
{
|
||||
if (_key.empty())
|
||||
return m_value;
|
||||
else if (m_nodes[_key[0]] != nullptr)
|
||||
return m_nodes[_key[0]]->at(_key.cropped(1));
|
||||
return c_nullString;
|
||||
}
|
||||
|
||||
MemTrieNode* TrieBranchNode::insert(bytesConstRef _key, std::string const& _value)
|
||||
{
|
||||
assert(_value.size());
|
||||
mark();
|
||||
if (_key.empty())
|
||||
m_value = _value;
|
||||
else
|
||||
if (!m_nodes[_key[0]])
|
||||
m_nodes[_key[0]] = new TrieLeafNode(_key.cropped(1), _value);
|
||||
else
|
||||
m_nodes[_key[0]] = m_nodes[_key[0]]->insert(_key.cropped(1), _value);
|
||||
return this;
|
||||
}
|
||||
|
||||
MemTrieNode* TrieBranchNode::remove(bytesConstRef _key)
|
||||
{
|
||||
if (_key.empty())
|
||||
if (m_value.size())
|
||||
{
|
||||
m_value.clear();
|
||||
return rejig();
|
||||
}
|
||||
else {}
|
||||
else if (m_nodes[_key[0]] != nullptr)
|
||||
{
|
||||
m_nodes[_key[0]] = m_nodes[_key[0]]->remove(_key.cropped(1));
|
||||
return rejig();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
MemTrieNode* TrieBranchNode::rejig()
|
||||
{
|
||||
mark();
|
||||
byte n = activeBranch();
|
||||
|
||||
if (n == (byte)-1 && m_value.size())
|
||||
{
|
||||
// switch to leaf
|
||||
auto r = new TrieLeafNode(bytesConstRef(), m_value);
|
||||
delete this;
|
||||
return r;
|
||||
}
|
||||
else if (n < 16 && m_value.empty())
|
||||
{
|
||||
// only branching to n...
|
||||
if (auto b = dynamic_cast<TrieBranchNode*>(m_nodes[n]))
|
||||
{
|
||||
// switch to infix
|
||||
m_nodes[n] = nullptr;
|
||||
delete this;
|
||||
return new TrieInfixNode(bytesConstRef(&n, 1), b);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto x = dynamic_cast<TrieExtNode*>(m_nodes[n]);
|
||||
assert(x);
|
||||
// include in child
|
||||
pushFront(x->m_ext, n);
|
||||
m_nodes[n] = nullptr;
|
||||
delete this;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
byte TrieBranchNode::activeBranch() const
|
||||
{
|
||||
byte n = (byte)-1;
|
||||
for (int i = 0; i < 16; ++i)
|
||||
if (m_nodes[i] != nullptr)
|
||||
{
|
||||
if (n == (byte)-1)
|
||||
n = (byte)i;
|
||||
else
|
||||
return 16;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
MemTrieNode* TrieInfixNode::insert(bytesConstRef _key, std::string const& _value)
|
||||
{
|
||||
assert(_value.size());
|
||||
mark();
|
||||
if (contains(_key))
|
||||
{
|
||||
m_next = m_next->insert(_key.cropped(m_ext.size()), _value);
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned prefix = commonPrefix(_key, m_ext);
|
||||
if (prefix)
|
||||
{
|
||||
// one infix becomes two infixes, then insert into the second
|
||||
// instead of pop_front()...
|
||||
trimFront(m_ext, prefix);
|
||||
|
||||
return new TrieInfixNode(_key.cropped(0, prefix), insert(_key.cropped(prefix), _value));
|
||||
}
|
||||
else
|
||||
{
|
||||
// split here.
|
||||
auto f = m_ext[0];
|
||||
trimFront(m_ext, 1);
|
||||
MemTrieNode* n = m_ext.empty() ? m_next : this;
|
||||
if (n != this)
|
||||
{
|
||||
m_next = nullptr;
|
||||
delete this;
|
||||
}
|
||||
TrieBranchNode* ret = new TrieBranchNode(f, n);
|
||||
ret->insert(_key, _value);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MemTrieNode* TrieInfixNode::remove(bytesConstRef _key)
|
||||
{
|
||||
if (contains(_key))
|
||||
{
|
||||
mark();
|
||||
m_next = m_next->remove(_key.cropped(m_ext.size()));
|
||||
if (auto p = dynamic_cast<TrieExtNode*>(m_next))
|
||||
{
|
||||
// merge with child...
|
||||
m_ext.reserve(m_ext.size() + p->m_ext.size());
|
||||
for (auto i: p->m_ext)
|
||||
m_ext.push_back(i);
|
||||
p->m_ext = m_ext;
|
||||
p->mark();
|
||||
m_next = nullptr;
|
||||
delete this;
|
||||
return p;
|
||||
}
|
||||
if (!m_next)
|
||||
{
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
MemTrieNode* TrieLeafNode::insert(bytesConstRef _key, std::string const& _value)
|
||||
{
|
||||
assert(_value.size());
|
||||
mark();
|
||||
if (contains(_key))
|
||||
{
|
||||
m_value = _value;
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create new trie.
|
||||
auto n = MemTrieNode::newBranch(_key, _value, bytesConstRef(&m_ext), m_value);
|
||||
delete this;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
MemTrieNode* TrieLeafNode::remove(bytesConstRef _key)
|
||||
{
|
||||
if (contains(_key))
|
||||
{
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
MemTrie::~MemTrie()
|
||||
{
|
||||
delete m_root;
|
||||
}
|
||||
|
||||
h256 MemTrie::hash256() const
|
||||
{
|
||||
return m_root ? m_root->hash256() : sha3(dev::rlp(bytesConstRef()));
|
||||
}
|
||||
|
||||
bytes MemTrie::rlp() const
|
||||
{
|
||||
return m_root ? m_root->rlp() : dev::rlp(bytesConstRef());
|
||||
}
|
||||
|
||||
void MemTrie::debugPrint()
|
||||
{
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (m_root)
|
||||
m_root->debugPrint();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string const& MemTrie::at(std::string const& _key) const
|
||||
{
|
||||
if (!m_root)
|
||||
return c_nullString;
|
||||
auto h = asNibbles(_key);
|
||||
return m_root->at(bytesConstRef(&h));
|
||||
}
|
||||
|
||||
void MemTrie::insert(std::string const& _key, std::string const& _value)
|
||||
{
|
||||
if (_value.empty())
|
||||
remove(_key);
|
||||
auto h = asNibbles(_key);
|
||||
m_root = m_root ? m_root->insert(&h, _value) : new TrieLeafNode(bytesConstRef(&h), _value);
|
||||
}
|
||||
|
||||
void MemTrie::remove(std::string const& _key)
|
||||
{
|
||||
if (m_root)
|
||||
{
|
||||
auto h = asNibbles(_key);
|
||||
m_root = m_root->remove(&h);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file MemTrie.h
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/FixedHash.h>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
|
||||
class MemTrieNode;
|
||||
|
||||
/**
|
||||
* @brief Merkle Patricia Tree "Trie": a modifed base-16 Radix tree.
|
||||
*/
|
||||
class MemTrie
|
||||
{
|
||||
public:
|
||||
MemTrie(): m_root(nullptr) {}
|
||||
~MemTrie();
|
||||
|
||||
h256 hash256() const;
|
||||
bytes rlp() const;
|
||||
|
||||
void debugPrint();
|
||||
|
||||
std::string const& at(std::string const& _key) const;
|
||||
void insert(std::string const& _key, std::string const& _value);
|
||||
void remove(std::string const& _key);
|
||||
|
||||
private:
|
||||
MemTrieNode* m_root;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
contract PerformanceTester {
|
||||
function ackermann(uint m, uint n) returns (uint) {
|
||||
if (m == 0)
|
||||
return n + 1;
|
||||
|
||||
if (n == 0)
|
||||
return ackermann(m - 1, 1);
|
||||
|
||||
return ackermann(m - 1, ackermann(m, n - 1));
|
||||
}
|
||||
|
||||
function fibonacci(uint n) returns (uint) {
|
||||
if (n == 0 || n == 1)
|
||||
return n;
|
||||
return fibonacci(n - 1) + fibonacci(n - 2);
|
||||
}
|
||||
}
|
||||
+79
-37
@@ -23,9 +23,6 @@
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <libethereum/Client.h>
|
||||
#include <liblll/Compiler.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
@@ -119,6 +116,32 @@ ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller):
|
||||
}
|
||||
}
|
||||
|
||||
json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o)
|
||||
{
|
||||
static const set<string> hashes {"bloom" , "coinbase", "hash", "mixHash", "parentHash", "receiptTrie",
|
||||
"stateRoot", "transactionsTrie", "uncleHash", "currentCoinbase",
|
||||
"previousHash", "to", "address", "caller", "origin", "secretKey", "data"};
|
||||
|
||||
for (auto& i: _o)
|
||||
{
|
||||
std::string key = i.first;
|
||||
if (hashes.count(key))
|
||||
continue;
|
||||
|
||||
std::string str;
|
||||
json_spirit::mValue value = i.second;
|
||||
|
||||
if (value.type() == json_spirit::int_type)
|
||||
str = toString(value.get_int());
|
||||
else if (value.type() == json_spirit::str_type)
|
||||
str = value.get_str();
|
||||
else continue;
|
||||
|
||||
_o[key] = (str.substr(0, 2) == "0x") ? str : toCompactHex(toInt(str), HexPrefix::Add, 1);
|
||||
}
|
||||
return _o;
|
||||
}
|
||||
|
||||
void ImportTest::importEnv(json_spirit::mObject& _o)
|
||||
{
|
||||
assert(_o.count("previousHash") > 0);
|
||||
@@ -304,7 +327,7 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta
|
||||
void ImportTest::exportTest(bytes const& _output, State const& _statePost)
|
||||
{
|
||||
// export output
|
||||
m_TestObject["out"] = "0x" + toHex(_output);
|
||||
m_TestObject["out"] = toHex(_output, 2, HexPrefix::Add);
|
||||
|
||||
// export logs
|
||||
m_TestObject["logs"] = exportLog(_statePost.pending().size() ? _statePost.log(0) : LogEntries());
|
||||
@@ -325,31 +348,64 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost)
|
||||
|
||||
// export pre state
|
||||
m_TestObject["pre"] = fillJsonWithState(m_statePre);
|
||||
m_TestObject["env"] = makeAllFieldsHex(m_TestObject["env"].get_obj());
|
||||
m_TestObject["transaction"] = makeAllFieldsHex(m_TestObject["transaction"].get_obj());
|
||||
}
|
||||
|
||||
json_spirit::mObject fillJsonWithTransaction(Transaction _txn)
|
||||
{
|
||||
json_spirit::mObject txObject;
|
||||
txObject["nonce"] = toCompactHex(_txn.nonce(), HexPrefix::Add, 1);
|
||||
txObject["data"] = toHex(_txn.data(), 2, HexPrefix::Add);
|
||||
txObject["gasLimit"] = toCompactHex(_txn.gas(), HexPrefix::Add, 1);
|
||||
txObject["gasPrice"] = toCompactHex(_txn.gasPrice(), HexPrefix::Add, 1);
|
||||
txObject["r"] = toCompactHex(_txn.signature().r, HexPrefix::Add, 1);
|
||||
txObject["s"] = toCompactHex(_txn.signature().s, HexPrefix::Add, 1);
|
||||
txObject["v"] = toCompactHex(_txn.signature().v + 27, HexPrefix::Add, 1);
|
||||
txObject["to"] = _txn.isCreation() ? "" : toString(_txn.receiveAddress());
|
||||
txObject["value"] = toCompactHex(_txn.value(), HexPrefix::Add, 1);
|
||||
return txObject;
|
||||
}
|
||||
|
||||
json_spirit::mObject fillJsonWithState(State _state)
|
||||
{
|
||||
// export pre state
|
||||
json_spirit::mObject oState;
|
||||
|
||||
for (auto const& a: _state.addresses())
|
||||
{
|
||||
json_spirit::mObject o;
|
||||
o["balance"] = toString(_state.balance(a.first));
|
||||
o["nonce"] = toString(_state.transactionsFrom(a.first));
|
||||
o["balance"] = toCompactHex(_state.balance(a.first), HexPrefix::Add, 1);
|
||||
o["nonce"] = toCompactHex(_state.transactionsFrom(a.first), HexPrefix::Add, 1);
|
||||
{
|
||||
json_spirit::mObject store;
|
||||
for (auto const& s: _state.storage(a.first))
|
||||
store["0x"+toHex(toCompactBigEndian(s.first))] = "0x"+toHex(toCompactBigEndian(s.second));
|
||||
store[toCompactHex(s.first, HexPrefix::Add, 1)] = toCompactHex(s.second, HexPrefix::Add, 1);
|
||||
o["storage"] = store;
|
||||
}
|
||||
o["code"] = "0x" + toHex(_state.code(a.first));
|
||||
|
||||
o["code"] = toHex(_state.code(a.first), 2, HexPrefix::Add);
|
||||
oState[toString(a.first)] = o;
|
||||
}
|
||||
return oState;
|
||||
}
|
||||
|
||||
json_spirit::mArray exportLog(eth::LogEntries _logs)
|
||||
{
|
||||
json_spirit::mArray ret;
|
||||
if (_logs.size() == 0) return ret;
|
||||
for (LogEntry const& l: _logs)
|
||||
{
|
||||
json_spirit::mObject o;
|
||||
o["address"] = toString(l.address);
|
||||
json_spirit::mArray topics;
|
||||
for (auto const& t: l.topics)
|
||||
topics.push_back(toString(t));
|
||||
o["topics"] = topics;
|
||||
o["data"] = toHex(l.data, 2, HexPrefix::Add);
|
||||
o["bloom"] = toString(l.bloom());
|
||||
ret.push_back(o);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u256 toInt(json_spirit::mValue const& _v)
|
||||
{
|
||||
switch (_v.type())
|
||||
@@ -430,25 +486,6 @@ LogEntries importLog(json_spirit::mArray& _a)
|
||||
return logEntries;
|
||||
}
|
||||
|
||||
json_spirit::mArray exportLog(eth::LogEntries _logs)
|
||||
{
|
||||
json_spirit::mArray ret;
|
||||
if (_logs.size() == 0) return ret;
|
||||
for (LogEntry const& l: _logs)
|
||||
{
|
||||
json_spirit::mObject o;
|
||||
o["address"] = toString(l.address);
|
||||
json_spirit::mArray topics;
|
||||
for (auto const& t: l.topics)
|
||||
topics.push_back(toString(t));
|
||||
o["topics"] = topics;
|
||||
o["data"] = "0x" + toHex(l.data);
|
||||
o["bloom"] = toString(l.bloom());
|
||||
ret.push_back(o);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void checkOutput(bytes const& _output, json_spirit::mObject& _o)
|
||||
{
|
||||
int j = 0;
|
||||
@@ -514,6 +551,8 @@ void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _e
|
||||
|
||||
void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests)
|
||||
{
|
||||
Options::get(); // parse command line options, e.g. to enable JIT
|
||||
|
||||
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
|
||||
{
|
||||
string arg = boost::unit_test::framework::master_test_suite().argv[i];
|
||||
@@ -564,7 +603,7 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue
|
||||
}
|
||||
}
|
||||
|
||||
void executeTests(const string& _name, const string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests)
|
||||
void executeTests(const string& _name, const string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function<void(json_spirit::mValue&, bool)> doTests)
|
||||
{
|
||||
string testPath = getTestPath();
|
||||
testPath += _testPathAppendix;
|
||||
@@ -579,9 +618,8 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun
|
||||
cnote << "Populating tests...";
|
||||
json_spirit::mValue v;
|
||||
boost::filesystem::path p(__FILE__);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
string s = asString(dev::contents(dir.string() + "/" + _name + "Filler.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + dir.string() + "/" + _name + "Filler.json is empty.");
|
||||
string s = asString(dev::contents(_pathToFiller.string() + "/" + _name + "Filler.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + _pathToFiller.string() + "/" + _name + "Filler.json is empty.");
|
||||
json_spirit::read_string(s, v);
|
||||
doTests(v, true);
|
||||
writeFile(testPath + "/" + _name + ".json", asBytes(json_spirit::write_string(v, true)));
|
||||
@@ -677,11 +715,10 @@ Options::Options()
|
||||
vmtrace = true;
|
||||
else if (arg == "--filltests")
|
||||
fillTests = true;
|
||||
else if (arg.compare(0, 7, "--stats") == 0)
|
||||
else if (arg == "--stats" && i + 1 < argc)
|
||||
{
|
||||
stats = true;
|
||||
if (arg.size() > 7)
|
||||
statsOutFile = arg.substr(8); // skip '=' char
|
||||
statsOutFile = argv[i + 1];
|
||||
}
|
||||
else if (arg == "--performance")
|
||||
performance = true;
|
||||
@@ -703,6 +740,11 @@ Options::Options()
|
||||
inputLimits = true;
|
||||
bigData = true;
|
||||
}
|
||||
else if (arg == "--singletest" && i + 1 < argc)
|
||||
{
|
||||
singleTest = true;
|
||||
singleTestName = argv[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -24,6 +24,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include <libethereum/State.h>
|
||||
@@ -121,6 +122,7 @@ public:
|
||||
static void importState(json_spirit::mObject& _o, eth::State& _state);
|
||||
static void importState(json_spirit::mObject& _o, eth::State& _state, stateOptionsMap& _stateOptionsMap);
|
||||
void importTransaction(json_spirit::mObject& _o);
|
||||
static json_spirit::mObject& makeAllFieldsHex(json_spirit::mObject& _o);
|
||||
|
||||
void exportTest(bytes const& _output, eth::State const& _statePost);
|
||||
static void checkExpectedState(eth::State const& _stateExpect, eth::State const& _statePost, stateOptionsMap const _expectedStateOptions = stateOptionsMap(), WhenError _throw = WhenError::Throw);
|
||||
@@ -154,11 +156,12 @@ void checkStorage(std::map<u256, u256> _expectedStore, std::map<u256, u256> _res
|
||||
void checkLog(eth::LogEntries _resultLogs, eth::LogEntries _expectedLogs);
|
||||
void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates);
|
||||
|
||||
void executeTests(const std::string& _name, const std::string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests);
|
||||
void executeTests(const std::string& _name, const std::string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function<void(json_spirit::mValue&, bool)> doTests);
|
||||
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
|
||||
RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj);
|
||||
eth::LastHashes lastHashes(u256 _currentBlockNumber);
|
||||
json_spirit::mObject fillJsonWithState(eth::State _state);
|
||||
json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn);
|
||||
|
||||
template<typename mapType>
|
||||
void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
|
||||
@@ -185,6 +188,8 @@ public:
|
||||
|
||||
/// Test selection
|
||||
/// @{
|
||||
bool singleTest = false;
|
||||
std::string singleTestName;
|
||||
bool performance = false;
|
||||
bool quadratic = false;
|
||||
bool memory = false;
|
||||
|
||||
-200
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file TrieHash.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#include "TrieHash.h"
|
||||
|
||||
#include <libdevcrypto/TrieCommon.h>
|
||||
#include <libdevcrypto/SHA3.h>
|
||||
#include <libethcore/Common.h>
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
|
||||
/*/
|
||||
#define APPEND_CHILD appendData
|
||||
/*/
|
||||
#define APPEND_CHILD appendRaw
|
||||
/**/
|
||||
|
||||
#define ENABLE_DEBUG_PRINT 0
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
bool g_hashDebug = false;
|
||||
#endif
|
||||
|
||||
void hash256aux(HexMap const& _s, HexMap::const_iterator _begin, HexMap::const_iterator _end, unsigned _preLen, RLPStream& _rlp);
|
||||
|
||||
void hash256rlp(HexMap const& _s, HexMap::const_iterator _begin, HexMap::const_iterator _end, unsigned _preLen, RLPStream& _rlp)
|
||||
{
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
static std::string s_indent;
|
||||
if (_preLen)
|
||||
s_indent += " ";
|
||||
#endif
|
||||
|
||||
if (_begin == _end)
|
||||
_rlp << ""; // NULL
|
||||
else if (std::next(_begin) == _end)
|
||||
{
|
||||
// only one left - terminate with the pair.
|
||||
_rlp.appendList(2) << hexPrefixEncode(_begin->first, true, _preLen) << _begin->second;
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (g_hashDebug)
|
||||
std::cerr << s_indent << toHex(bytesConstRef(_begin->first.data() + _preLen, _begin->first.size() - _preLen), 1) << ": " << _begin->second << " = " << sha3(_rlp.out()) << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// find the number of common prefix nibbles shared
|
||||
// i.e. the minimum number of nibbles shared at the beginning between the first hex string and each successive.
|
||||
unsigned sharedPre = (unsigned)-1;
|
||||
unsigned c = 0;
|
||||
for (auto i = std::next(_begin); i != _end && sharedPre; ++i, ++c)
|
||||
{
|
||||
unsigned x = std::min(sharedPre, std::min((unsigned)_begin->first.size(), (unsigned)i->first.size()));
|
||||
unsigned shared = _preLen;
|
||||
for (; shared < x && _begin->first[shared] == i->first[shared]; ++shared) {}
|
||||
sharedPre = std::min(shared, sharedPre);
|
||||
}
|
||||
if (sharedPre > _preLen)
|
||||
{
|
||||
// if they all have the same next nibble, we also want a pair.
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (g_hashDebug)
|
||||
std::cerr << s_indent << toHex(bytesConstRef(_begin->first.data() + _preLen, sharedPre), 1) << ": " << std::endl;
|
||||
#endif
|
||||
_rlp.appendList(2) << hexPrefixEncode(_begin->first, false, _preLen, (int)sharedPre);
|
||||
hash256aux(_s, _begin, _end, (unsigned)sharedPre, _rlp);
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (g_hashDebug)
|
||||
std::cerr << s_indent << "= " << hex << sha3(_rlp.out()) << dec << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise enumerate all 16+1 entries.
|
||||
_rlp.appendList(17);
|
||||
auto b = _begin;
|
||||
if (_preLen == b->first.size())
|
||||
{
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (g_hashDebug)
|
||||
std::cerr << s_indent << "@: " << b->second << std::endl;
|
||||
#endif
|
||||
++b;
|
||||
}
|
||||
for (auto i = 0; i < 16; ++i)
|
||||
{
|
||||
auto n = b;
|
||||
for (; n != _end && n->first[_preLen] == i; ++n) {}
|
||||
if (b == n)
|
||||
_rlp << "";
|
||||
else
|
||||
{
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (g_hashDebug)
|
||||
std::cerr << s_indent << std::hex << i << ": " << std::dec << std::endl;
|
||||
#endif
|
||||
hash256aux(_s, b, n, _preLen + 1, _rlp);
|
||||
}
|
||||
b = n;
|
||||
}
|
||||
if (_preLen == _begin->first.size())
|
||||
_rlp << _begin->second;
|
||||
else
|
||||
_rlp << "";
|
||||
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (g_hashDebug)
|
||||
std::cerr << s_indent << "= " << hex << sha3(_rlp.out()) << dec << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
if (_preLen)
|
||||
s_indent.resize(s_indent.size() - 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hash256aux(HexMap const& _s, HexMap::const_iterator _begin, HexMap::const_iterator _end, unsigned _preLen, RLPStream& _rlp)
|
||||
{
|
||||
RLPStream rlp;
|
||||
hash256rlp(_s, _begin, _end, _preLen, rlp);
|
||||
if (rlp.out().size() < 32)
|
||||
{
|
||||
// RECURSIVE RLP
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
cerr << "[INLINE: " << dec << rlp.out().size() << " < 32]" << endl;
|
||||
#endif
|
||||
_rlp.APPEND_CHILD(rlp.out());
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ENABLE_DEBUG_PRINT
|
||||
cerr << "[HASH: " << dec << rlp.out().size() << " >= 32]" << endl;
|
||||
#endif
|
||||
_rlp << sha3(rlp.out());
|
||||
}
|
||||
}
|
||||
|
||||
h256 hash256(StringMap const& _s)
|
||||
{
|
||||
// build patricia tree.
|
||||
if (_s.empty())
|
||||
return sha3(rlp(""));
|
||||
HexMap hexMap;
|
||||
for (auto i = _s.rbegin(); i != _s.rend(); ++i)
|
||||
hexMap[asNibbles(i->first)] = i->second;
|
||||
RLPStream s;
|
||||
hash256rlp(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
|
||||
return sha3(s.out());
|
||||
}
|
||||
|
||||
bytes rlp256(StringMap const& _s)
|
||||
{
|
||||
// build patricia tree.
|
||||
if (_s.empty())
|
||||
return rlp("");
|
||||
HexMap hexMap;
|
||||
for (auto i = _s.rbegin(); i != _s.rend(); ++i)
|
||||
hexMap[asNibbles(i->first)] = i->second;
|
||||
RLPStream s;
|
||||
hash256aux(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
|
||||
return s.out();
|
||||
}
|
||||
|
||||
h256 hash256(u256Map const& _s)
|
||||
{
|
||||
// build patricia tree.
|
||||
if (_s.empty())
|
||||
return sha3(rlp(""));
|
||||
HexMap hexMap;
|
||||
for (auto i = _s.rbegin(); i != _s.rend(); ++i)
|
||||
hexMap[asNibbles(toBigEndianString(i->first))] = asString(rlp(i->second));
|
||||
RLPStream s;
|
||||
hash256rlp(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
|
||||
return sha3(s.out());
|
||||
}
|
||||
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file TrieHash.h
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/FixedHash.h>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
|
||||
bytes rlp256(StringMap const& _s);
|
||||
h256 hash256(StringMap const& _s);
|
||||
h256 hash256(u256Map const& _s);
|
||||
|
||||
}
|
||||
@@ -1,887 +0,0 @@
|
||||
{
|
||||
"log1_wrongBlockNumber" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"number" : "2"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"log1_wrongBloom" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongCoinbase" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"coinbase" : "0x9888f1f195afa192cfee860698584c030f4c9db1"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongDifficulty" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"difficulty" : "10000"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"DifferentExtraData1025" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"extraData" : "0x0101020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongGasLimit" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"gasLimit" : "100000"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
"wrongGasUsed" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"gasUsed" : "0"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongNumber" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"number" : "0"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongParentHash" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongParentHash2" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"parentHash" : "0x6151889c8f14ab46e32ee0b1894bc276416385d068a1ade000d0dadef9b08b18"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongReceiptTrie" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongStateRoot" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongTimestamp" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"timestamp" : "0x54c98c80"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongTransactionsTrie" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"transactionsTrie" : "0x55e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"wrongUncleHash" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"uncleHash" : "0x0dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
{
|
||||
"JS_API_Tests" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "70"
|
||||
},
|
||||
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : {
|
||||
"storage" : {
|
||||
"0x" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"0x01" : "0x42",
|
||||
"0x02" : "0x23",
|
||||
"0x03" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"0x04" : "0x01",
|
||||
"0x05" : "0x55114a49"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : {
|
||||
"balance" : "100000",
|
||||
"code" : "0x60003560e060020a9004806343d726d61461004257806391b7f5ed14610050578063d686f9ee14610061578063f5bade661461006f578063fcfff16f1461008057005b61004a6101de565b60006000f35b61005b6004356100bf565b60006000f35b610069610304565b60006000f35b61007a60043561008e565b60006000f35b6100886100f0565b60006000f35b600054600160a060020a031633600160a060020a031614156100af576100b4565b6100bc565b806001819055505b50565b600054600160a060020a031633600160a060020a031614156100e0576100e5565b6100ed565b806002819055505b50565b600054600160a060020a031633600160a060020a031614806101255750600354600160a060020a031633600160a060020a0316145b61012e57610161565b60016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a16101dc565b60045460011480610173575060015434105b6101b85760016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a142600581905550336003819055506101db565b33600160a060020a03166000346000600060006000848787f16101d757005b5050505b5b565b60006004546000146101ef576101f4565b610301565b600054600160a060020a031633600160a060020a031614801561022c5750600054600160a060020a0316600354600160a060020a0316145b61023557610242565b6000600481905550610301565b600354600160a060020a031633600160a060020a03161461026257610300565b600554420360025402905060015481116102c757600354600160a060020a0316600082600154036000600060006000848787f161029b57005b505050600054600160a060020a03166000826000600060006000848787f16102bf57005b5050506102ee565b600054600160a060020a031660006001546000600060006000848787f16102ea57005b5050505b60006004819055506000546003819055505b5b50565b6000600054600160a060020a031633600160a060020a031614156103275761032c565b61037e565b600554420360025402905060015481116103455761037d565b600054600160a060020a031660006001546000600060006000848787f161036857005b50505060006004819055506000546003819055505b5b5056",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"0x01" : "0x42",
|
||||
"0x02" : "0x23",
|
||||
"0x03" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"0x05" : "0x54c98c81"
|
||||
}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "0x60406103ca600439600451602451336000819055506000600481905550816001819055508060028190555042600581905550336003819055505050610381806100496000396000f30060003560e060020a9004806343d726d61461004257806391b7f5ed14610050578063d686f9ee14610061578063f5bade661461006f578063fcfff16f1461008057005b61004a6101de565b60006000f35b61005b6004356100bf565b60006000f35b610069610304565b60006000f35b61007a60043561008e565b60006000f35b6100886100f0565b60006000f35b600054600160a060020a031633600160a060020a031614156100af576100b4565b6100bc565b806001819055505b50565b600054600160a060020a031633600160a060020a031614156100e0576100e5565b6100ed565b806002819055505b50565b600054600160a060020a031633600160a060020a031614806101255750600354600160a060020a031633600160a060020a0316145b61012e57610161565b60016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a16101dc565b60045460011480610173575060015434105b6101b85760016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a142600581905550336003819055506101db565b33600160a060020a03166000346000600060006000848787f16101d757005b5050505b5b565b60006004546000146101ef576101f4565b610301565b600054600160a060020a031633600160a060020a031614801561022c5750600054600160a060020a0316600354600160a060020a0316145b61023557610242565b6000600481905550610301565b600354600160a060020a031633600160a060020a03161461026257610300565b600554420360025402905060015481116102c757600354600160a060020a0316600082600154036000600060006000848787f161029b57005b505050600054600160a060020a03166000826000600060006000848787f16102bf57005b5050506102ee565b600054600160a060020a031660006001546000600060006000848787f16102ea57005b5050505b60006004819055506000546003819055505b5b50565b6000600054600160a060020a031633600160a060020a031614156103275761032c565b61037e565b600554420360025402905060015481116103455761037d565b600054600160a060020a031660006001546000600060006000848787f161036857005b50505060006004819055506000546003819055505b5b505600000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000023",
|
||||
"gasLimit" : "600000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "100000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "1",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "0xfcfff16f",
|
||||
"gasLimit" : "600000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "2",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f",
|
||||
"value" : "0x42"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
{
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04",
|
||||
"mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770",
|
||||
"nonce" : "18a524c1790fa83b",
|
||||
"number" : "2",
|
||||
"parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae",
|
||||
"receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd",
|
||||
"timestamp" : "0x54c98c82",
|
||||
"transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
{
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "bcde5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04",
|
||||
"mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770",
|
||||
"nonce" : "18a524c1790fa83b",
|
||||
"number" : "2",
|
||||
"parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae",
|
||||
"receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd",
|
||||
"timestamp" : "0x54c98c82",
|
||||
"transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "4",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "5",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
{
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "bcde5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x",
|
||||
"gasLimit" : "314159",
|
||||
"gasUsed" : "0",
|
||||
"hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04",
|
||||
"mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770",
|
||||
"nonce" : "18a524c1790fa83b",
|
||||
"number" : "2",
|
||||
"parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae",
|
||||
"receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd",
|
||||
"timestamp" : "0x54c98c82",
|
||||
"transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "6",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "7",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "314159",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "8",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,493 +0,0 @@
|
||||
{
|
||||
"diff1024" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "10"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "85000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
"gasPrice0" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "10"
|
||||
},
|
||||
"8888f1f195afa192cfee860698584c030f4c9db1" : {
|
||||
"balance" : "1500000000000000000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "85000",
|
||||
"gasPrice" : "0",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"gasLimitTooHigh" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "100001",
|
||||
"gasPrice" : "0",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "100"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"SimpleTx" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "10"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"txOrder" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "8000000000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "7000000000"
|
||||
},
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "8000000000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"txEqualValue" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "5000000000"
|
||||
},
|
||||
"8888f1f195afa192cfee860698584c030f4c9db1" : {
|
||||
"balance" : "1500000000000210000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000000000"
|
||||
},
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "9",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000000000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"log1_correct" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "5000000100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000000000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"dataTx" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "100",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0xefb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"8888f1f195afa192cfee860698584c030f4c9db1" : {
|
||||
"balance" : "1500000000002500000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "50",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : ""
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"DifferentExtraData1024" : {
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
"difficulty" : "131072",
|
||||
"extraData" : "0x42",
|
||||
"gasLimit" : "3141592",
|
||||
"gasUsed" : "0",
|
||||
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"nonce" : "0x0102030405060708",
|
||||
"number" : "0",
|
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||
"timestamp" : "0x54c98c81",
|
||||
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "5000000100"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"blocks" : [
|
||||
{
|
||||
"blockHeader" : {
|
||||
"extraData" : "0x01020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000"
|
||||
},
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "50000",
|
||||
"gasPrice" : "10",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "5000000000"
|
||||
}
|
||||
],
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-691
@@ -1,691 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file block.cpp
|
||||
* @author Christoph Jentzsch <cj@ethdev.com>
|
||||
* @date 2015
|
||||
* block test functions.
|
||||
*/
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <libdevcrypto/FileSystem.h>
|
||||
#include <libdevcore/TransientDirectory.h>
|
||||
#include <libethereum/CanonBlockChain.h>
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace dev { namespace test {
|
||||
|
||||
bytes createBlockRLPFromFields(mObject& _tObj);
|
||||
void overwriteBlockHeader(BlockInfo& _current_BlockHeader, mObject& _blObj);
|
||||
BlockInfo constructBlock(mObject& _o);
|
||||
void updatePoW(BlockInfo& _bi);
|
||||
void writeBlockHeaderToJson(mObject& _o, BlockInfo const& _bi);
|
||||
RLPStream createFullBlockFromHeader(BlockInfo const& _bi, bytes const& _txs = RLPEmptyList, bytes const& _uncles = RLPEmptyList);
|
||||
|
||||
void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
|
||||
{
|
||||
for (auto& i: _v.get_obj())
|
||||
{
|
||||
cerr << i.first << endl;
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
BOOST_REQUIRE(o.count("genesisBlockHeader"));
|
||||
BlockInfo biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj());
|
||||
|
||||
BOOST_REQUIRE(o.count("pre"));
|
||||
ImportTest importer(o["pre"].get_obj());
|
||||
State state(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress);
|
||||
State stateTemp(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress);
|
||||
importer.importState(o["pre"].get_obj(), state);
|
||||
o["pre"] = fillJsonWithState(state);
|
||||
state.commit();
|
||||
|
||||
if (_fillin)
|
||||
biGenesisBlock.stateRoot = state.rootHash();
|
||||
else
|
||||
BOOST_CHECK_MESSAGE(biGenesisBlock.stateRoot == state.rootHash(), "root hash does not match");
|
||||
|
||||
if (_fillin)
|
||||
{
|
||||
// find new valid nonce
|
||||
updatePoW(biGenesisBlock);
|
||||
|
||||
//update genesis block in json file
|
||||
writeBlockHeaderToJson(o["genesisBlockHeader"].get_obj(), biGenesisBlock);
|
||||
}
|
||||
|
||||
// create new "genesis" block
|
||||
RLPStream rlpGenesisBlock = createFullBlockFromHeader(biGenesisBlock);
|
||||
biGenesisBlock.verifyInternals(&rlpGenesisBlock.out());
|
||||
o["genesisRLP"] = "0x" + toHex(rlpGenesisBlock.out());
|
||||
|
||||
// construct blockchain
|
||||
TransientDirectory td;
|
||||
BlockChain bc(rlpGenesisBlock.out(), td.path(), WithExisting::Kill);
|
||||
|
||||
if (_fillin)
|
||||
{
|
||||
BOOST_REQUIRE(o.count("blocks"));
|
||||
mArray blArray;
|
||||
vector<BlockInfo> vBiBlocks;
|
||||
vBiBlocks.push_back(biGenesisBlock);
|
||||
for (auto const& bl: o["blocks"].get_array())
|
||||
{
|
||||
mObject blObj = bl.get_obj();
|
||||
stateTemp = state;
|
||||
// get txs
|
||||
TransactionQueue txs;
|
||||
ZeroGasPricer gp;
|
||||
BOOST_REQUIRE(blObj.count("transactions"));
|
||||
for (auto const& txObj: blObj["transactions"].get_array())
|
||||
{
|
||||
mObject tx = txObj.get_obj();
|
||||
importer.importTransaction(tx);
|
||||
if (txs.import(importer.m_transaction.rlp()) != ImportResult::Success)
|
||||
cnote << "failed importing transaction\n";
|
||||
}
|
||||
|
||||
// write uncle list
|
||||
BlockQueue uncleBlockQueue;
|
||||
mArray aUncleList;
|
||||
vector<BlockInfo> vBiUncles;
|
||||
mObject uncleHeaderObj_pre;
|
||||
|
||||
for (auto const& uHObj: blObj["uncleHeaders"].get_array())
|
||||
{
|
||||
mObject uncleHeaderObj = uHObj.get_obj();
|
||||
if (uncleHeaderObj.count("sameAsPreviousSibling"))
|
||||
{
|
||||
writeBlockHeaderToJson(uncleHeaderObj_pre, vBiUncles[vBiUncles.size()-1]);
|
||||
aUncleList.push_back(uncleHeaderObj_pre);
|
||||
vBiUncles.push_back(vBiUncles[vBiUncles.size()-1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (uncleHeaderObj.count("sameAsBlock"))
|
||||
{
|
||||
writeBlockHeaderToJson(uncleHeaderObj_pre, vBiBlocks[(size_t)toInt(uncleHeaderObj["sameAsBlock"])]);
|
||||
aUncleList.push_back(uncleHeaderObj_pre);
|
||||
vBiUncles.push_back(vBiBlocks[(size_t)toInt(uncleHeaderObj["sameAsBlock"])]);
|
||||
continue;
|
||||
}
|
||||
string overwrite = "false";
|
||||
if (uncleHeaderObj.count("overwriteAndRedoPoW"))
|
||||
{
|
||||
overwrite = uncleHeaderObj["overwriteAndRedoPoW"].get_str();
|
||||
uncleHeaderObj.erase("overwriteAndRedoPoW");
|
||||
}
|
||||
|
||||
BlockInfo uncleBlockFromFields = constructBlock(uncleHeaderObj);
|
||||
|
||||
// make uncle header valid
|
||||
uncleBlockFromFields.timestamp = (u256)time(0);
|
||||
if (vBiBlocks.size() > 2)
|
||||
{
|
||||
if (uncleBlockFromFields.number - 1 < vBiBlocks.size())
|
||||
uncleBlockFromFields.populateFromParent(vBiBlocks[(size_t)uncleBlockFromFields.number - 1]);
|
||||
else
|
||||
uncleBlockFromFields.populateFromParent(vBiBlocks[vBiBlocks.size() - 2]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
if (overwrite != "false")
|
||||
{
|
||||
uncleBlockFromFields.difficulty = overwrite == "difficulty" ? toInt(uncleHeaderObj["difficulty"]) : uncleBlockFromFields.difficulty;
|
||||
uncleBlockFromFields.gasLimit = overwrite == "gasLimit" ? toInt(uncleHeaderObj["gasLimit"]) : uncleBlockFromFields.gasLimit;
|
||||
uncleBlockFromFields.gasUsed = overwrite == "gasUsed" ? toInt(uncleHeaderObj["gasUsed"]) : uncleBlockFromFields.gasUsed;
|
||||
uncleBlockFromFields.parentHash = overwrite == "parentHash" ? h256(uncleHeaderObj["parentHash"].get_str()) : uncleBlockFromFields.parentHash;
|
||||
uncleBlockFromFields.stateRoot = overwrite == "stateRoot" ? h256(uncleHeaderObj["stateRoot"].get_str()) : uncleBlockFromFields.stateRoot;
|
||||
if (overwrite == "timestamp")
|
||||
{
|
||||
uncleBlockFromFields.timestamp = toInt(uncleHeaderObj["timestamp"]);
|
||||
uncleBlockFromFields.difficulty = uncleBlockFromFields.calculateDifficulty(vBiBlocks[(size_t)uncleBlockFromFields.number - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
updatePoW(uncleBlockFromFields);
|
||||
writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields);
|
||||
|
||||
aUncleList.push_back(uncleHeaderObj);
|
||||
vBiUncles.push_back(uncleBlockFromFields);
|
||||
|
||||
cnote << "import uncle in blockQueue";
|
||||
|
||||
RLPStream uncle = createFullBlockFromHeader(uncleBlockFromFields);
|
||||
try
|
||||
{
|
||||
uncleBlockQueue.import(&uncle.out(), bc);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
cnote << "error in importing uncle! This produces an invalid block (May be by purpose for testing).";
|
||||
}
|
||||
|
||||
uncleHeaderObj_pre = uncleHeaderObj;
|
||||
} //for blObj["uncleHeaders"].get_array()
|
||||
|
||||
blObj["uncleHeaders"] = aUncleList;
|
||||
bc.sync(uncleBlockQueue, state.db(), 4);
|
||||
state.commitToMine(bc);
|
||||
|
||||
try
|
||||
{
|
||||
state.sync(bc);
|
||||
state.sync(bc, txs, gp);
|
||||
mine(state, bc);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "state sync or mining did throw an exception: " << diagnostic_information(_e);
|
||||
return;
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "state sync or mining did throw an exception: " << _e.what();
|
||||
return;
|
||||
}
|
||||
|
||||
blObj["rlp"] = "0x" + toHex(state.blockData());
|
||||
|
||||
// write valid txs
|
||||
mArray txArray;
|
||||
Transactions txList;
|
||||
for (auto const& txi: txs.transactions())
|
||||
{
|
||||
txList.push_back(txi.second);
|
||||
mObject txObject;
|
||||
txObject["nonce"] = toString(txi.second.nonce());
|
||||
txObject["data"] = "0x" + toHex(txi.second.data());
|
||||
txObject["gasLimit"] = toString(txi.second.gas());
|
||||
txObject["gasPrice"] = toString(txi.second.gasPrice());
|
||||
txObject["r"] = "0x" + toString(txi.second.signature().r);
|
||||
txObject["s"] = "0x" + toString(txi.second.signature().s);
|
||||
txObject["v"] = to_string(txi.second.signature().v + 27);
|
||||
txObject["to"] = txi.second.isCreation() ? "" : toString(txi.second.receiveAddress());
|
||||
txObject["value"] = toString(txi.second.value());
|
||||
|
||||
txArray.push_back(txObject);
|
||||
}
|
||||
|
||||
blObj["transactions"] = txArray;
|
||||
|
||||
BlockInfo current_BlockHeader = state.info();
|
||||
|
||||
if (blObj.count("blockHeader"))
|
||||
overwriteBlockHeader(current_BlockHeader, blObj);
|
||||
|
||||
// write block header
|
||||
mObject oBlockHeader;
|
||||
writeBlockHeaderToJson(oBlockHeader, current_BlockHeader);
|
||||
blObj["blockHeader"] = oBlockHeader;
|
||||
vBiBlocks.push_back(current_BlockHeader);
|
||||
|
||||
// compare blocks from state and from rlp
|
||||
RLPStream txStream;
|
||||
txStream.appendList(txList.size());
|
||||
for (unsigned i = 0; i < txList.size(); ++i)
|
||||
{
|
||||
RLPStream txrlp;
|
||||
txList[i].streamRLP(txrlp);
|
||||
txStream.appendRaw(txrlp.out());
|
||||
}
|
||||
|
||||
RLPStream uncleStream;
|
||||
uncleStream.appendList(vBiUncles.size());
|
||||
for (unsigned i = 0; i < vBiUncles.size(); ++i)
|
||||
{
|
||||
RLPStream uncleRlp;
|
||||
vBiUncles[i].streamRLP(uncleRlp, WithNonce);
|
||||
uncleStream.appendRaw(uncleRlp.out());
|
||||
}
|
||||
|
||||
RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out());
|
||||
|
||||
blObj["rlp"] = "0x" + toHex(block2.out());
|
||||
|
||||
if (sha3(RLP(state.blockData())[0].data()) != sha3(RLP(block2.out())[0].data()))
|
||||
cnote << "block header mismatch\n";
|
||||
|
||||
if (sha3(RLP(state.blockData())[1].data()) != sha3(RLP(block2.out())[1].data()))
|
||||
cnote << "txs mismatch\n";
|
||||
|
||||
if (sha3(RLP(state.blockData())[2].data()) != sha3(RLP(block2.out())[2].data()))
|
||||
cnote << "uncle list mismatch\n" << RLP(state.blockData())[2].data() << "\n" << RLP(block2.out())[2].data();
|
||||
|
||||
try
|
||||
{
|
||||
state.sync(bc);
|
||||
bc.import(block2.out(), state.db());
|
||||
state.sync(bc);
|
||||
state.commit();
|
||||
}
|
||||
// if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given
|
||||
catch (...)
|
||||
{
|
||||
cnote << "block is invalid!\n";
|
||||
blObj.erase(blObj.find("blockHeader"));
|
||||
blObj.erase(blObj.find("uncleHeaders"));
|
||||
blObj.erase(blObj.find("transactions"));
|
||||
state = stateTemp; //revert state as if it was before executing this block
|
||||
}
|
||||
blArray.push_back(blObj);
|
||||
} //for blocks
|
||||
|
||||
if (o.count("expect") > 0)
|
||||
{
|
||||
stateOptionsMap expectStateMap;
|
||||
State stateExpect(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress);
|
||||
importer.importState(o["expect"].get_obj(), stateExpect, expectStateMap);
|
||||
ImportTest::checkExpectedState(stateExpect, state, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow);
|
||||
o.erase(o.find("expect"));
|
||||
}
|
||||
|
||||
o["blocks"] = blArray;
|
||||
o["postState"] = fillJsonWithState(state);
|
||||
}//_fillin
|
||||
|
||||
else
|
||||
{
|
||||
for (auto const& bl: o["blocks"].get_array())
|
||||
{
|
||||
mObject blObj = bl.get_obj();
|
||||
bytes blockRLP;
|
||||
try
|
||||
{
|
||||
state.sync(bc);
|
||||
blockRLP = importByteArray(blObj["rlp"].get_str());
|
||||
bc.import(blockRLP, state.db());
|
||||
state.sync(bc);
|
||||
}
|
||||
// if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "state sync or block import did throw an exception: " << diagnostic_information(_e);
|
||||
BOOST_CHECK(blObj.count("blockHeader") == 0);
|
||||
BOOST_CHECK(blObj.count("transactions") == 0);
|
||||
BOOST_CHECK(blObj.count("uncleHeaders") == 0);
|
||||
continue;
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "state sync or block import did throw an exception: " << _e.what();
|
||||
BOOST_CHECK(blObj.count("blockHeader") == 0);
|
||||
BOOST_CHECK(blObj.count("transactions") == 0);
|
||||
BOOST_CHECK(blObj.count("uncleHeaders") == 0);
|
||||
continue;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cnote << "state sync or block import did throw an exception\n";
|
||||
BOOST_CHECK(blObj.count("blockHeader") == 0);
|
||||
BOOST_CHECK(blObj.count("transactions") == 0);
|
||||
BOOST_CHECK(blObj.count("uncleHeaders") == 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
BOOST_REQUIRE(blObj.count("blockHeader"));
|
||||
|
||||
mObject tObj = blObj["blockHeader"].get_obj();
|
||||
BlockInfo blockHeaderFromFields;
|
||||
const bytes c_rlpBytesBlockHeader = createBlockRLPFromFields(tObj);
|
||||
const RLP c_blockHeaderRLP(c_rlpBytesBlockHeader);
|
||||
blockHeaderFromFields.populateFromHeader(c_blockHeaderRLP, IgnoreNonce);
|
||||
|
||||
BlockInfo blockFromRlp = bc.info();
|
||||
|
||||
//Check the fields restored from RLP to original fields
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce), "hash in given RLP not matching the block hash!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.parentHash == blockFromRlp.parentHash, "parentHash in given RLP not matching the block parentHash!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles, "sha3Uncles in given RLP not matching the block sha3Uncles!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress,"coinbaseAddress in given RLP not matching the block coinbaseAddress!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot, "stateRoot in given RLP not matching the block stateRoot!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot, "transactionsRoot in given RLP not matching the block transactionsRoot!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot, "receiptsRoot in given RLP not matching the block receiptsRoot!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.logBloom == blockFromRlp.logBloom, "logBloom in given RLP not matching the block logBloom!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.difficulty == blockFromRlp.difficulty, "difficulty in given RLP not matching the block difficulty!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.number == blockFromRlp.number, "number in given RLP not matching the block number!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit,"gasLimit in given RLP not matching the block gasLimit!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixHash == blockFromRlp.mixHash, "mixHash in given RLP not matching the block mixHash!");
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!");
|
||||
|
||||
BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!");
|
||||
|
||||
//Check transaction list
|
||||
|
||||
Transactions txsFromField;
|
||||
|
||||
for (auto const& txObj: blObj["transactions"].get_array())
|
||||
{
|
||||
mObject tx = txObj.get_obj();
|
||||
|
||||
BOOST_REQUIRE(tx.count("nonce"));
|
||||
BOOST_REQUIRE(tx.count("gasPrice"));
|
||||
BOOST_REQUIRE(tx.count("gasLimit"));
|
||||
BOOST_REQUIRE(tx.count("to"));
|
||||
BOOST_REQUIRE(tx.count("value"));
|
||||
BOOST_REQUIRE(tx.count("v"));
|
||||
BOOST_REQUIRE(tx.count("r"));
|
||||
BOOST_REQUIRE(tx.count("s"));
|
||||
BOOST_REQUIRE(tx.count("data"));
|
||||
|
||||
try
|
||||
{
|
||||
Transaction t(createRLPStreamFromTransactionFields(tx).out(), CheckTransaction::Everything);
|
||||
txsFromField.push_back(t);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e));
|
||||
}
|
||||
catch (exception const& _e)
|
||||
{
|
||||
cnote << _e.what();
|
||||
}
|
||||
}
|
||||
|
||||
Transactions txsFromRlp;
|
||||
RLP root(blockRLP);
|
||||
for (auto const& tr: root[1])
|
||||
{
|
||||
Transaction tx(tr.data(), CheckTransaction::Everything);
|
||||
txsFromRlp.push_back(tx);
|
||||
}
|
||||
|
||||
BOOST_CHECK_MESSAGE(txsFromRlp.size() == txsFromField.size(), "transaction list size does not match");
|
||||
|
||||
for (size_t i = 0; i < txsFromField.size(); ++i)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].data() == txsFromRlp[i].data(), "transaction data in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].gas() == txsFromRlp[i].gas(), "transaction gasLimit in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice(), "transaction gasPrice in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].nonce() == txsFromRlp[i].nonce(), "transaction nonce in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].signature().r == txsFromRlp[i].signature().r, "transaction r in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].signature().s == txsFromRlp[i].signature().s, "transaction s in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].signature().v == txsFromRlp[i].signature().v, "transaction v in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress(), "transaction receiveAddress in rlp and in field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].value() == txsFromRlp[i].value(), "transaction receiveAddress in rlp and in field do not match");
|
||||
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i] == txsFromRlp[i], "transactions from rlp and transaction from field do not match");
|
||||
BOOST_CHECK_MESSAGE(txsFromField[i].rlp() == txsFromRlp[i].rlp(), "transactions rlp do not match");
|
||||
}
|
||||
|
||||
// check uncle list
|
||||
|
||||
// uncles from uncle list field
|
||||
vector<BlockInfo> uBlHsFromField;
|
||||
if (blObj["uncleHeaders"].type() != json_spirit::null_type)
|
||||
for (auto const& uBlHeaderObj: blObj["uncleHeaders"].get_array())
|
||||
{
|
||||
mObject uBlH = uBlHeaderObj.get_obj();
|
||||
BOOST_REQUIRE(uBlH.size() == 16);
|
||||
bytes uncleRLP = createBlockRLPFromFields(uBlH);
|
||||
const RLP c_uRLP(uncleRLP);
|
||||
BlockInfo uncleBlockHeader;
|
||||
try
|
||||
{
|
||||
uncleBlockHeader.populateFromHeader(c_uRLP);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BOOST_ERROR("invalid uncle header");
|
||||
}
|
||||
uBlHsFromField.push_back(uncleBlockHeader);
|
||||
}
|
||||
|
||||
// uncles from block RLP
|
||||
vector<BlockInfo> uBlHsFromRlp;
|
||||
for (auto const& uRLP: root[2])
|
||||
{
|
||||
BlockInfo uBl;
|
||||
uBl.populateFromHeader(uRLP);
|
||||
uBlHsFromRlp.push_back(uBl);
|
||||
}
|
||||
|
||||
BOOST_REQUIRE_EQUAL(uBlHsFromField.size(), uBlHsFromRlp.size());
|
||||
|
||||
for (size_t i = 0; i < uBlHsFromField.size(); ++i)
|
||||
BOOST_CHECK_MESSAGE(uBlHsFromField[i] == uBlHsFromRlp[i], "block header in rlp and in field do not match");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// helping functions
|
||||
|
||||
bytes createBlockRLPFromFields(mObject& _tObj)
|
||||
{
|
||||
RLPStream rlpStream;
|
||||
rlpStream.appendList(_tObj.count("hash") > 0 ? (_tObj.size() - 1) : _tObj.size());
|
||||
|
||||
if (_tObj.count("parentHash"))
|
||||
rlpStream << importByteArray(_tObj["parentHash"].get_str());
|
||||
|
||||
if (_tObj.count("uncleHash"))
|
||||
rlpStream << importByteArray(_tObj["uncleHash"].get_str());
|
||||
|
||||
if (_tObj.count("coinbase"))
|
||||
rlpStream << importByteArray(_tObj["coinbase"].get_str());
|
||||
|
||||
if (_tObj.count("stateRoot"))
|
||||
rlpStream << importByteArray(_tObj["stateRoot"].get_str());
|
||||
|
||||
if (_tObj.count("transactionsTrie"))
|
||||
rlpStream << importByteArray(_tObj["transactionsTrie"].get_str());
|
||||
|
||||
if (_tObj.count("receiptTrie"))
|
||||
rlpStream << importByteArray(_tObj["receiptTrie"].get_str());
|
||||
|
||||
if (_tObj.count("bloom"))
|
||||
rlpStream << importByteArray(_tObj["bloom"].get_str());
|
||||
|
||||
if (_tObj.count("difficulty"))
|
||||
rlpStream << bigint(_tObj["difficulty"].get_str());
|
||||
|
||||
if (_tObj.count("number"))
|
||||
rlpStream << bigint(_tObj["number"].get_str());
|
||||
|
||||
if (_tObj.count("gasLimit"))
|
||||
rlpStream << bigint(_tObj["gasLimit"].get_str());
|
||||
|
||||
if (_tObj.count("gasUsed"))
|
||||
rlpStream << bigint(_tObj["gasUsed"].get_str());
|
||||
|
||||
if (_tObj.count("timestamp"))
|
||||
rlpStream << bigint(_tObj["timestamp"].get_str());
|
||||
|
||||
if (_tObj.count("extraData"))
|
||||
rlpStream << fromHex(_tObj["extraData"].get_str());
|
||||
|
||||
if (_tObj.count("mixHash"))
|
||||
rlpStream << importByteArray(_tObj["mixHash"].get_str());
|
||||
|
||||
if (_tObj.count("nonce"))
|
||||
rlpStream << importByteArray(_tObj["nonce"].get_str());
|
||||
|
||||
return rlpStream.out();
|
||||
}
|
||||
|
||||
void overwriteBlockHeader(BlockInfo& _header, mObject& _blObj)
|
||||
{
|
||||
auto ho = _blObj["blockHeader"].get_obj();
|
||||
if (ho.size() != 14)
|
||||
{
|
||||
BlockInfo tmp = _header;
|
||||
if (ho.count("parentHash"))
|
||||
tmp.parentHash = h256(ho["parentHash"].get_str());
|
||||
if (ho.count("uncleHash"))
|
||||
tmp.sha3Uncles = h256(ho["uncleHash"].get_str());
|
||||
if (ho.count("coinbase"))
|
||||
tmp.coinbaseAddress = Address(ho["coinbase"].get_str());
|
||||
if (ho.count("stateRoot"))
|
||||
tmp.stateRoot = h256(ho["stateRoot"].get_str());
|
||||
if (ho.count("transactionsTrie"))
|
||||
tmp.transactionsRoot = h256(ho["transactionsTrie"].get_str());
|
||||
if (ho.count("receiptTrie"))
|
||||
tmp.receiptsRoot = h256(ho["receiptTrie"].get_str());
|
||||
if (ho.count("bloom"))
|
||||
tmp.logBloom = LogBloom(ho["bloom"].get_str());
|
||||
if (ho.count("difficulty"))
|
||||
tmp.difficulty = toInt(ho["difficulty"]);
|
||||
if (ho.count("number"))
|
||||
tmp.number = toInt(ho["number"]);
|
||||
if (ho.count("gasLimit"))
|
||||
tmp.gasLimit = toInt(ho["gasLimit"]);
|
||||
if (ho.count("gasUsed"))
|
||||
tmp.gasUsed = toInt(ho["gasUsed"]);
|
||||
if (ho.count("timestamp"))
|
||||
tmp.timestamp = toInt(ho["timestamp"]);
|
||||
if (ho.count("extraData"))
|
||||
tmp.extraData = importByteArray(ho["extraData"].get_str());
|
||||
if (ho.count("mixHash"))
|
||||
tmp.mixHash = h256(ho["mixHash"].get_str());
|
||||
tmp.noteDirty();
|
||||
|
||||
// find new valid nonce
|
||||
if (tmp != _header)
|
||||
{
|
||||
mine(tmp);
|
||||
_header = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// take the blockheader as is
|
||||
const bytes c_blockRLP = createBlockRLPFromFields(ho);
|
||||
const RLP c_bRLP(c_blockRLP);
|
||||
_header.populateFromHeader(c_bRLP, IgnoreNonce);
|
||||
}
|
||||
}
|
||||
|
||||
BlockInfo constructBlock(mObject& _o)
|
||||
{
|
||||
BlockInfo ret;
|
||||
try
|
||||
{
|
||||
// construct genesis block
|
||||
const bytes c_blockRLP = createBlockRLPFromFields(_o);
|
||||
const RLP c_bRLP(c_blockRLP);
|
||||
ret.populateFromHeader(c_bRLP, IgnoreNonce);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "block population did throw an exception: " << diagnostic_information(_e);
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed block population with Exception: " << _e.what());
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BOOST_ERROR("block population did throw an unknown exception\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void updatePoW(BlockInfo& _bi)
|
||||
{
|
||||
mine(_bi);
|
||||
_bi.noteDirty();
|
||||
}
|
||||
|
||||
void writeBlockHeaderToJson(mObject& _o, BlockInfo const& _bi)
|
||||
{
|
||||
_o["parentHash"] = toString(_bi.parentHash);
|
||||
_o["uncleHash"] = toString(_bi.sha3Uncles);
|
||||
_o["coinbase"] = toString(_bi.coinbaseAddress);
|
||||
_o["stateRoot"] = toString(_bi.stateRoot);
|
||||
_o["transactionsTrie"] = toString(_bi.transactionsRoot);
|
||||
_o["receiptTrie"] = toString(_bi.receiptsRoot);
|
||||
_o["bloom"] = toString(_bi.logBloom);
|
||||
_o["difficulty"] = toString(_bi.difficulty);
|
||||
_o["number"] = toString(_bi.number);
|
||||
_o["gasLimit"] = toString(_bi.gasLimit);
|
||||
_o["gasUsed"] = toString(_bi.gasUsed);
|
||||
_o["timestamp"] = toString(_bi.timestamp);
|
||||
_o["extraData"] ="0x" + toHex(_bi.extraData);
|
||||
_o["mixHash"] = toString(_bi.mixHash);
|
||||
_o["nonce"] = toString(_bi.nonce);
|
||||
_o["hash"] = toString(_bi.hash());
|
||||
}
|
||||
|
||||
RLPStream createFullBlockFromHeader(BlockInfo const& _bi, bytes const& _txs, bytes const& _uncles)
|
||||
{
|
||||
RLPStream rlpStream;
|
||||
_bi.streamRLP(rlpStream, WithNonce);
|
||||
|
||||
RLPStream ret(3);
|
||||
ret.appendRaw(rlpStream.out());
|
||||
ret.appendRaw(_txs);
|
||||
ret.appendRaw(_uncles);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} }// Namespace Close
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(BlockChainTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcForkBlockTest)
|
||||
{
|
||||
dev::test::executeTests("bcForkBlockTest", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcInvalidRLPTest)
|
||||
{
|
||||
dev::test::executeTests("bcInvalidRLPTest", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcJS_API_Test)
|
||||
{
|
||||
dev::test::executeTests("bcJS_API_Test", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcValidBlockTest)
|
||||
{
|
||||
dev::test::executeTests("bcValidBlockTest", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcInvalidHeaderTest)
|
||||
{
|
||||
dev::test::executeTests("bcInvalidHeaderTest", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcUncleTest)
|
||||
{
|
||||
dev::test::executeTests("bcUncleTest", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bcUncleHeaderValiditiy)
|
||||
{
|
||||
dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockTests", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(userDefinedFile)
|
||||
{
|
||||
dev::test::userDefinedTest("--singletest", dev::test::doBlockchainTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file checkRandomStateTest.cpp
|
||||
* @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
|
||||
* @date 2015
|
||||
* Check a random test and return 0/1 for success or failure. To be used for efficiency in the random test simulation.
|
||||
*/
|
||||
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/Assertions.h>
|
||||
#include <libdevcore/Exceptions.h>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
#include "TestHelper.h"
|
||||
#include "vm.h"
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev::test;
|
||||
using namespace dev;
|
||||
|
||||
bool doStateTest(mValue& _v);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_logVerbosity = 0;
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
mValue v;
|
||||
string s;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
s += argv[i];
|
||||
if (asserts(s.length() > 0))
|
||||
{
|
||||
cout << "Content of argument is empty\n";
|
||||
return 1;
|
||||
}
|
||||
read_string(s, v);
|
||||
ret = doStateTest(v);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cout << "Failed test with Exception: " << diagnostic_information(_e) << endl;
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cout << "Failed test with Exception: " << _e.what() << endl;
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool doStateTest(mValue& _v)
|
||||
{
|
||||
eth::VMFactory::setKind(eth::VMKind::JIT);
|
||||
|
||||
for (auto& i: _v.get_obj())
|
||||
{
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
assert(o.count("env") > 0);
|
||||
assert(o.count("pre") > 0);
|
||||
assert(o.count("transaction") > 0);
|
||||
|
||||
ImportTest importer(o, false);
|
||||
|
||||
eth::State theState = importer.m_statePre;
|
||||
bytes output;
|
||||
|
||||
try
|
||||
{
|
||||
output = theState.execute(lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "state execution did throw an exception: " << diagnostic_information(_e);
|
||||
theState.commit();
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "state execution did throw an exception: " << _e.what();
|
||||
}
|
||||
|
||||
assert(o.count("post") > 0);
|
||||
assert(o.count("out") > 0);
|
||||
|
||||
//checkOutput(output, o);
|
||||
int j = 0;
|
||||
if (o["out"].type() == array_type)
|
||||
for (auto const& d: o["out"].get_array())
|
||||
{
|
||||
if (asserts(output[j] == toInt(d)))
|
||||
{
|
||||
cout << "Output byte [" << j << "] different!";
|
||||
return 1;
|
||||
}
|
||||
++j;
|
||||
}
|
||||
else if (o["out"].get_str().find("0x") == 0)
|
||||
{
|
||||
if (asserts(output == fromHex(o["out"].get_str().substr(2))))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (asserts(output == fromHex(o["out"].get_str())))
|
||||
return 1;
|
||||
}
|
||||
|
||||
//checkLog(theState.pending().size() ? theState.log(0) : LogEntries(), importer.m_environment.sub.logs);
|
||||
eth::LogEntries logs = theState.pending().size() ? theState.log(0) : eth::LogEntries();
|
||||
|
||||
if (assertsEqual(logs.size(), importer.m_environment.sub.logs.size()))
|
||||
return 1;
|
||||
|
||||
for (size_t i = 0; i < logs.size(); ++i)
|
||||
{
|
||||
if (assertsEqual(logs[i].address, importer.m_environment.sub.logs[i].address))
|
||||
return 1;
|
||||
if (assertsEqual(logs[i].topics, importer.m_environment.sub.logs[i].topics))
|
||||
return 1;
|
||||
if (asserts(logs[i].data == importer.m_environment.sub.logs[i].data))
|
||||
return 1;
|
||||
}
|
||||
|
||||
// check addresses
|
||||
#if ETH_FATDB
|
||||
auto expectedAddrs = importer.m_statePost.addresses();
|
||||
auto resultAddrs = theState.addresses();
|
||||
for (auto& expectedPair : expectedAddrs)
|
||||
{
|
||||
auto& expectedAddr = expectedPair.first;
|
||||
auto resultAddrIt = resultAddrs.find(expectedAddr);
|
||||
if (resultAddrIt == resultAddrs.end())
|
||||
{
|
||||
cout << "Missing expected address " << expectedAddr;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (importer.m_statePost.balance(expectedAddr) != theState.balance(expectedAddr))
|
||||
{
|
||||
cout << expectedAddr << ": incorrect balance " << theState.balance(expectedAddr) << ", expected " << importer.m_statePost.balance(expectedAddr);
|
||||
return 1;
|
||||
}
|
||||
if (importer.m_statePost.transactionsFrom(expectedAddr) != theState.transactionsFrom(expectedAddr))
|
||||
{
|
||||
cout << expectedAddr << ": incorrect txCount " << theState.transactionsFrom(expectedAddr) << ", expected " << importer.m_statePost.transactionsFrom(expectedAddr);
|
||||
return 1;
|
||||
}
|
||||
if (importer.m_statePost.code(expectedAddr) != theState.code(expectedAddr))
|
||||
{
|
||||
cout << expectedAddr << ": incorrect code";
|
||||
return 1;
|
||||
}
|
||||
|
||||
//checkStorage(importer.m_statePost.storage(expectedAddr), theState.storage(expectedAddr), expectedAddr);
|
||||
map<u256, u256> _resultStore = theState.storage(expectedAddr);
|
||||
|
||||
for (auto&& expectedStorePair : importer.m_statePost.storage(expectedAddr))
|
||||
{
|
||||
auto& expectedStoreKey = expectedStorePair.first;
|
||||
auto resultStoreIt = _resultStore.find(expectedStoreKey);
|
||||
if (resultStoreIt == _resultStore.end())
|
||||
{
|
||||
cout << expectedAddr << ": missing store key " << expectedStoreKey << endl;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& expectedStoreValue = expectedStorePair.second;
|
||||
auto& resultStoreValue = resultStoreIt->second;
|
||||
if (asserts(expectedStoreValue == resultStoreValue))
|
||||
{
|
||||
cout << expectedAddr << ": store[" << expectedStoreKey << "] = " << resultStoreValue << ", expected " << expectedStoreValue << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (assertsEqual(_resultStore.size(), importer.m_statePost.storage(expectedAddr).size()))
|
||||
return 1;
|
||||
for (auto&& resultStorePair: _resultStore)
|
||||
{
|
||||
if (!importer.m_statePost.storage(expectedAddr).count(resultStorePair.first))
|
||||
{
|
||||
cout << expectedAddr << ": unexpected store key " << resultStorePair.first << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//checkAddresses<map<Address, u256> >(expectedAddrs, resultAddrs);
|
||||
for (auto& resultPair : resultAddrs)
|
||||
{
|
||||
auto& resultAddr = resultPair.first;
|
||||
auto expectedAddrIt = expectedAddrs.find(resultAddr);
|
||||
if (expectedAddrIt == expectedAddrs.end())
|
||||
return 1;
|
||||
}
|
||||
if (expectedAddrs != resultAddrs)
|
||||
return 1;
|
||||
#endif
|
||||
if (theState.rootHash() != h256(o["postStateRoot"].get_str()))
|
||||
{
|
||||
cout << "wrong post state root" << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file checkRandomTest.cpp
|
||||
* @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
|
||||
* @date 2015
|
||||
* Check a random test and return 0/1 for success or failure. To be used for efficiency in the random test simulation.
|
||||
*/
|
||||
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/Assertions.h>
|
||||
#include <libdevcore/Exceptions.h>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
#include "vm.h"
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev::test;
|
||||
using namespace dev;
|
||||
|
||||
bool doVMTest(mValue& _v);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_logVerbosity = 0;
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
mValue v;
|
||||
string s;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
s += argv[i];
|
||||
if (asserts(s.length() > 0))
|
||||
{
|
||||
cout << "Content of argument is empty\n";
|
||||
return 1;
|
||||
}
|
||||
read_string(s, v);
|
||||
ret = doVMTest(v);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cout << "Failed test with Exception: " << diagnostic_information(_e) << endl;
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cout << "Failed test with Exception: " << _e.what() << endl;
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool doVMTest(mValue& _v)
|
||||
{
|
||||
eth::VMFactory::setKind(eth::VMKind::JIT);
|
||||
|
||||
for (auto& i: _v.get_obj())
|
||||
{
|
||||
cnote << i.first;
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
assert(o.count("env") > 0);
|
||||
assert(o.count("pre") > 0);
|
||||
assert(o.count("exec") > 0);
|
||||
|
||||
FakeExtVM fev;
|
||||
fev.importEnv(o["env"].get_obj());
|
||||
fev.importState(o["pre"].get_obj());
|
||||
|
||||
fev.importExec(o["exec"].get_obj());
|
||||
if (fev.code.empty())
|
||||
{
|
||||
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
|
||||
fev.code = fev.thisTxCode;
|
||||
}
|
||||
|
||||
bytes output;
|
||||
u256 gas;
|
||||
bool vmExceptionOccured = false;
|
||||
try
|
||||
{
|
||||
auto vm = eth::VMFactory::create(fev.gas);
|
||||
output = vm->go(fev, fev.simpleTrace()).toBytes();
|
||||
gas = vm->gas();
|
||||
}
|
||||
catch (eth::VMException)
|
||||
{
|
||||
cnote << "Safe VM Exception";
|
||||
vmExceptionOccured = true;
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << diagnostic_information(_e);
|
||||
cnote << "Failed VM Test with Exception: " << _e.what();
|
||||
return 1;
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << _e.what();
|
||||
cnote << "Failed VM Test with Exception: " << _e.what();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// delete null entries in storage for the sake of comparison
|
||||
for (auto &a: fev.addresses)
|
||||
{
|
||||
vector<u256> keystoDelete;
|
||||
for (auto &s: get<2>(a.second))
|
||||
{
|
||||
if (s.second == 0)
|
||||
keystoDelete.push_back(s.first);
|
||||
}
|
||||
for (auto const key: keystoDelete )
|
||||
{
|
||||
get<2>(a.second).erase(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (o.count("post") > 0) // No exceptions expected
|
||||
{
|
||||
if (asserts(!vmExceptionOccured) || asserts(o.count("post") > 0) || asserts(o.count("callcreates") > 0) || asserts(o.count("out") > 0) || asserts(o.count("gas") > 0) || asserts(o.count("logs") > 0))
|
||||
return 1;
|
||||
|
||||
dev::test::FakeExtVM test;
|
||||
test.importState(o["post"].get_obj());
|
||||
test.importCallCreates(o["callcreates"].get_array());
|
||||
test.sub.logs = importLog(o["logs"].get_array());
|
||||
|
||||
//checkOutput(output, o);
|
||||
int j = 0;
|
||||
if (o["out"].type() == array_type)
|
||||
for (auto const& d: o["out"].get_array())
|
||||
{
|
||||
if (asserts(output[j] == toInt(d)))
|
||||
{
|
||||
cout << "Output byte [" << j << "] different!";
|
||||
return 1;
|
||||
}
|
||||
++j;
|
||||
}
|
||||
else if (o["out"].get_str().find("0x") == 0)
|
||||
{
|
||||
if (asserts(output == fromHex(o["out"].get_str().substr(2))))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (asserts(output == fromHex(o["out"].get_str())))
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (asserts(toInt(o["gas"]) == gas))
|
||||
return 1;
|
||||
|
||||
auto& expectedAddrs = test.addresses;
|
||||
auto& resultAddrs = fev.addresses;
|
||||
for (auto&& expectedPair : expectedAddrs)
|
||||
{
|
||||
auto& expectedAddr = expectedPair.first;
|
||||
auto resultAddrIt = resultAddrs.find(expectedAddr);
|
||||
if (resultAddrIt == resultAddrs.end())
|
||||
{
|
||||
cout << "Missing expected address " << expectedAddr;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& expectedState = expectedPair.second;
|
||||
auto& resultState = resultAddrIt->second;
|
||||
if (asserts(std::get<0>(expectedState) == std::get<0>(resultState)))
|
||||
{
|
||||
cout << expectedAddr << ": incorrect balance " << std::get<0>(resultState) << ", expected " << std::get<0>(expectedState);
|
||||
return 1;
|
||||
}
|
||||
if (asserts(std::get<1>(expectedState) == std::get<1>(resultState)))
|
||||
{
|
||||
cout << expectedAddr << ": incorrect txCount " << std::get<1>(resultState) << ", expected " << std::get<1>(expectedState);
|
||||
return 1;
|
||||
}
|
||||
if (asserts(std::get<3>(expectedState) == std::get<3>(resultState)))
|
||||
{
|
||||
cout << expectedAddr << ": incorrect code";
|
||||
return 1;
|
||||
}
|
||||
|
||||
//checkStorage(std::get<2>(expectedState), std::get<2>(resultState), expectedAddr);
|
||||
for (auto&& expectedStorePair : std::get<2>(expectedState))
|
||||
{
|
||||
auto& expectedStoreKey = expectedStorePair.first;
|
||||
auto resultStoreIt = std::get<2>(resultState).find(expectedStoreKey);
|
||||
if (resultStoreIt == std::get<2>(resultState).end())
|
||||
{
|
||||
cout << expectedAddr << ": missing store key " << expectedStoreKey << endl;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& expectedStoreValue = expectedStorePair.second;
|
||||
auto& resultStoreValue = resultStoreIt->second;
|
||||
if (asserts(expectedStoreValue == resultStoreValue))
|
||||
{
|
||||
cout << expectedAddr << ": store[" << expectedStoreKey << "] = " << resultStoreValue << ", expected " << expectedStoreValue << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (assertsEqual(std::get<2>(resultState).size(), std::get<2>(expectedState).size()))
|
||||
return 1;
|
||||
for (auto&& resultStorePair: std::get<2>(resultState))
|
||||
{
|
||||
if (!std::get<2>(expectedState).count(resultStorePair.first))
|
||||
{
|
||||
cout << expectedAddr << ": unexpected store key " << resultStorePair.first << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//checkAddresses<std::map<Address, std::tuple<u256, u256, std::map<u256, u256>, bytes> > >(test.addresses, fev.addresses);
|
||||
for (auto& resultPair : fev.addresses)
|
||||
{
|
||||
auto& resultAddr = resultPair.first;
|
||||
auto expectedAddrIt = test.addresses.find(resultAddr);
|
||||
if (expectedAddrIt == test.addresses.end())
|
||||
{
|
||||
cout << "Missing result address " << resultAddr << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (asserts(test.addresses == fev.addresses))
|
||||
return 1;
|
||||
|
||||
if (asserts(test.callcreates == fev.callcreates))
|
||||
return 1;
|
||||
|
||||
//checkCallCreates(fev.callcreates, test.callcreates);
|
||||
{
|
||||
if (assertsEqual(test.callcreates.size(), fev.callcreates.size()))
|
||||
return 1;
|
||||
|
||||
for (size_t i = 0; i < test.callcreates.size(); ++i)
|
||||
{
|
||||
if (asserts(test.callcreates[i].data() == fev.callcreates[i].data()))
|
||||
return 1;
|
||||
if (asserts(test.callcreates[i].receiveAddress() == fev.callcreates[i].receiveAddress()))
|
||||
return 1;
|
||||
if (asserts(test.callcreates[i].gas() == fev.callcreates[i].gas()))
|
||||
return 1;
|
||||
if (asserts(test.callcreates[i].value() == fev.callcreates[i].value()))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//checkLog(fev.sub.logs, test.sub.logs);
|
||||
{
|
||||
if (assertsEqual(fev.sub.logs.size(), test.sub.logs.size()))
|
||||
return 1;
|
||||
|
||||
for (size_t i = 0; i < fev.sub.logs.size(); ++i)
|
||||
{
|
||||
if (assertsEqual(fev.sub.logs[i].address, test.sub.logs[i].address))
|
||||
return 1;
|
||||
if (assertsEqual(fev.sub.logs[i].topics, test.sub.logs[i].topics))
|
||||
return 1;
|
||||
if (asserts(fev.sub.logs[i].data == test.sub.logs[i].data))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else // Exception expected
|
||||
{
|
||||
if (asserts(vmExceptionOccured))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// test passed
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file commonjs.cpp
|
||||
* @author Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libethcore/CommonJS.h>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(commonjs)
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsToPublic)
|
||||
{
|
||||
cnote << "Testing jsToPublic...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
string string = toJS(kp.pub());
|
||||
Public pub = dev::jsToPublic(string);
|
||||
BOOST_CHECK_EQUAL(kp.pub(), pub);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsToAddress)
|
||||
{
|
||||
cnote << "Testing jsToPublic...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
string string = toJS(kp.address());
|
||||
Address address = dev::jsToAddress(string);
|
||||
BOOST_CHECK_EQUAL(kp.address(), address);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsToSecret)
|
||||
{
|
||||
cnote << "Testing jsToPublic...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
string string = toJS(kp.secret());
|
||||
Secret secret = dev::jsToSecret(string);
|
||||
BOOST_CHECK_EQUAL(kp.secret(), secret);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file createRandomStateTest.cpp
|
||||
* @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
|
||||
* @date 2015
|
||||
* Creating a random state test.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#include <json_spirit/json_spirit.h>
|
||||
#include <json_spirit/json_spirit_reader_template.h>
|
||||
#include <json_spirit/json_spirit_writer_template.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libdevcore/CommonData.h>
|
||||
#include <libevmcore/Instruction.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
#include "TestHelper.h"
|
||||
#include "vm.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev;
|
||||
|
||||
void doStateTests(json_spirit::mValue& _v);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_logVerbosity = 0;
|
||||
|
||||
// create random code
|
||||
|
||||
boost::random::mt19937 gen;
|
||||
|
||||
auto now = chrono::steady_clock::now().time_since_epoch();
|
||||
auto timeSinceEpoch = chrono::duration_cast<chrono::nanoseconds>(now).count();
|
||||
gen.seed(static_cast<unsigned int>(timeSinceEpoch));
|
||||
// set min and max length of the random evm code
|
||||
boost::random::uniform_int_distribution<> lengthOfCodeDist(8, 24);
|
||||
boost::random::uniform_int_distribution<> reasonableInputValuesSize(0, 7);
|
||||
boost::random::uniform_int_distribution<> opcodeDist(0, 255);
|
||||
boost::random::uniform_int_distribution<> BlockInfoOpcodeDist(0x40, 0x45);
|
||||
boost::random::uniform_int_distribution<> uniformInt(0, 0x7fffffff);
|
||||
boost::random::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > randGenInputValue(gen, reasonableInputValuesSize);
|
||||
boost::random::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > randGenUniformInt(gen, uniformInt);
|
||||
boost::random::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > randGen(gen, opcodeDist);
|
||||
boost::random::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > randGenBlockInfoOpcode(gen, BlockInfoOpcodeDist);
|
||||
|
||||
std::vector<u256> reasonableInputValues;
|
||||
reasonableInputValues.push_back(0);
|
||||
reasonableInputValues.push_back(1);
|
||||
reasonableInputValues.push_back(50000);
|
||||
reasonableInputValues.push_back(u256("0x10000000000000000000000000000000000000000"));
|
||||
reasonableInputValues.push_back(u256("0xffffffffffffffffffffffffffffffffffffffff"));
|
||||
reasonableInputValues.push_back(u256("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe"));
|
||||
reasonableInputValues.push_back(u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
||||
reasonableInputValues.push_back(u256("0x945304eb96065b2a98b57a48a06ae28d285a71b5"));
|
||||
reasonableInputValues.push_back(randGenUniformInt());
|
||||
|
||||
int lengthOfCode = lengthOfCodeDist(gen);
|
||||
string randomCode;
|
||||
|
||||
for (int i = 0; i < lengthOfCode; ++i)
|
||||
{
|
||||
// pre-fill stack to avoid that most of the test fail with a stackunderflow
|
||||
if (i < 8 && (randGen() < 192))
|
||||
{
|
||||
randomCode += randGen() < 32 ? toHex(toCompactBigEndian((uint8_t)randGenBlockInfoOpcode())) : "7f" + toHex(reasonableInputValues[randGenInputValue()]);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t opcode = randGen();
|
||||
// disregard all invalid commands, except of one (0x0c)
|
||||
if ((dev::eth::isValidInstruction(dev::eth::Instruction(opcode)) || (randGen() > 250)))
|
||||
randomCode += toHex(toCompactBigEndian(opcode));
|
||||
else
|
||||
i--;
|
||||
}
|
||||
|
||||
string const s = R"(
|
||||
{
|
||||
"randomStatetest" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"currentDifficulty" : "5623894562375",
|
||||
"currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "0",
|
||||
"code" : "0x6001600101600055",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x6000355415600957005b60203560003555",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"data" : "0x42",
|
||||
"gasLimit" : "400000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "100000"
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
mValue v;
|
||||
read_string(s, v);
|
||||
|
||||
// insert new random code
|
||||
v.get_obj().find("randomStatetest")->second.get_obj().find("pre")->second.get_obj().begin()->second.get_obj()["code"] = "0x" + randomCode + (randGen() > 128 ? "55" : "") + (randGen() > 128 ? "60005155" : "");
|
||||
|
||||
// insert new data in tx
|
||||
v.get_obj().find("randomStatetest")->second.get_obj().find("transaction")->second.get_obj()["data"] = "0x" + randomCode;
|
||||
|
||||
// insert new value in tx
|
||||
v.get_obj().find("randomStatetest")->second.get_obj().find("transaction")->second.get_obj()["value"] = toString(randGenUniformInt());
|
||||
|
||||
// insert new gasLimit in tx
|
||||
v.get_obj().find("randomStatetest")->second.get_obj().find("transaction")->second.get_obj()["gasLimit"] = "0x" + toHex(toCompactBigEndian((int)randGenUniformInt()));
|
||||
|
||||
// fill test
|
||||
doStateTests(v);
|
||||
|
||||
// stream to output for further handling by the bash script
|
||||
cout << json_spirit::write_string(v, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void doStateTests(json_spirit::mValue& _v)
|
||||
{
|
||||
eth::VMFactory::setKind(eth::VMKind::Interpreter);
|
||||
|
||||
for (auto& i: _v.get_obj())
|
||||
{
|
||||
//cerr << i.first << endl;
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
assert(o.count("env") > 0);
|
||||
assert(o.count("pre") > 0);
|
||||
assert(o.count("transaction") > 0);
|
||||
|
||||
test::ImportTest importer(o, true);
|
||||
|
||||
eth::State theState = importer.m_statePre;
|
||||
bytes output;
|
||||
|
||||
try
|
||||
{
|
||||
output = theState.execute(test::lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "state execution did throw an exception: " << diagnostic_information(_e);
|
||||
theState.commit();
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "state execution did throw an exception: " << _e.what();
|
||||
}
|
||||
#if ETH_FATDB
|
||||
importer.exportTest(output, theState);
|
||||
#else
|
||||
cout << "You can not fill tests when FATDB is switched off";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file createRandomTest.cpp
|
||||
* @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
|
||||
* @date 2014
|
||||
* Creating a random virtual machine test.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#include <json_spirit/json_spirit.h>
|
||||
#include <json_spirit/json_spirit_reader_template.h>
|
||||
#include <json_spirit/json_spirit_writer_template.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libdevcore/CommonData.h>
|
||||
#include <libevmcore/Instruction.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
#include "vm.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev;
|
||||
|
||||
void doMyTests(json_spirit::mValue& _v);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_logVerbosity = 0;
|
||||
|
||||
// create random code
|
||||
|
||||
boost::random::mt19937 gen;
|
||||
|
||||
auto now = chrono::steady_clock::now().time_since_epoch();
|
||||
auto timeSinceEpoch = chrono::duration_cast<chrono::nanoseconds>(now).count();
|
||||
gen.seed(static_cast<unsigned int>(timeSinceEpoch));
|
||||
boost::random::uniform_int_distribution<> lengthOfCodeDist(2, 16);
|
||||
boost::random::uniform_int_distribution<> opcodeDist(0, 255);
|
||||
boost::random::uniform_int_distribution<> BlockInfoOpcodeDist(0x40, 0x45);
|
||||
boost::random::variate_generator<boost::mt19937&,
|
||||
boost::random::uniform_int_distribution<> > randGen(gen, opcodeDist);
|
||||
boost::random::variate_generator<boost::mt19937&,
|
||||
boost::random::uniform_int_distribution<> > randGenBlockInfoOpcode(gen, BlockInfoOpcodeDist);
|
||||
|
||||
int lengthOfCode = lengthOfCodeDist(gen);
|
||||
string randomCode;
|
||||
|
||||
for (int i = 0; i < lengthOfCode; ++i)
|
||||
{
|
||||
if (i < 8 && (randGen() < 192))
|
||||
{
|
||||
randomCode += toHex(toCompactBigEndian((uint8_t)randGenBlockInfoOpcode()));
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t opcode = randGen();
|
||||
// disregard all invalid commands, except of one (0x0c)
|
||||
if ((dev::eth::isValidInstruction(dev::eth::Instruction(opcode)) || (randGen() > 250)))
|
||||
randomCode += toHex(toCompactBigEndian(opcode));
|
||||
else
|
||||
i--;
|
||||
}
|
||||
|
||||
const string s =\
|
||||
"{\n\
|
||||
\"randomVMtest\": {\n\
|
||||
\"env\" : {\n\
|
||||
\"previousHash\" : \"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6\",\n\
|
||||
\"currentNumber\" : \"300\",\n\
|
||||
\"currentGasLimit\" : \"1000000\",\n\
|
||||
\"currentDifficulty\" : \"115792089237316195423570985008687907853269984665640564039457584007913129639935\",\n\
|
||||
\"currentTimestamp\" : 2,\n\
|
||||
\"currentCoinbase\" : \"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba\"\n\
|
||||
},\n\
|
||||
\"pre\" : {\n\
|
||||
\"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6\" : {\n\
|
||||
\"balance\" : \"1000000000000000000\",\n\
|
||||
\"nonce\" : 0,\n\
|
||||
\"code\" : \"random\",\n\
|
||||
\"storage\": {}\n\
|
||||
}\n\
|
||||
},\n\
|
||||
\"exec\" : {\n\
|
||||
\"address\" : \"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6\",\n\
|
||||
\"origin\" : \"cd1722f3947def4cf144679da39c4c32bdc35681\",\n\
|
||||
\"caller\" : \"cd1722f3947def4cf144679da39c4c32bdc35681\",\n\
|
||||
\"value\" : \"1000000000000000000\",\n\
|
||||
\"data\" : \"\",\n\
|
||||
\"gasPrice\" : \"100000000000000\",\n\
|
||||
\"gas\" : \"10000\"\n\
|
||||
}\n\
|
||||
}\n\
|
||||
}";
|
||||
|
||||
mValue v;
|
||||
read_string(s, v);
|
||||
|
||||
// insert new random code
|
||||
v.get_obj().find("randomVMtest")->second.get_obj().find("pre")->second.get_obj().begin()->second.get_obj()["code"] = "0x" + randomCode + (randGen() > 128 ? "55" : "");
|
||||
|
||||
// execute code in vm
|
||||
doMyTests(v);
|
||||
|
||||
// stream to output for further handling by the bash script
|
||||
cout << json_spirit::write_string(v, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void doMyTests(json_spirit::mValue& _v)
|
||||
{
|
||||
eth::VMFactory::setKind(eth::VMKind::Interpreter);
|
||||
|
||||
for (auto& i: _v.get_obj())
|
||||
{
|
||||
cnote << i.first;
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
assert(o.count("env") > 0);
|
||||
assert(o.count("pre") > 0);
|
||||
assert(o.count("exec") > 0);
|
||||
|
||||
dev::test::FakeExtVM fev;
|
||||
fev.importEnv(o["env"].get_obj());
|
||||
fev.importState(o["pre"].get_obj());
|
||||
|
||||
o["pre"] = mValue(fev.exportState());
|
||||
|
||||
fev.importExec(o["exec"].get_obj());
|
||||
if (fev.code.empty())
|
||||
{
|
||||
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
|
||||
fev.code = fev.thisTxCode;
|
||||
}
|
||||
|
||||
bytes output;
|
||||
auto vm = eth::VMFactory::create(fev.gas);
|
||||
|
||||
u256 gas;
|
||||
bool vmExceptionOccured = false;
|
||||
try
|
||||
{
|
||||
output = vm->go(fev, fev.simpleTrace()).toBytes();
|
||||
gas = vm->gas();
|
||||
}
|
||||
catch (eth::VMException const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << diagnostic_information(_e);
|
||||
vmExceptionOccured = true;
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << diagnostic_information(_e);
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << _e.what();
|
||||
}
|
||||
|
||||
// delete null entries in storage for the sake of comparison
|
||||
|
||||
for (auto &a: fev.addresses)
|
||||
{
|
||||
vector<u256> keystoDelete;
|
||||
for (auto &s: get<2>(a.second))
|
||||
{
|
||||
if (s.second == 0)
|
||||
keystoDelete.push_back(s.first);
|
||||
}
|
||||
for (auto const key: keystoDelete )
|
||||
{
|
||||
get<2>(a.second).erase(key);
|
||||
}
|
||||
}
|
||||
|
||||
o["env"] = mValue(fev.exportEnv());
|
||||
o["exec"] = mValue(fev.exportExec());
|
||||
if (!vmExceptionOccured)
|
||||
{
|
||||
o["post"] = mValue(fev.exportState());
|
||||
o["callcreates"] = fev.exportCallCreates();
|
||||
o["out"] = "0x" + toHex(output);
|
||||
fev.push(o, "gas", gas);
|
||||
o["logs"] = test::exportLog(fev.sub.logs);
|
||||
}
|
||||
}
|
||||
}
|
||||
-855
@@ -1,855 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file crypto.cpp
|
||||
* @author Alex Leverington <nessence@gmail.com>
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Crypto test functions.
|
||||
*/
|
||||
|
||||
#include <random>
|
||||
#include <secp256k1/secp256k1.h>
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/RLP.h>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libethereum/Transaction.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcrypto/SHA3.h>
|
||||
#include <libdevcrypto/ECDHE.h>
|
||||
#include <libdevcrypto/CryptoPP.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::crypto;
|
||||
using namespace CryptoPP;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(devcrypto)
|
||||
|
||||
static Secp256k1 s_secp256k1;
|
||||
static CryptoPP::AutoSeededRandomPool s_rng;
|
||||
static CryptoPP::OID s_curveOID(CryptoPP::ASN1::secp256k1());
|
||||
static CryptoPP::DL_GroupParameters_EC<CryptoPP::ECP> s_params(s_curveOID);
|
||||
static CryptoPP::DL_GroupParameters_EC<CryptoPP::ECP>::EllipticCurve s_curve(s_params.GetCurve());
|
||||
|
||||
BOOST_AUTO_TEST_CASE(emptySHA3Types)
|
||||
{
|
||||
h256 emptyListSHA3(fromHex("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"));
|
||||
BOOST_REQUIRE_EQUAL(emptyListSHA3, EmptyListSHA3);
|
||||
|
||||
h256 emptySHA3(fromHex("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"));
|
||||
BOOST_REQUIRE_EQUAL(emptySHA3, EmptySHA3);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cryptopp_patch)
|
||||
{
|
||||
KeyPair k = KeyPair::create();
|
||||
bytes io_text;
|
||||
s_secp256k1.decrypt(k.sec(), io_text);
|
||||
BOOST_REQUIRE_EQUAL(io_text.size(), 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(verify_secert)
|
||||
{
|
||||
h256 empty;
|
||||
KeyPair kNot(empty);
|
||||
BOOST_REQUIRE(!kNot.address());
|
||||
KeyPair k(sha3(empty));
|
||||
BOOST_REQUIRE(k.address());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(common_encrypt_decrypt)
|
||||
{
|
||||
string message("Now is the time for all good persons to come to the aid of humanity.");
|
||||
bytes m = asBytes(message);
|
||||
bytesConstRef bcr(&m);
|
||||
|
||||
KeyPair k = KeyPair::create();
|
||||
bytes cipher;
|
||||
encrypt(k.pub(), bcr, cipher);
|
||||
BOOST_REQUIRE(cipher != asBytes(message) && cipher.size() > 0);
|
||||
|
||||
bytes plain;
|
||||
decrypt(k.sec(), bytesConstRef(&cipher), plain);
|
||||
|
||||
BOOST_REQUIRE(asString(plain) == message);
|
||||
BOOST_REQUIRE(plain == asBytes(message));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cryptopp_cryptopp_secp256k1libport)
|
||||
{
|
||||
secp256k1_start();
|
||||
|
||||
// base secret
|
||||
Secret secret(sha3("privacy"));
|
||||
|
||||
// we get ec params from signer
|
||||
ECDSA<ECP, SHA3_256>::Signer signer;
|
||||
|
||||
// e := sha3(msg)
|
||||
bytes e(fromHex("0x01"));
|
||||
e.resize(32);
|
||||
int tests = 2;
|
||||
while (sha3(&e, &e), secret = sha3(secret.asBytes()), tests--)
|
||||
{
|
||||
KeyPair key(secret);
|
||||
Public pkey = key.pub();
|
||||
signer.AccessKey().Initialize(s_params, secretToExponent(secret));
|
||||
|
||||
h256 he(sha3(e));
|
||||
Integer heInt(he.asBytes().data(), 32);
|
||||
h256 k(crypto::kdf(secret, he));
|
||||
Integer kInt(k.asBytes().data(), 32);
|
||||
kInt %= s_params.GetSubgroupOrder()-1;
|
||||
|
||||
ECP::Point rp = s_params.ExponentiateBase(kInt);
|
||||
Integer const& q = s_params.GetGroupOrder();
|
||||
Integer r = s_params.ConvertElementToInteger(rp);
|
||||
|
||||
Integer kInv = kInt.InverseMod(q);
|
||||
Integer s = (kInv * (Integer(secret.asBytes().data(), 32)*r + heInt)) % q;
|
||||
BOOST_REQUIRE(!!r && !!s);
|
||||
|
||||
Signature sig;
|
||||
sig[64] = rp.y.IsOdd() ? 1 : 0;
|
||||
r.Encode(sig.data(), 32);
|
||||
s.Encode(sig.data() + 32, 32);
|
||||
|
||||
Public p = dev::recover(sig, he);
|
||||
BOOST_REQUIRE(p == pkey);
|
||||
|
||||
// verify w/cryptopp
|
||||
BOOST_REQUIRE(s_secp256k1.verify(pkey, sig, bytesConstRef(&e)));
|
||||
|
||||
// verify with secp256k1lib
|
||||
byte encpub[65] = {0x04};
|
||||
memcpy(&encpub[1], pkey.data(), 64);
|
||||
byte dersig[72];
|
||||
size_t cssz = DSAConvertSignatureFormat(dersig, 72, DSA_DER, sig.data(), 64, DSA_P1363);
|
||||
BOOST_CHECK(cssz <= 72);
|
||||
BOOST_REQUIRE(1 == secp256k1_ecdsa_verify(he.data(), sizeof(he), dersig, cssz, encpub, 65));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cryptopp_ecdsa_sipaseckp256k1)
|
||||
{
|
||||
secp256k1_start();
|
||||
|
||||
// cryptopp integer encoding
|
||||
Integer nHex("f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2H");
|
||||
Integer nB(fromHex("f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2").data(), 32);
|
||||
BOOST_REQUIRE(nHex == nB);
|
||||
|
||||
bytes sbytes(fromHex("0xFFFF"));
|
||||
Secret secret(sha3(sbytes));
|
||||
KeyPair key(secret);
|
||||
|
||||
bytes m(1, 0xff);
|
||||
int tests = 2;
|
||||
while (m[0]++, tests--)
|
||||
{
|
||||
h256 hm(sha3(m));
|
||||
Integer hInt(hm.asBytes().data(), 32);
|
||||
h256 k(hm ^ key.sec());
|
||||
Integer kInt(k.asBytes().data(), 32);
|
||||
|
||||
// raw sign w/cryptopp (doesn't pass through cryptopp hash filter)
|
||||
ECDSA<ECP, SHA3_256>::Signer signer;
|
||||
signer.AccessKey().Initialize(s_params, secretToExponent(key.sec()));
|
||||
Integer r, s;
|
||||
signer.RawSign(kInt, hInt, r, s);
|
||||
|
||||
// verify cryptopp raw-signature w/cryptopp
|
||||
ECDSA<ECP, SHA3_256>::Verifier verifier;
|
||||
verifier.AccessKey().Initialize(s_params, publicToPoint(key.pub()));
|
||||
Signature sigppraw;
|
||||
r.Encode(sigppraw.data(), 32);
|
||||
s.Encode(sigppraw.data() + 32, 32);
|
||||
BOOST_REQUIRE(verifier.VerifyMessage(m.data(), m.size(), sigppraw.data(), 64));
|
||||
// BOOST_REQUIRE(crypto::verify(key.pub(), sigppraw, bytesConstRef(&m)));
|
||||
BOOST_REQUIRE(dev::verify(key.pub(), sigppraw, hm));
|
||||
|
||||
// sign with cryptopp, verify, recover w/sec256lib
|
||||
Signature seclibsig(dev::sign(key.sec(), hm));
|
||||
BOOST_REQUIRE(verifier.VerifyMessage(m.data(), m.size(), seclibsig.data(), 64));
|
||||
// BOOST_REQUIRE(crypto::verify(key.pub(), seclibsig, bytesConstRef(&m)));
|
||||
BOOST_REQUIRE(dev::verify(key.pub(), seclibsig, hm));
|
||||
BOOST_REQUIRE(dev::recover(seclibsig, hm) == key.pub());
|
||||
|
||||
// sign with cryptopp (w/hash filter?), verify with cryptopp
|
||||
bytes sigppb(signer.MaxSignatureLength());
|
||||
size_t ssz = signer.SignMessage(s_rng, m.data(), m.size(), sigppb.data());
|
||||
Signature sigpp;
|
||||
memcpy(sigpp.data(), sigppb.data(), 64);
|
||||
BOOST_REQUIRE(verifier.VerifyMessage(m.data(), m.size(), sigppb.data(), ssz));
|
||||
// BOOST_REQUIRE(crypto::verify(key.pub(), sigpp, bytesConstRef(&m)));
|
||||
BOOST_REQUIRE(dev::verify(key.pub(), sigpp, hm));
|
||||
|
||||
// sign with cryptopp and stringsource hash filter
|
||||
string sigstr;
|
||||
StringSource ssrc(asString(m), true, new SignerFilter(s_rng, signer, new StringSink(sigstr)));
|
||||
FixedHash<sizeof(Signature)> retsig((byte const*)sigstr.data(), Signature::ConstructFromPointer);
|
||||
BOOST_REQUIRE(verifier.VerifyMessage(m.data(), m.size(), retsig.data(), 64));
|
||||
// BOOST_REQUIRE(crypto::verify(key.pub(), retsig, bytesConstRef(&m)));
|
||||
BOOST_REQUIRE(dev::verify(key.pub(), retsig, hm));
|
||||
|
||||
/// verification w/sec256lib
|
||||
// requires public key and sig in standard format
|
||||
byte encpub[65] = {0x04};
|
||||
memcpy(&encpub[1], key.pub().data(), 64);
|
||||
byte dersig[72];
|
||||
|
||||
// verify sec256lib sig w/sec256lib
|
||||
size_t cssz = DSAConvertSignatureFormat(dersig, 72, DSA_DER, seclibsig.data(), 64, DSA_P1363);
|
||||
BOOST_CHECK(cssz <= 72);
|
||||
BOOST_REQUIRE(1 == secp256k1_ecdsa_verify(hm.data(), sizeof(hm), dersig, cssz, encpub, 65));
|
||||
|
||||
// verify cryptopp-raw sig w/sec256lib
|
||||
cssz = DSAConvertSignatureFormat(dersig, 72, DSA_DER, sigppraw.data(), 64, DSA_P1363);
|
||||
BOOST_CHECK(cssz <= 72);
|
||||
BOOST_REQUIRE(1 == secp256k1_ecdsa_verify(hm.data(), sizeof(hm), dersig, cssz, encpub, 65));
|
||||
|
||||
// verify cryptopp sig w/sec256lib
|
||||
cssz = DSAConvertSignatureFormat(dersig, 72, DSA_DER, sigppb.data(), 64, DSA_P1363);
|
||||
BOOST_CHECK(cssz <= 72);
|
||||
BOOST_REQUIRE(1 == secp256k1_ecdsa_verify(hm.data(), sizeof(hm), dersig, cssz, encpub, 65));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(sha3_norestart)
|
||||
{
|
||||
CryptoPP::SHA3_256 ctx;
|
||||
bytes input(asBytes("test"));
|
||||
ctx.Update(input.data(), 4);
|
||||
CryptoPP::SHA3_256 ctxCopy(ctx);
|
||||
bytes interimDigest(32);
|
||||
ctx.Final(interimDigest.data());
|
||||
ctx.Update(input.data(), 4);
|
||||
bytes firstDigest(32);
|
||||
ctx.Final(firstDigest.data());
|
||||
BOOST_REQUIRE(interimDigest == firstDigest);
|
||||
|
||||
ctxCopy.Update(input.data(), 4);
|
||||
bytes finalDigest(32);
|
||||
ctxCopy.Final(interimDigest.data());
|
||||
BOOST_REQUIRE(interimDigest != finalDigest);
|
||||
|
||||
// we can do this another way -- copy the context for final
|
||||
ctxCopy.Update(input.data(), 4);
|
||||
ctxCopy.Update(input.data(), 4);
|
||||
CryptoPP::SHA3_256 finalCtx(ctxCopy);
|
||||
bytes finalDigest2(32);
|
||||
finalCtx.Final(finalDigest2.data());
|
||||
BOOST_REQUIRE(finalDigest2 == interimDigest);
|
||||
ctxCopy.Update(input.data(), 4);
|
||||
bytes finalDigest3(32);
|
||||
finalCtx.Final(finalDigest3.data());
|
||||
BOOST_REQUIRE(finalDigest2 != finalDigest3);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecies_kdf)
|
||||
{
|
||||
KeyPair local = KeyPair::create();
|
||||
KeyPair remote = KeyPair::create();
|
||||
// nonce
|
||||
Secret z1;
|
||||
ecdh::agree(local.sec(), remote.pub(), z1);
|
||||
auto key1 = s_secp256k1.eciesKDF(z1, bytes(), 64);
|
||||
bytesConstRef eKey1 = bytesConstRef(&key1).cropped(0, 32);
|
||||
bytesRef mKey1 = bytesRef(&key1).cropped(32, 32);
|
||||
sha3(mKey1, mKey1);
|
||||
|
||||
Secret z2;
|
||||
ecdh::agree(remote.sec(), local.pub(), z2);
|
||||
auto key2 = s_secp256k1.eciesKDF(z2, bytes(), 64);
|
||||
bytesConstRef eKey2 = bytesConstRef(&key2).cropped(0, 32);
|
||||
bytesRef mKey2 = bytesRef(&key2).cropped(32, 32);
|
||||
sha3(mKey2, mKey2);
|
||||
|
||||
BOOST_REQUIRE(eKey1.toBytes() == eKey2.toBytes());
|
||||
BOOST_REQUIRE(mKey1.toBytes() == mKey2.toBytes());
|
||||
|
||||
BOOST_REQUIRE((u256)h256(z1) > 0);
|
||||
BOOST_REQUIRE(z1 == z2);
|
||||
|
||||
BOOST_REQUIRE(key1.size() > 0 && ((u512)h512(key1)) > 0);
|
||||
BOOST_REQUIRE(key1 == key2);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecies_standard)
|
||||
{
|
||||
KeyPair k = KeyPair::create();
|
||||
|
||||
string message("Now is the time for all good persons to come to the aid of humanity.");
|
||||
string original = message;
|
||||
bytes b = asBytes(message);
|
||||
|
||||
s_secp256k1.encryptECIES(k.pub(), b);
|
||||
BOOST_REQUIRE(b != asBytes(original));
|
||||
BOOST_REQUIRE(b.size() > 0 && b[0] == 0x04);
|
||||
|
||||
s_secp256k1.decryptECIES(k.sec(), b);
|
||||
BOOST_REQUIRE(bytesConstRef(&b).cropped(0, original.size()).toBytes() == asBytes(original));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecies_eckeypair)
|
||||
{
|
||||
KeyPair k = KeyPair::create();
|
||||
|
||||
string message("Now is the time for all good persons to come to the aid of humanity.");
|
||||
string original = message;
|
||||
|
||||
bytes b = asBytes(message);
|
||||
s_secp256k1.encrypt(k.pub(), b);
|
||||
BOOST_REQUIRE(b != asBytes(original));
|
||||
|
||||
s_secp256k1.decrypt(k.sec(), b);
|
||||
BOOST_REQUIRE(b == asBytes(original));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecdh)
|
||||
{
|
||||
cnote << "Testing ecdh...";
|
||||
|
||||
ECDH<ECP>::Domain dhLocal(s_curveOID);
|
||||
SecByteBlock privLocal(dhLocal.PrivateKeyLength());
|
||||
SecByteBlock pubLocal(dhLocal.PublicKeyLength());
|
||||
dhLocal.GenerateKeyPair(s_rng, privLocal, pubLocal);
|
||||
|
||||
ECDH<ECP>::Domain dhRemote(s_curveOID);
|
||||
SecByteBlock privRemote(dhRemote.PrivateKeyLength());
|
||||
SecByteBlock pubRemote(dhRemote.PublicKeyLength());
|
||||
dhRemote.GenerateKeyPair(s_rng, privRemote, pubRemote);
|
||||
|
||||
assert(dhLocal.AgreedValueLength() == dhRemote.AgreedValueLength());
|
||||
|
||||
// local: send public to remote; remote: send public to local
|
||||
|
||||
// Local
|
||||
SecByteBlock sharedLocal(dhLocal.AgreedValueLength());
|
||||
assert(dhLocal.Agree(sharedLocal, privLocal, pubRemote));
|
||||
|
||||
// Remote
|
||||
SecByteBlock sharedRemote(dhRemote.AgreedValueLength());
|
||||
assert(dhRemote.Agree(sharedRemote, privRemote, pubLocal));
|
||||
|
||||
// Test
|
||||
Integer ssLocal, ssRemote;
|
||||
ssLocal.Decode(sharedLocal.BytePtr(), sharedLocal.SizeInBytes());
|
||||
ssRemote.Decode(sharedRemote.BytePtr(), sharedRemote.SizeInBytes());
|
||||
|
||||
assert(ssLocal != 0);
|
||||
assert(ssLocal == ssRemote);
|
||||
|
||||
|
||||
// Now use our keys
|
||||
KeyPair a = KeyPair::create();
|
||||
byte puba[65] = {0x04};
|
||||
memcpy(&puba[1], a.pub().data(), 64);
|
||||
|
||||
KeyPair b = KeyPair::create();
|
||||
byte pubb[65] = {0x04};
|
||||
memcpy(&pubb[1], b.pub().data(), 64);
|
||||
|
||||
ECDH<ECP>::Domain dhA(s_curveOID);
|
||||
Secret shared;
|
||||
BOOST_REQUIRE(dhA.Agree(shared.data(), a.sec().data(), pubb));
|
||||
BOOST_REQUIRE(shared);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecdhe)
|
||||
{
|
||||
cnote << "Testing ecdhe...";
|
||||
|
||||
ECDHE a, b;
|
||||
BOOST_CHECK_NE(a.pubkey(), b.pubkey());
|
||||
|
||||
ECDHE local;
|
||||
ECDHE remote;
|
||||
|
||||
// local tx pubkey -> remote
|
||||
Secret sremote;
|
||||
remote.agree(local.pubkey(), sremote);
|
||||
|
||||
// remote tx pbukey -> local
|
||||
Secret slocal;
|
||||
local.agree(remote.pubkey(), slocal);
|
||||
|
||||
BOOST_REQUIRE(sremote);
|
||||
BOOST_REQUIRE(slocal);
|
||||
BOOST_REQUIRE_EQUAL(sremote, slocal);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(handshakeNew)
|
||||
{
|
||||
// authInitiator -> E(remote-pubk, S(ecdhe-random, ecdh-shared-secret^nonce) || H(ecdhe-random-pubk) || pubk || nonce || 0x0)
|
||||
// authRecipient -> E(remote-pubk, ecdhe-random-pubk || nonce || 0x0)
|
||||
|
||||
h256 base(sha3("privacy"));
|
||||
sha3(base.ref(), base.ref());
|
||||
Secret nodeAsecret(base);
|
||||
KeyPair nodeA(nodeAsecret);
|
||||
BOOST_REQUIRE(nodeA.pub());
|
||||
|
||||
sha3(base.ref(), base.ref());
|
||||
Secret nodeBsecret(base);
|
||||
KeyPair nodeB(nodeBsecret);
|
||||
BOOST_REQUIRE(nodeB.pub());
|
||||
|
||||
BOOST_REQUIRE_NE(nodeA.sec(), nodeB.sec());
|
||||
|
||||
// Initiator is Alice (nodeA)
|
||||
ECDHE eA;
|
||||
bytes nAbytes(fromHex("0xAAAA"));
|
||||
h256 nonceA(sha3(nAbytes));
|
||||
bytes auth(Signature::size + h256::size + Public::size + h256::size + 1);
|
||||
Secret ssA;
|
||||
{
|
||||
bytesRef sig(&auth[0], Signature::size);
|
||||
bytesRef hepubk(&auth[Signature::size], h256::size);
|
||||
bytesRef pubk(&auth[Signature::size + h256::size], Public::size);
|
||||
bytesRef nonce(&auth[Signature::size + h256::size + Public::size], h256::size);
|
||||
|
||||
crypto::ecdh::agree(nodeA.sec(), nodeB.pub(), ssA);
|
||||
sign(eA.seckey(), ssA ^ nonceA).ref().copyTo(sig);
|
||||
sha3(eA.pubkey().ref(), hepubk);
|
||||
nodeA.pub().ref().copyTo(pubk);
|
||||
nonceA.ref().copyTo(nonce);
|
||||
auth[auth.size() - 1] = 0x0;
|
||||
}
|
||||
bytes authcipher;
|
||||
encrypt(nodeB.pub(), &auth, authcipher);
|
||||
BOOST_REQUIRE_EQUAL(authcipher.size(), 279);
|
||||
|
||||
// Receipient is Bob (nodeB)
|
||||
ECDHE eB;
|
||||
bytes nBbytes(fromHex("0xBBBB"));
|
||||
h256 nonceB(sha3(nAbytes));
|
||||
bytes ack(Public::size + h256::size + 1);
|
||||
{
|
||||
// todo: replace nodeA.pub() in encrypt()
|
||||
// decrypt public key from auth
|
||||
bytes authdecrypted;
|
||||
decrypt(nodeB.sec(), &authcipher, authdecrypted);
|
||||
Public node;
|
||||
bytesConstRef pubk(&authdecrypted[Signature::size + h256::size], Public::size);
|
||||
pubk.copyTo(node.ref());
|
||||
|
||||
bytesRef epubk(&ack[0], Public::size);
|
||||
bytesRef nonce(&ack[Public::size], h256::size);
|
||||
|
||||
eB.pubkey().ref().copyTo(epubk);
|
||||
nonceB.ref().copyTo(nonce);
|
||||
auth[auth.size() - 1] = 0x0;
|
||||
}
|
||||
bytes ackcipher;
|
||||
encrypt(nodeA.pub(), &ack, ackcipher);
|
||||
BOOST_REQUIRE_EQUAL(ackcipher.size(), 182);
|
||||
|
||||
BOOST_REQUIRE(eA.pubkey());
|
||||
BOOST_REQUIRE(eB.pubkey());
|
||||
BOOST_REQUIRE_NE(eA.seckey(), eB.seckey());
|
||||
|
||||
/// Alice (after receiving ack)
|
||||
Secret aEncryptK;
|
||||
Secret aMacK;
|
||||
Secret aEgressMac;
|
||||
Secret aIngressMac;
|
||||
{
|
||||
bytes ackdecrypted;
|
||||
decrypt(nodeA.sec(), &ackcipher, ackdecrypted);
|
||||
BOOST_REQUIRE(ackdecrypted.size());
|
||||
bytesConstRef ackRef(&ackdecrypted);
|
||||
Public eBAck;
|
||||
h256 nonceBAck;
|
||||
ackRef.cropped(0, Public::size).copyTo(bytesRef(eBAck.data(), Public::size));
|
||||
ackRef.cropped(Public::size, h256::size).copyTo(nonceBAck.ref());
|
||||
BOOST_REQUIRE_EQUAL(eBAck, eB.pubkey());
|
||||
BOOST_REQUIRE_EQUAL(nonceBAck, nonceB);
|
||||
|
||||
// TODO: export ess and require equal to b
|
||||
|
||||
bytes keyMaterialBytes(512);
|
||||
bytesRef keyMaterial(&keyMaterialBytes);
|
||||
|
||||
h256 ess;
|
||||
// todo: ecdh-agree should be able to output bytes
|
||||
eA.agree(eBAck, ess);
|
||||
ess.ref().copyTo(keyMaterial.cropped(0, h256::size));
|
||||
ssA.ref().copyTo(keyMaterial.cropped(h256::size, h256::size));
|
||||
// auto token = sha3(ssA);
|
||||
aEncryptK = sha3(keyMaterial);
|
||||
aEncryptK.ref().copyTo(keyMaterial.cropped(h256::size, h256::size));
|
||||
aMacK = sha3(keyMaterial);
|
||||
|
||||
keyMaterialBytes.resize(h256::size + authcipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
(aMacK ^ nonceBAck).ref().copyTo(keyMaterial);
|
||||
bytesConstRef(&authcipher).copyTo(keyMaterial.cropped(h256::size, authcipher.size()));
|
||||
aEgressMac = sha3(keyMaterial);
|
||||
|
||||
keyMaterialBytes.resize(h256::size + ackcipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
(aMacK ^ nonceA).ref().copyTo(keyMaterial);
|
||||
bytesConstRef(&ackcipher).copyTo(keyMaterial.cropped(h256::size, ackcipher.size()));
|
||||
aIngressMac = sha3(keyMaterial);
|
||||
}
|
||||
|
||||
|
||||
/// Bob (after sending ack)
|
||||
Secret ssB;
|
||||
crypto::ecdh::agree(nodeB.sec(), nodeA.pub(), ssB);
|
||||
BOOST_REQUIRE_EQUAL(ssA, ssB);
|
||||
|
||||
Secret bEncryptK;
|
||||
Secret bMacK;
|
||||
Secret bEgressMac;
|
||||
Secret bIngressMac;
|
||||
{
|
||||
bytes authdecrypted;
|
||||
decrypt(nodeB.sec(), &authcipher, authdecrypted);
|
||||
BOOST_REQUIRE(authdecrypted.size());
|
||||
bytesConstRef ackRef(&authdecrypted);
|
||||
Signature sigAuth;
|
||||
h256 heA;
|
||||
Public eAAuth;
|
||||
Public nodeAAuth;
|
||||
h256 nonceAAuth;
|
||||
bytesConstRef sig(&authdecrypted[0], Signature::size);
|
||||
bytesConstRef hepubk(&authdecrypted[Signature::size], h256::size);
|
||||
bytesConstRef pubk(&authdecrypted[Signature::size + h256::size], Public::size);
|
||||
bytesConstRef nonce(&authdecrypted[Signature::size + h256::size + Public::size], h256::size);
|
||||
|
||||
nonce.copyTo(nonceAAuth.ref());
|
||||
pubk.copyTo(nodeAAuth.ref());
|
||||
BOOST_REQUIRE(nonceAAuth);
|
||||
BOOST_REQUIRE_EQUAL(nonceA, nonceAAuth);
|
||||
BOOST_REQUIRE(nodeAAuth);
|
||||
BOOST_REQUIRE_EQUAL(nodeA.pub(), nodeAAuth); // bad test, bad!!!
|
||||
hepubk.copyTo(heA.ref());
|
||||
sig.copyTo(sigAuth.ref());
|
||||
|
||||
Secret ss;
|
||||
s_secp256k1.agree(nodeB.sec(), nodeAAuth, ss);
|
||||
eAAuth = recover(sigAuth, ss ^ nonceAAuth);
|
||||
// todo: test when this fails; means remote is bad or packet bits were flipped
|
||||
BOOST_REQUIRE_EQUAL(heA, sha3(eAAuth));
|
||||
BOOST_REQUIRE_EQUAL(eAAuth, eA.pubkey());
|
||||
|
||||
bytes keyMaterialBytes(512);
|
||||
bytesRef keyMaterial(&keyMaterialBytes);
|
||||
|
||||
h256 ess;
|
||||
// todo: ecdh-agree should be able to output bytes
|
||||
eB.agree(eAAuth, ess);
|
||||
// s_secp256k1.agree(eB.seckey(), eAAuth, ess);
|
||||
ess.ref().copyTo(keyMaterial.cropped(0, h256::size));
|
||||
ssB.ref().copyTo(keyMaterial.cropped(h256::size, h256::size));
|
||||
// auto token = sha3(ssA);
|
||||
bEncryptK = sha3(keyMaterial);
|
||||
bEncryptK.ref().copyTo(keyMaterial.cropped(h256::size, h256::size));
|
||||
bMacK = sha3(keyMaterial);
|
||||
|
||||
// todo: replace nonceB with decrypted nonceB
|
||||
keyMaterialBytes.resize(h256::size + ackcipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
(bMacK ^ nonceAAuth).ref().copyTo(keyMaterial);
|
||||
bytesConstRef(&ackcipher).copyTo(keyMaterial.cropped(h256::size, ackcipher.size()));
|
||||
bEgressMac = sha3(keyMaterial);
|
||||
|
||||
keyMaterialBytes.resize(h256::size + authcipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
(bMacK ^ nonceB).ref().copyTo(keyMaterial);
|
||||
bytesConstRef(&authcipher).copyTo(keyMaterial.cropped(h256::size, authcipher.size()));
|
||||
bIngressMac = sha3(keyMaterial);
|
||||
}
|
||||
|
||||
BOOST_REQUIRE_EQUAL(aEncryptK, bEncryptK);
|
||||
BOOST_REQUIRE_EQUAL(aMacK, bMacK);
|
||||
BOOST_REQUIRE_EQUAL(aEgressMac, bIngressMac);
|
||||
BOOST_REQUIRE_EQUAL(bEgressMac, aIngressMac);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecies_aes128_ctr_unaligned)
|
||||
{
|
||||
Secret encryptK(sha3("..."));
|
||||
h256 egressMac(sha3("+++"));
|
||||
// TESTING: send encrypt magic sequence
|
||||
bytes magic {0x22,0x40,0x08,0x91};
|
||||
bytes magicCipherAndMac;
|
||||
encryptSymNoAuth(encryptK, &magic, magicCipherAndMac, h128());
|
||||
|
||||
magicCipherAndMac.resize(magicCipherAndMac.size() + 32);
|
||||
sha3mac(egressMac.ref(), &magic, egressMac.ref());
|
||||
egressMac.ref().copyTo(bytesRef(&magicCipherAndMac).cropped(magicCipherAndMac.size() - 32, 32));
|
||||
|
||||
bytes plaintext;
|
||||
bytesConstRef cipher(&magicCipherAndMac[0], magicCipherAndMac.size() - 32);
|
||||
decryptSymNoAuth(encryptK, h128(), cipher, plaintext);
|
||||
|
||||
plaintext.resize(magic.size());
|
||||
BOOST_REQUIRE(plaintext.size() > 0);
|
||||
BOOST_REQUIRE(magic == plaintext);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecies_aes128_ctr)
|
||||
{
|
||||
Secret k(sha3("0xAAAA"));
|
||||
string m = "AAAAAAAAAAAAAAAA";
|
||||
bytesConstRef msg((byte*)m.data(), m.size());
|
||||
|
||||
bytes ciphertext;
|
||||
auto iv = encryptSymNoAuth(k, msg, ciphertext);
|
||||
|
||||
bytes plaintext;
|
||||
decryptSymNoAuth(k, iv, &ciphertext, plaintext);
|
||||
BOOST_REQUIRE_EQUAL(asString(plaintext), m);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cryptopp_aes128_ctr)
|
||||
{
|
||||
const int aesKeyLen = 16;
|
||||
BOOST_REQUIRE(sizeof(char) == sizeof(byte));
|
||||
|
||||
// generate test key
|
||||
AutoSeededRandomPool rng;
|
||||
SecByteBlock key(0x00, aesKeyLen);
|
||||
rng.GenerateBlock(key, key.size());
|
||||
|
||||
// cryptopp uses IV as nonce/counter which is same as using nonce w/0 ctr
|
||||
FixedHash<AES::BLOCKSIZE> ctr;
|
||||
rng.GenerateBlock(ctr.data(), sizeof(ctr));
|
||||
|
||||
// used for decrypt
|
||||
FixedHash<AES::BLOCKSIZE> ctrcopy(ctr);
|
||||
|
||||
string text = "Now is the time for all good persons to come to the aid of humanity.";
|
||||
unsigned char const* in = (unsigned char*)&text[0];
|
||||
unsigned char* out = (unsigned char*)&text[0];
|
||||
string original = text;
|
||||
string doublespeak = text + text;
|
||||
|
||||
string cipherCopy;
|
||||
try
|
||||
{
|
||||
CTR_Mode<AES>::Encryption e;
|
||||
e.SetKeyWithIV(key, key.size(), ctr.data());
|
||||
|
||||
// 68 % 255 should be difference of counter
|
||||
e.ProcessData(out, in, text.size());
|
||||
ctr = h128(u128(ctr) + text.size() / 16);
|
||||
|
||||
BOOST_REQUIRE(text != original);
|
||||
cipherCopy = text;
|
||||
}
|
||||
catch (CryptoPP::Exception& _e)
|
||||
{
|
||||
cerr << _e.what() << endl;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CTR_Mode< AES >::Decryption d;
|
||||
d.SetKeyWithIV(key, key.size(), ctrcopy.data());
|
||||
d.ProcessData(out, in, text.size());
|
||||
BOOST_REQUIRE(text == original);
|
||||
}
|
||||
catch (CryptoPP::Exception& _e)
|
||||
{
|
||||
cerr << _e.what() << endl;
|
||||
}
|
||||
|
||||
|
||||
// reencrypt ciphertext...
|
||||
try
|
||||
{
|
||||
BOOST_REQUIRE(cipherCopy != text);
|
||||
in = (unsigned char*)&cipherCopy[0];
|
||||
out = (unsigned char*)&cipherCopy[0];
|
||||
|
||||
CTR_Mode<AES>::Encryption e;
|
||||
e.SetKeyWithIV(key, key.size(), ctrcopy.data());
|
||||
e.ProcessData(out, in, text.size());
|
||||
|
||||
// yep, ctr mode.
|
||||
BOOST_REQUIRE(cipherCopy == original);
|
||||
}
|
||||
catch (CryptoPP::Exception& _e)
|
||||
{
|
||||
cerr << _e.what() << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(cryptopp_aes128_cbc)
|
||||
{
|
||||
const int aesKeyLen = 16;
|
||||
BOOST_REQUIRE(sizeof(char) == sizeof(byte));
|
||||
|
||||
AutoSeededRandomPool rng;
|
||||
SecByteBlock key(0x00, aesKeyLen);
|
||||
rng.GenerateBlock(key, key.size());
|
||||
|
||||
// Generate random IV
|
||||
byte iv[AES::BLOCKSIZE];
|
||||
rng.GenerateBlock(iv, AES::BLOCKSIZE);
|
||||
|
||||
string string128("AAAAAAAAAAAAAAAA");
|
||||
string plainOriginal = string128;
|
||||
|
||||
CryptoPP::CBC_Mode<Rijndael>::Encryption cbcEncryption(key, key.size(), iv);
|
||||
cbcEncryption.ProcessData((byte*)&string128[0], (byte*)&string128[0], string128.size());
|
||||
BOOST_REQUIRE(string128 != plainOriginal);
|
||||
|
||||
CBC_Mode<Rijndael>::Decryption cbcDecryption(key, key.size(), iv);
|
||||
cbcDecryption.ProcessData((byte*)&string128[0], (byte*)&string128[0], string128.size());
|
||||
BOOST_REQUIRE(plainOriginal == string128);
|
||||
|
||||
|
||||
// plaintext whose size isn't divisible by block size must use stream filter for padding
|
||||
string string192("AAAAAAAAAAAAAAAABBBBBBBB");
|
||||
plainOriginal = string192;
|
||||
|
||||
string cipher;
|
||||
StreamTransformationFilter* aesStream = new StreamTransformationFilter(cbcEncryption, new StringSink(cipher));
|
||||
StringSource source(string192, true, aesStream);
|
||||
BOOST_REQUIRE(cipher.size() == 32);
|
||||
|
||||
cbcDecryption.ProcessData((byte*)&cipher[0], (byte*)&string192[0], cipher.size());
|
||||
BOOST_REQUIRE(string192 == plainOriginal);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(eth_keypairs)
|
||||
{
|
||||
cnote << "Testing Crypto...";
|
||||
secp256k1_start();
|
||||
|
||||
KeyPair p(Secret(fromHex("3ecb44df2159c26e0f995712d4f39b6f6e499b40749b1cf1246c37f9516cb6a4")));
|
||||
BOOST_REQUIRE(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f")));
|
||||
BOOST_REQUIRE(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
|
||||
{
|
||||
eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret());
|
||||
auto rlp = t.rlp(eth::WithoutSignature);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
cnote << t.sha3(eth::WithoutSignature);
|
||||
rlp = t.rlp(eth::WithSignature);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
cnote << t.sha3(eth::WithSignature);
|
||||
BOOST_REQUIRE(t.sender() == p.address());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int cryptoTest()
|
||||
{
|
||||
cnote << "Testing Crypto...";
|
||||
secp256k1_start();
|
||||
|
||||
KeyPair p(Secret(fromHex("3ecb44df2159c26e0f995712d4f39b6f6e499b40749b1cf1246c37f9516cb6a4")));
|
||||
BOOST_REQUIRE(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f")));
|
||||
BOOST_REQUIRE(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
|
||||
{
|
||||
eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret());
|
||||
auto rlp = t.rlp(eth::WithoutSignature);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
cnote << t.sha3(eth::WithoutSignature);
|
||||
rlp = t.rlp(eth::WithSignature);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
cnote << t.sha3(eth::WithSignature);
|
||||
assert(t.sender() == p.address());
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// Test transaction.
|
||||
bytes tx = fromHex("88005401010101010101010101010101010101010101011f0de0b6b3a76400001ce8d4a5100080181c373130a009ba1f10285d4e659568bfcfec85067855c5a3c150100815dad4ef98fd37cf0593828c89db94bd6c64e210a32ef8956eaa81ea9307194996a3b879441f5d");
|
||||
cout << "TX: " << RLP(tx) << endl;
|
||||
|
||||
Transaction t2(tx);
|
||||
cout << "SENDER: " << hex << t2.sender() << dec << endl;
|
||||
|
||||
secp256k1_start();
|
||||
|
||||
Transaction t;
|
||||
t.nonce = 0;
|
||||
t.value = 1; // 1 wei.
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = toAddress(sha3("123"));
|
||||
|
||||
bytes sig64 = toBigEndian(t.vrs.r) + toBigEndian(t.vrs.s);
|
||||
cout << "SIG: " << sig64.size() << " " << toHex(sig64) << " " << t.vrs.v << endl;
|
||||
|
||||
auto msg = t.rlp(false);
|
||||
cout << "TX w/o SIG: " << RLP(msg) << endl;
|
||||
cout << "RLP(TX w/o SIG): " << toHex(t.rlp(false)) << endl;
|
||||
std::string hmsg = sha3(t.rlp(false), false);
|
||||
cout << "SHA256(RLP(TX w/o SIG)): 0x" << toHex(hmsg) << endl;
|
||||
|
||||
bytes privkey = sha3Bytes("123");
|
||||
|
||||
{
|
||||
bytes pubkey(65);
|
||||
int pubkeylen = 65;
|
||||
|
||||
int ret = secp256k1_ecdsa_seckey_verify(privkey.data());
|
||||
cout << "SEC: " << dec << ret << " " << toHex(privkey) << endl;
|
||||
|
||||
ret = secp256k1_ecdsa_pubkey_create(pubkey.data(), &pubkeylen, privkey.data(), 1);
|
||||
pubkey.resize(pubkeylen);
|
||||
int good = secp256k1_ecdsa_pubkey_verify(pubkey.data(), (int)pubkey.size());
|
||||
cout << "PUB: " << dec << ret << " " << pubkeylen << " " << toHex(pubkey) << (good ? " GOOD" : " BAD") << endl;
|
||||
}
|
||||
|
||||
// Test roundtrip...
|
||||
{
|
||||
bytes sig(64);
|
||||
u256 nonce = 0;
|
||||
int v = 0;
|
||||
cout << toHex(hmsg) << endl;
|
||||
cout << toHex(privkey) << endl;
|
||||
cout << hex << nonce << dec << endl;
|
||||
int ret = secp256k1_ecdsa_sign_compact((byte const*)hmsg.data(), (int)hmsg.size(), sig.data(), privkey.data(), (byte const*)&nonce, &v);
|
||||
cout << "MYSIG: " << dec << ret << " " << sig.size() << " " << toHex(sig) << " " << v << endl;
|
||||
|
||||
bytes pubkey(65);
|
||||
int pubkeylen = 65;
|
||||
ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), (int)hmsg.size(), (byte const*)sig.data(), pubkey.data(), &pubkeylen, 0, v);
|
||||
pubkey.resize(pubkeylen);
|
||||
cout << "MYREC: " << dec << ret << " " << pubkeylen << " " << toHex(pubkey) << endl;
|
||||
}
|
||||
|
||||
{
|
||||
bytes pubkey(65);
|
||||
int pubkeylen = 65;
|
||||
int ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), (int)hmsg.size(), (byte const*)sig64.data(), pubkey.data(), &pubkeylen, 0, (int)t.vrs.v - 27);
|
||||
pubkey.resize(pubkeylen);
|
||||
cout << "RECPUB: " << dec << ret << " " << pubkeylen << " " << toHex(pubkey) << endl;
|
||||
cout << "SENDER: " << hex << toAddress(dev::sha3(bytesConstRef(&pubkey).cropped(1))) << dec << endl;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file dagger.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Dashimoto test functions.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libethcore/ProofOfWork.h>
|
||||
#include <libethcore/EthashAux.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace js = json_spirit;
|
||||
|
||||
using dev::operator <<;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(DashimotoTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(basic_test)
|
||||
{
|
||||
string testPath = test::getTestPath();
|
||||
|
||||
testPath += "/PoWTests";
|
||||
|
||||
cnote << "Testing Proof of Work...";
|
||||
js::mValue v;
|
||||
string s = asString(contents(testPath + "/ethash_tests.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'ethash_tests.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
cnote << i.first;
|
||||
js::mObject& o = i.second.get_obj();
|
||||
vector<pair<string, string>> ss;
|
||||
BlockInfo header = BlockInfo::fromHeader(fromHex(o["header"].get_str()), CheckNothing);
|
||||
h256 headerHash(o["header_hash"].get_str());
|
||||
Nonce nonce(o["nonce"].get_str());
|
||||
BOOST_REQUIRE_EQUAL(headerHash, header.headerHash(WithoutNonce));
|
||||
BOOST_REQUIRE_EQUAL(nonce, header.nonce);
|
||||
|
||||
unsigned cacheSize(o["cache_size"].get_int());
|
||||
h256 cacheHash(o["cache_hash"].get_str());
|
||||
BOOST_REQUIRE_EQUAL(EthashAux::get()->params(header).cache_size, cacheSize);
|
||||
BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->light(header)->data()), cacheHash);
|
||||
|
||||
#if TEST_FULL
|
||||
unsigned fullSize(o["full_size"].get_int());
|
||||
h256 fullHash(o["full_hash"].get_str());
|
||||
BOOST_REQUIRE_EQUAL(EthashAux::get()->full(header).size(), fullSize);
|
||||
BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->full(header)), fullHash);
|
||||
#endif
|
||||
|
||||
h256 result(o["result"].get_str());
|
||||
Ethash::Result r = EthashAux::eval(header);
|
||||
BOOST_REQUIRE_EQUAL(r.value, result);
|
||||
BOOST_REQUIRE_EQUAL(r.mixHash, header.mixHash);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file fork.cpp
|
||||
* @author Marko Simovic <markobarko@gmail.com>
|
||||
* @date 2014
|
||||
* Tests for different forking behavior
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <libethereum/Client.h>
|
||||
#include <libethereum/CanonBlockChain.h>
|
||||
#include <libethereum/EthereumHost.h>
|
||||
#include "TestHelper.h"
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
// Disabled since tests shouldn't block. Need a short cut to avoid real mining.
|
||||
/*
|
||||
BOOST_AUTO_TEST_CASE(simple_chain_fork)
|
||||
{
|
||||
//start a client and mine a short chain
|
||||
Client c1("TestClient1", KeyPair::create().address(),
|
||||
(boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
mine(c1, 4);
|
||||
|
||||
//start another client and mine a longer chain
|
||||
Client c2("TestClient2", KeyPair::create().address(),
|
||||
(boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
mine(c2, 6);
|
||||
|
||||
//connect the two clients up to resolve chain
|
||||
c1.startNetwork(20000);
|
||||
c2.startNetwork(21000);
|
||||
c2.connect("127.0.0.1", 20000);
|
||||
|
||||
//mine an extra block to cement it
|
||||
mine(c1, 1);
|
||||
|
||||
//check the balances are where they should be
|
||||
//c1's chain should have been clobbered by c2
|
||||
BOOST_REQUIRE(c1.state().balance(c1.address()) == 0);
|
||||
BOOST_REQUIRE(c2.state().balance(c2.address()) > 0);
|
||||
}
|
||||
*/
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file genesis.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Trie test functions.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libethereum/CanonBlockChain.h>
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace js = json_spirit;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(BasicTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(emptySHA3Types)
|
||||
{
|
||||
h256 emptyListSHA3(fromHex("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"));
|
||||
BOOST_REQUIRE_EQUAL(emptyListSHA3, EmptyListSHA3);
|
||||
|
||||
h256 emptySHA3(fromHex("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"));
|
||||
BOOST_REQUIRE_EQUAL(emptySHA3, EmptySHA3);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(genesis_tests)
|
||||
{
|
||||
string testPath = test::getTestPath();
|
||||
testPath += "/BasicTests";
|
||||
|
||||
cnote << "Testing Genesis block...";
|
||||
js::mValue v;
|
||||
string s = asString(contents(testPath + "/genesishashestest.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'genesishashestest.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
|
||||
js::mObject o = v.get_obj();
|
||||
|
||||
BOOST_CHECK_EQUAL(CanonBlockChain::genesis().stateRoot, h256(o["genesis_state_root"].get_str()));
|
||||
BOOST_CHECK_EQUAL(toHex(CanonBlockChain::createGenesisBlock()), toHex(fromHex(o["genesis_rlp_hex"].get_str())));
|
||||
BOOST_CHECK_EQUAL(BlockInfo::headerHash(CanonBlockChain::createGenesisBlock()), h256(o["genesis_hash"].get_str()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file hexPrefix.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Main test functions.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libdevcrypto/TrieCommon.h>
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
namespace js = json_spirit;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(BasicTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hexPrefix_test)
|
||||
{
|
||||
|
||||
string testPath = test::getTestPath();
|
||||
testPath += "/BasicTests";
|
||||
|
||||
cnote << "Testing Hex-Prefix-Encode...";
|
||||
js::mValue v;
|
||||
string s = asString(contents(testPath + "/hexencodetest.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content from 'hexencodetest.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
js::mObject& o = i.second.get_obj();
|
||||
cnote << i.first;
|
||||
bytes v;
|
||||
for (auto& i: o["seq"].get_array())
|
||||
v.push_back((byte)i.get_int());
|
||||
auto e = hexPrefixEncode(v, o["term"].get_bool());
|
||||
BOOST_REQUIRE( ! o["out"].is_null() );
|
||||
BOOST_CHECK( o["out"].get_str() == toHex(e) );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
-334
@@ -1,334 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file jsonrpc.cpp
|
||||
* @author Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
// @debris disabled as tests fail with:
|
||||
// unknown location(0): fatal error in "jsonrpc_setMining": std::exception: Exception -32003 : Client connector error: : libcurl error: 28
|
||||
// /home/gav/Eth/cpp-ethereum/test/jsonrpc.cpp(169): last checkpoint
|
||||
#if ETH_JSONRPC && 0
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libethcore/CommonJS.h>
|
||||
#include <libwebthree/WebThree.h>
|
||||
#include <libweb3jsonrpc/WebThreeStubServer.h>
|
||||
#include <jsonrpccpp/server/connectors/httpserver.h>
|
||||
#include <jsonrpccpp/client/connectors/httpclient.h>
|
||||
#include <set>
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include "TestHelper.h"
|
||||
#include "webthreestubclient.h"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(jsonrpc)
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
namespace js = json_spirit;
|
||||
|
||||
WebThreeDirect* web3;
|
||||
unique_ptr<WebThreeStubServer> jsonrpcServer;
|
||||
unique_ptr<WebThreeStubClient> jsonrpcClient;
|
||||
|
||||
struct Setup
|
||||
{
|
||||
Setup()
|
||||
{
|
||||
static bool setup = false;
|
||||
if (setup)
|
||||
return;
|
||||
setup = true;
|
||||
|
||||
dev::p2p::NetworkPreferences nprefs(30303, std::string(), false);
|
||||
web3 = new WebThreeDirect("Ethereum(++) tests", "", true, {"eth", "shh"}, nprefs);
|
||||
|
||||
web3->setIdealPeerCount(5);
|
||||
web3->ethereum()->setForceMining(true);
|
||||
auto server = new jsonrpc::HttpServer(8080);
|
||||
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(*server, *web3, {}));
|
||||
jsonrpcServer->setIdentities({});
|
||||
jsonrpcServer->StartListening();
|
||||
auto client = new jsonrpc::HttpClient("http://localhost:8080");
|
||||
jsonrpcClient = unique_ptr<WebThreeStubClient>(new WebThreeStubClient(*client));
|
||||
}
|
||||
};
|
||||
|
||||
string fromAscii(string _s)
|
||||
{
|
||||
bytes b = asBytes(_s);
|
||||
return "0x" + toHex(b);
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(environment, Setup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_defaultBlock)
|
||||
{
|
||||
cnote << "Testing jsonrpc defaultBlock...";
|
||||
int defaultBlock = jsonrpcClient->eth_defaultBlock();
|
||||
BOOST_CHECK_EQUAL(defaultBlock, web3->ethereum()->getDefault());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_gasPrice)
|
||||
{
|
||||
cnote << "Testing jsonrpc gasPrice...";
|
||||
string gasPrice = jsonrpcClient->eth_gasPrice();
|
||||
BOOST_CHECK_EQUAL(gasPrice, toJS(10 * dev::eth::szabo));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_isListening)
|
||||
{
|
||||
cnote << "Testing jsonrpc isListening...";
|
||||
|
||||
web3->startNetwork();
|
||||
bool listeningOn = jsonrpcClient->eth_listening();
|
||||
BOOST_CHECK_EQUAL(listeningOn, web3->isNetworkStarted());
|
||||
|
||||
web3->stopNetwork();
|
||||
bool listeningOff = jsonrpcClient->eth_listening();
|
||||
BOOST_CHECK_EQUAL(listeningOff, web3->isNetworkStarted());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_isMining)
|
||||
{
|
||||
cnote << "Testing jsonrpc isMining...";
|
||||
|
||||
web3->ethereum()->startMining();
|
||||
bool miningOn = jsonrpcClient->eth_mining();
|
||||
BOOST_CHECK_EQUAL(miningOn, web3->ethereum()->isMining());
|
||||
|
||||
web3->ethereum()->stopMining();
|
||||
bool miningOff = jsonrpcClient->eth_mining();
|
||||
BOOST_CHECK_EQUAL(miningOff, web3->ethereum()->isMining());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_accounts)
|
||||
{
|
||||
cnote << "Testing jsonrpc accounts...";
|
||||
std::vector <dev::KeyPair> keys = {KeyPair::create(), KeyPair::create()};
|
||||
jsonrpcServer->setAccounts(keys);
|
||||
Json::Value k = jsonrpcClient->eth_accounts();
|
||||
jsonrpcServer->setAccounts({});
|
||||
BOOST_CHECK_EQUAL(k.isArray(), true);
|
||||
BOOST_CHECK_EQUAL(k.size(), keys.size());
|
||||
for (auto &i:k)
|
||||
{
|
||||
auto it = std::find_if(keys.begin(), keys.end(), [i](dev::KeyPair const& keyPair)
|
||||
{
|
||||
return jsToAddress(i.asString()) == keyPair.address();
|
||||
});
|
||||
BOOST_CHECK_EQUAL(it != keys.end(), true);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_number)
|
||||
{
|
||||
cnote << "Testing jsonrpc number2...";
|
||||
int number = jsonrpcClient->eth_number();
|
||||
BOOST_CHECK_EQUAL(number, web3->ethereum()->number() + 1);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
int numberAfter = jsonrpcClient->eth_number();
|
||||
BOOST_CHECK_EQUAL(number + 1, numberAfter);
|
||||
BOOST_CHECK_EQUAL(numberAfter, web3->ethereum()->number() + 1);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_peerCount)
|
||||
{
|
||||
cnote << "Testing jsonrpc peerCount...";
|
||||
int peerCount = jsonrpcClient->eth_peerCount();
|
||||
BOOST_CHECK_EQUAL(web3->peerCount(), peerCount);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_setListening)
|
||||
{
|
||||
cnote << "Testing jsonrpc setListening...";
|
||||
|
||||
jsonrpcClient->eth_setListening(true);
|
||||
BOOST_CHECK_EQUAL(web3->isNetworkStarted(), true);
|
||||
|
||||
jsonrpcClient->eth_setListening(false);
|
||||
BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_setMining)
|
||||
{
|
||||
cnote << "Testing jsonrpc setMining...";
|
||||
|
||||
jsonrpcClient->eth_setMining(true);
|
||||
BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), true);
|
||||
|
||||
jsonrpcClient->eth_setMining(false);
|
||||
BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_stateAt)
|
||||
{
|
||||
cnote << "Testing jsonrpc stateAt...";
|
||||
dev::KeyPair key = KeyPair::create();
|
||||
auto address = key.address();
|
||||
string stateAt = jsonrpcClient->eth_stateAt(toJS(address), "0");
|
||||
BOOST_CHECK_EQUAL(toJS(web3->ethereum()->stateAt(address, jsToU256("0"), 0)), stateAt);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_transact)
|
||||
{
|
||||
cnote << "Testing jsonrpc transact...";
|
||||
string coinbase = jsonrpcClient->eth_coinbase();
|
||||
BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address());
|
||||
|
||||
dev::KeyPair key = KeyPair::create();
|
||||
auto address = key.address();
|
||||
auto receiver = KeyPair::create();
|
||||
web3->ethereum()->setAddress(address);
|
||||
|
||||
coinbase = jsonrpcClient->eth_coinbase();
|
||||
BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address());
|
||||
BOOST_CHECK_EQUAL(jsToAddress(coinbase), address);
|
||||
|
||||
jsonrpcServer->setAccounts({key});
|
||||
auto balance = web3->ethereum()->balanceAt(address, 0);
|
||||
string balanceString = jsonrpcClient->eth_balanceAt(toJS(address));
|
||||
double countAt = jsonrpcClient->eth_countAt(toJS(address));
|
||||
|
||||
BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address));
|
||||
BOOST_CHECK_EQUAL(countAt, 0);
|
||||
BOOST_CHECK_EQUAL(toJS(balance), balanceString);
|
||||
BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "0");
|
||||
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
balance = web3->ethereum()->balanceAt(address, 0);
|
||||
balanceString = jsonrpcClient->eth_balanceAt(toJS(address));
|
||||
|
||||
BOOST_CHECK_EQUAL(toJS(balance), balanceString);
|
||||
BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "1500000000000000000");
|
||||
|
||||
auto txAmount = balance / 2u;
|
||||
auto gasPrice = 10 * dev::eth::szabo;
|
||||
auto gas = dev::eth::c_txGas;
|
||||
|
||||
Json::Value t;
|
||||
t["from"] = toJS(address);
|
||||
t["value"] = jsToDecimal(toJS(txAmount));
|
||||
t["to"] = toJS(receiver.address());
|
||||
t["data"] = toJS(bytes());
|
||||
t["gas"] = toJS(gas);
|
||||
t["gasPrice"] = toJS(gasPrice);
|
||||
|
||||
jsonrpcClient->eth_transact(t);
|
||||
jsonrpcServer->setAccounts({});
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
countAt = jsonrpcClient->eth_countAt(toJS(address));
|
||||
auto balance2 = web3->ethereum()->balanceAt(receiver.address());
|
||||
string balanceString2 = jsonrpcClient->eth_balanceAt(toJS(receiver.address()));
|
||||
|
||||
BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address));
|
||||
BOOST_CHECK_EQUAL(countAt, 1);
|
||||
BOOST_CHECK_EQUAL(toJS(balance2), balanceString2);
|
||||
BOOST_CHECK_EQUAL(jsToDecimal(balanceString2), "750000000000000000");
|
||||
BOOST_CHECK_EQUAL(txAmount, balance2);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(simple_contract)
|
||||
{
|
||||
cnote << "Testing jsonrpc contract...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
web3->ethereum()->setAddress(kp.address());
|
||||
jsonrpcServer->setAccounts({kp});
|
||||
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" function f(uint a) returns(uint d) { return a * 7; }\n"
|
||||
"}\n";
|
||||
|
||||
string compiled = jsonrpcClient->eth_solidity(sourceCode);
|
||||
|
||||
Json::Value create;
|
||||
create["code"] = compiled;
|
||||
string contractAddress = jsonrpcClient->eth_transact(create);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
Json::Value call;
|
||||
call["to"] = contractAddress;
|
||||
call["data"] = "0x00000000000000000000000000000000000000000000000000000000000000001";
|
||||
string result = jsonrpcClient->eth_call(call);
|
||||
BOOST_CHECK_EQUAL(result, "0x0000000000000000000000000000000000000000000000000000000000000007");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(contract_storage)
|
||||
{
|
||||
cnote << "Testing jsonrpc contract storage...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
web3->ethereum()->setAddress(kp.address());
|
||||
jsonrpcServer->setAccounts({kp});
|
||||
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
uint hello;
|
||||
function writeHello(uint value) returns(bool d){
|
||||
hello = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
string compiled = jsonrpcClient->eth_solidity(sourceCode);
|
||||
|
||||
Json::Value create;
|
||||
create["code"] = compiled;
|
||||
string contractAddress = jsonrpcClient->eth_transact(create);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
Json::Value transact;
|
||||
transact["to"] = contractAddress;
|
||||
transact["data"] = "0x00000000000000000000000000000000000000000000000000000000000000003";
|
||||
jsonrpcClient->eth_transact(transact);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
Json::Value storage = jsonrpcClient->eth_storageAt(contractAddress);
|
||||
BOOST_CHECK_EQUAL(storage.getMemberNames().size(), 1);
|
||||
// bracers are required, cause msvc couldnt handle this macro in for statement
|
||||
for (auto name: storage.getMemberNames())
|
||||
{
|
||||
BOOST_CHECK_EQUAL(storage[name].asString(), "0x03");
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(sha3)
|
||||
{
|
||||
cnote << "Testing jsonrpc sha3...";
|
||||
string testString = "multiply(uint256)";
|
||||
h256 expected = dev::sha3(testString);
|
||||
|
||||
auto hexValue = fromAscii(testString);
|
||||
string result = jsonrpcClient->web3_sha3(hexValue);
|
||||
BOOST_CHECK_EQUAL(toJS(expected), result);
|
||||
BOOST_CHECK_EQUAL("0xc6888fa159d67f77c2f3d7a402e199802766bd7e8d4d1ecd2274fc920265d56a", result);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file kademlia.cpp
|
||||
* @author Alex Leverington <nessence@gmail.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
@@ -17,22 +17,20 @@
|
||||
/**
|
||||
* @author Lefteris Karapetsas <lefteris@ethdev.com>
|
||||
* @date 2015
|
||||
* Unit tests for Assembly Items from evmcore/Assembly.h
|
||||
* Unit tests for Assembly Items from evmasm/Assembly.h
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libevmcore/SourceLocation.h>
|
||||
#include <libevmasm/SourceLocation.h>
|
||||
#include <libevmasm/Assembly.h>
|
||||
#include <libsolidity/Scanner.h>
|
||||
#include <libsolidity/Parser.h>
|
||||
#include <libsolidity/NameAndTypeResolver.h>
|
||||
#include <libsolidity/Compiler.h>
|
||||
#include <libsolidity/AST.h>
|
||||
#include <libevmcore/Assembly.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev::eth;
|
||||
@@ -120,5 +118,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
|
||||
aux_source_directory(. SRCS)
|
||||
|
||||
add_sources(${SRCS})
|
||||
@@ -19,9 +19,8 @@
|
||||
* @date 2014
|
||||
* Unit tests for the solidity compiler JSON Interface output.
|
||||
*/
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
#include <libsolidity/CompilerStack.h>
|
||||
#include <json/json.h>
|
||||
#include <libdevcore/Exceptions.h>
|
||||
@@ -496,10 +495,38 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter)
|
||||
checkInterface(sourceCode, interface);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(constructor_abi)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function test(uint param1, test param2, bool param3) {}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* interface = R"([
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "param1",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "param2",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "param3",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"type": "constructor"
|
||||
}
|
||||
])";
|
||||
checkInterface(sourceCode, interface);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -20,8 +20,6 @@
|
||||
* Unit tests for the solidity compiler.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -193,5 +191,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -21,13 +21,11 @@
|
||||
* Unit tests for the solidity expression compiler, testing the behaviour of the code.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcrypto/SHA3.h>
|
||||
#include <test/solidityExecutionFramework.h>
|
||||
#include <test/libsolidity/solidityExecutionFramework.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -302,9 +300,54 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr)
|
||||
testSolidityAgainstCppOnRange("f(uint256)", for_loop_simple_init_expr_cpp, 0, 5);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(for_loop_break_continue)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint n) returns (uint r)
|
||||
{
|
||||
uint i = 1;
|
||||
uint k = 0;
|
||||
for (i *= 5; k < n; i *= 7)
|
||||
{
|
||||
k++;
|
||||
i += 4;
|
||||
if (n % 3 == 0)
|
||||
break;
|
||||
i += 9;
|
||||
if (n % 2 == 0)
|
||||
continue;
|
||||
i += 19;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto breakContinue = [](u256 const& n) -> u256
|
||||
{
|
||||
u256 i = 1;
|
||||
u256 k = 0;
|
||||
for (i *= 5; k < n; i *= 7)
|
||||
{
|
||||
k++;
|
||||
i += 4;
|
||||
if (n % 3 == 0)
|
||||
break;
|
||||
i += 9;
|
||||
if (n % 2 == 0)
|
||||
continue;
|
||||
i += 19;
|
||||
}
|
||||
return i;
|
||||
};
|
||||
|
||||
testSolidityAgainstCppOnRange("f(uint256)", breakContinue, 0, 10);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(calling_other_functions)
|
||||
{
|
||||
// note that the index of a function is its index in the sorted sequence of functions
|
||||
char const* sourceCode = "contract collatz {\n"
|
||||
" function run(uint x) returns(uint y) {\n"
|
||||
" while ((y = x) > 1) {\n"
|
||||
@@ -1149,26 +1192,6 @@ BOOST_AUTO_TEST_CASE(now)
|
||||
BOOST_CHECK(callContractFunction("someInfo()") == encodeArgs(true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_types)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" function a(bool selector) returns (uint b) {\n"
|
||||
" var f = fun1;\n"
|
||||
" if (selector) f = fun2;\n"
|
||||
" return f(9);\n"
|
||||
" }\n"
|
||||
" function fun1(uint x) returns (uint b) {\n"
|
||||
" return 11;\n"
|
||||
" }\n"
|
||||
" function fun2(uint x) returns (uint b) {\n"
|
||||
" return 12;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("a(bool)", false) == encodeArgs(11));
|
||||
BOOST_CHECK(callContractFunction("a(bool)", true) == encodeArgs(12));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(type_conversions_cleanup)
|
||||
{
|
||||
// 22-byte integer converted to a contract (i.e. address, 20 bytes), converted to a 32 byte
|
||||
@@ -1499,7 +1522,7 @@ BOOST_AUTO_TEST_CASE(ripemd)
|
||||
{
|
||||
h256 ret;
|
||||
dev::ripemd160(dev::ref(toBigEndian(_input)), bytesRef(&ret[0], 32));
|
||||
return u256(ret) >> (256 - 160);
|
||||
return u256(ret);
|
||||
};
|
||||
testSolidityAgainstCpp("a(bytes32)", f, u256(4));
|
||||
testSolidityAgainstCpp("a(bytes32)", f, u256(5));
|
||||
@@ -1814,7 +1837,7 @@ BOOST_AUTO_TEST_CASE(gas_for_builtin)
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("test(uint256)", 500) == bytes());
|
||||
BOOST_CHECK(callContractFunction("test(uint256)", 800) == encodeArgs(u256("0x8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"), true));
|
||||
BOOST_CHECK(callContractFunction("test(uint256)", 800) == encodeArgs(u256("0x8eb208f7e05d987a9b044a8e98c6b087f15a0bfc000000000000000000000000"), true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(value_complex)
|
||||
@@ -2363,6 +2386,49 @@ BOOST_AUTO_TEST_CASE(event_lots_of_data)
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::sha3(string("Deposit(address,bytes32,uint256,bool)")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_really_lots_of_data)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract ClientReceipt {
|
||||
event Deposit(uint fixeda, bytes dynx, uint fixedb);
|
||||
function deposit() {
|
||||
Deposit(10, msg.data, 15);
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
callContractFunction("deposit()");
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data == encodeArgs(10, 4, 15) + FixedHash<4>(dev::sha3("deposit()")).asBytes());
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::sha3(string("Deposit(uint256,bytes,uint256)")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_really_lots_of_data_from_storage)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract ClientReceipt {
|
||||
bytes x;
|
||||
event Deposit(uint fixeda, bytes dynx, uint fixedb);
|
||||
function deposit() {
|
||||
x.length = 3;
|
||||
x[0] = "A";
|
||||
x[1] = "B";
|
||||
x[2] = "C";
|
||||
Deposit(10, x, 15);
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
callContractFunction("deposit()");
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data == encodeArgs(10, 3, 15) + asBytes("ABC"));
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::sha3(string("Deposit(uint256,bytes,uint256)")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
@@ -2451,6 +2517,24 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_string_literals)
|
||||
bytes{0x66, 0x6f, 0x6f})));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(sha3_with_bytes)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract c {
|
||||
bytes data;
|
||||
function foo() returns (bool)
|
||||
{
|
||||
data.length = 3;
|
||||
data[0] = "f";
|
||||
data[1] = "o";
|
||||
data[2] = "o";
|
||||
return sha3(data) == sha3("foo");
|
||||
}
|
||||
})";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("foo()") == encodeArgs(true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(generic_call)
|
||||
{
|
||||
char const* sourceCode = R"**(
|
||||
@@ -3343,6 +3427,26 @@ BOOST_AUTO_TEST_CASE(bytes_index_access)
|
||||
BOOST_CHECK(callContractFunction("storageWrite()") == encodeArgs(0x193));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bytes_delete_element)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract c {
|
||||
bytes data;
|
||||
function test1() external returns (bool) {
|
||||
data.length = 100;
|
||||
for (uint i = 0; i < data.length; i++)
|
||||
data[i] = byte(i);
|
||||
delete data[94];
|
||||
delete data[96];
|
||||
delete data[98];
|
||||
return data[94] == 0 && data[95] == 95 && data[96] == 0 && data[97] == 97;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("test1()") == encodeArgs(true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(array_copy_calldata_storage)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
@@ -3676,10 +3780,138 @@ BOOST_AUTO_TEST_CASE(packed_storage_structs_with_bytes0)
|
||||
BOOST_CHECK(callContractFunction("test()") == encodeArgs(true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_function_call_resolve_to_first)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint k) returns(uint d) { return k; }
|
||||
function f(uint a, uint b) returns(uint d) { return a + b; }
|
||||
function g() returns(uint d) { return f(3); }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs(3));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_function_call_resolve_to_second)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint a, uint b) returns(uint d) { return a + b; }
|
||||
function f(uint k) returns(uint d) { return k; }
|
||||
function g() returns(uint d) { return f(3, 7); }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs(10));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_function_call_with_if_else)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint a, uint b) returns(uint d) { return a + b; }
|
||||
function f(uint k) returns(uint d) { return k; }
|
||||
function g(bool flag) returns(uint d) {
|
||||
if (flag)
|
||||
return f(3);
|
||||
else
|
||||
return f(3, 7);
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("g(bool)", true) == encodeArgs(3));
|
||||
BOOST_CHECK(callContractFunction("g(bool)", false) == encodeArgs(10));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(derived_overload_base_function_direct)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract B { function f() returns(uint) { return 10; } }
|
||||
contract C is B {
|
||||
function f(uint i) returns(uint) { return 2 * i; }
|
||||
function g() returns(uint) { return f(1); }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs(2));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(derived_overload_base_function_indirect)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract A { function f(uint a) returns(uint) { return 2 * a; } }
|
||||
contract B { function f() returns(uint) { return 10; } }
|
||||
contract C is A, B {
|
||||
function g() returns(uint) { return f(); }
|
||||
function h() returns(uint) { return f(1); }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs(10));
|
||||
BOOST_CHECK(callContractFunction("h()") == encodeArgs(2));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(super_overload)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract A { function f(uint a) returns(uint) { return 2 * a; } }
|
||||
contract B { function f(bool b) returns(uint) { return 10; } }
|
||||
contract C is A, B {
|
||||
function g() returns(uint) { return super.f(true); }
|
||||
function h() returns(uint) { return super.f(1); }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs(10));
|
||||
BOOST_CHECK(callContractFunction("h()") == encodeArgs(2));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(packed_storage_signed)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
int8 a;
|
||||
uint8 b;
|
||||
int8 c;
|
||||
uint8 d;
|
||||
function test() returns (uint x1, uint x2, uint x3, uint x4) {
|
||||
a = -2;
|
||||
b = -uint8(a) * 2;
|
||||
c = a * int8(120) * int8(121);
|
||||
x1 = uint(a);
|
||||
x2 = b;
|
||||
x3 = uint(c);
|
||||
x4 = d;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK( callContractFunction("test()") == encodeArgs(u256(-2), u256(4), u256(-112), u256(0)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(external_types_in_calls)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C1 { C1 public bla; function C1(C1 x) { bla = x; } }
|
||||
contract C {
|
||||
function test() returns (C1 x, C1 y) {
|
||||
C1 c = new C1(C1(9));
|
||||
x = c.bla();
|
||||
y = this.t1(C1(7));
|
||||
}
|
||||
function t1(C1 a) returns (C1) { return a; }
|
||||
function() returns (C1) { return C1(9); }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
BOOST_CHECK(callContractFunction("test()") == encodeArgs(u256(9), u256(7)));
|
||||
BOOST_CHECK(callContractFunction("nonexisting") == encodeArgs(u256(9)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -20,8 +20,6 @@
|
||||
* Unit tests for the solidity expression compiler.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <libdevcore/Log.h>
|
||||
@@ -31,7 +29,7 @@
|
||||
#include <libsolidity/CompilerContext.h>
|
||||
#include <libsolidity/ExpressionCompiler.h>
|
||||
#include <libsolidity/AST.h>
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -52,14 +50,12 @@ public:
|
||||
FirstExpressionExtractor(ASTNode& _node): m_expression(nullptr) { _node.accept(*this); }
|
||||
Expression* getExpression() const { return m_expression; }
|
||||
private:
|
||||
virtual bool visit(Expression& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(Assignment& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(BinaryOperation& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(FunctionCall& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(MemberAccess& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(IndexAccess& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(PrimaryExpression& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(Identifier& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(ElementaryTypeNameExpression& _expression) override { return checkExpression(_expression); }
|
||||
virtual bool visit(Literal& _expression) override { return checkExpression(_expression); }
|
||||
@@ -80,7 +76,9 @@ Declaration const& resolveDeclaration(
|
||||
// bracers are required, cause msvc couldnt handle this macro in for statement
|
||||
for (string const& namePart: _namespacedName)
|
||||
{
|
||||
BOOST_REQUIRE(declaration = _resolver.resolveName(namePart, declaration));
|
||||
auto declarations = _resolver.resolveName(namePart, declaration);
|
||||
BOOST_REQUIRE(!declarations.empty());
|
||||
BOOST_REQUIRE(declaration = *declarations.begin());
|
||||
}
|
||||
BOOST_REQUIRE(declaration);
|
||||
return *declaration;
|
||||
@@ -491,5 +489,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -20,9 +20,7 @@
|
||||
* Unit tests for generating source interfaces for Solidity contracts.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
#include <libsolidity/CompilerStack.h>
|
||||
#include <libsolidity/AST.h>
|
||||
|
||||
@@ -80,7 +78,7 @@ BOOST_AUTO_TEST_CASE(single_function)
|
||||
"}\n");
|
||||
BOOST_REQUIRE_EQUAL(1, contract.getDefinedFunctions().size());
|
||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()),
|
||||
"function f(uint256 a)returns(uint256 d){}");
|
||||
"function f(uint256 a)returns(uint256 d);");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(single_constant_function)
|
||||
@@ -89,7 +87,7 @@ BOOST_AUTO_TEST_CASE(single_constant_function)
|
||||
"contract test { function f(uint a) constant returns(bytes1 x) { 1==2; } }");
|
||||
BOOST_REQUIRE_EQUAL(1, contract.getDefinedFunctions().size());
|
||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()),
|
||||
"function f(uint256 a)constant returns(bytes1 x){}");
|
||||
"function f(uint256 a)constant returns(bytes1 x);");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiple_functions)
|
||||
@@ -99,8 +97,8 @@ BOOST_AUTO_TEST_CASE(multiple_functions)
|
||||
" function g(uint b) returns(uint e) { return b * 8; }\n"
|
||||
"}\n";
|
||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||
set<string> expectation({"function f(uint256 a)returns(uint256 d){}",
|
||||
"function g(uint256 b)returns(uint256 e){}"});
|
||||
set<string> expectation({"function f(uint256 a)returns(uint256 d);",
|
||||
"function g(uint256 b)returns(uint256 e);"});
|
||||
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
||||
BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
||||
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
||||
@@ -137,8 +135,8 @@ BOOST_AUTO_TEST_CASE(inheritance)
|
||||
" event derivedEvent(uint indexed evtArgDerived); \n"
|
||||
" }";
|
||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
|
||||
"function derivedFunction(bytes32 p)returns(bytes32 i){}"});
|
||||
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i);",
|
||||
"function derivedFunction(bytes32 p)returns(bytes32 i);"});
|
||||
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
||||
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
||||
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
||||
@@ -149,5 +147,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+137
-11
@@ -20,8 +20,6 @@
|
||||
* Unit tests for the name and type resolution of the solidity parser.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <libdevcore/Log.h>
|
||||
@@ -31,7 +29,7 @@
|
||||
#include <libsolidity/NameAndTypeResolver.h>
|
||||
#include <libsolidity/Exceptions.h>
|
||||
#include <libsolidity/GlobalContext.h>
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -407,6 +405,39 @@ BOOST_AUTO_TEST_CASE(create_abstract_contract)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_optional)
|
||||
{
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
char const* text = R"(
|
||||
contract BaseBase { function BaseBase(uint j); }
|
||||
contract base is BaseBase { function foo(); }
|
||||
contract derived is base {
|
||||
function derived(uint i) BaseBase(i){}
|
||||
function foo() {}
|
||||
}
|
||||
)";
|
||||
ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(text), "Parsing and name resolving failed");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_not_provided)
|
||||
{
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
char const* text = R"(
|
||||
contract BaseBase { function BaseBase(uint j); }
|
||||
contract base is BaseBase { function foo(); }
|
||||
contract derived is base {
|
||||
function derived(uint i) {}
|
||||
function foo() {}
|
||||
}
|
||||
)";
|
||||
ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name resolving failed");
|
||||
std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes();
|
||||
BOOST_CHECK_EQUAL(nodes.size(), 3);
|
||||
ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get());
|
||||
BOOST_CHECK(derived);
|
||||
BOOST_CHECK(!derived->isFullyImplemented());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(redeclare_implemented_abstract_function_as_abstract)
|
||||
{
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
@@ -592,23 +623,23 @@ BOOST_AUTO_TEST_CASE(cyclic_inheritance)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(illegal_override_direct)
|
||||
BOOST_AUTO_TEST_CASE(legal_override_direct)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract B { function f() {} }
|
||||
contract C is B { function f(uint i) {} }
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(illegal_override_indirect)
|
||||
BOOST_AUTO_TEST_CASE(legal_override_indirect)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract A { function f(uint a) {} }
|
||||
contract B { function f() {} }
|
||||
contract C is A, B { }
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(illegal_override_visibility)
|
||||
@@ -665,7 +696,7 @@ BOOST_AUTO_TEST_CASE(missing_base_constructor_arguments)
|
||||
contract A { function A(uint a) { } }
|
||||
contract B is A { }
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(base_constructor_arguments_override)
|
||||
@@ -674,7 +705,7 @@ BOOST_AUTO_TEST_CASE(base_constructor_arguments_override)
|
||||
contract A { function A(uint a) { } }
|
||||
contract B is A { }
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(implicit_derived_to_base_conversion)
|
||||
@@ -1623,6 +1654,103 @@ BOOST_AUTO_TEST_CASE(bytes0_array)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_function_cannot_resolve)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f() returns(uint) { return 1; }
|
||||
function f(uint a) returns(uint) { return a; }
|
||||
function g() returns(uint) { return f(3, 5); }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ambiguous_overloaded_function)
|
||||
{
|
||||
// literal 1 can be both converted to uint and uint8, so the call is ambiguous.
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint8 a) returns(uint) { return a; }
|
||||
function f(uint a) returns(uint) { return 2*a; }
|
||||
function g() returns(uint) { return f(1); }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(assignment_of_nonoverloaded_function)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint a) returns(uint) { return 2 * a; }
|
||||
function g() returns(uint) { var x = f; return x(7); }
|
||||
}
|
||||
)";
|
||||
ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(sourceCode), "Type resolving failed");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(assignment_of_overloaded_function)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f() returns(uint) { return 1; }
|
||||
function f(uint a) returns(uint) { return 2 * a; }
|
||||
function g() returns(uint) { var x = f; return x(7); }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(external_types_clash)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract base {
|
||||
enum a { X }
|
||||
function f(a) { }
|
||||
}
|
||||
contract test is base {
|
||||
function f(uint8 a) { }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(override_changes_return_types)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract base {
|
||||
function f(uint a) returns (uint) { }
|
||||
}
|
||||
contract test is base {
|
||||
function f(uint a) returns (uint8) { }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiple_constructors)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function test(uint a) { }
|
||||
function test() {}
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), DeclarationError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(equal_overload)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function test(uint a) returns (uint b) { }
|
||||
function test(uint a) external {}
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), DeclarationError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(uninitialized_var)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
@@ -1638,5 +1766,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -20,9 +20,7 @@
|
||||
* Unit tests for the solidity compiler JSON Interface output.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
#include <json/json.h>
|
||||
#include <libsolidity/CompilerStack.h>
|
||||
#include <libsolidity/Exceptions.h>
|
||||
@@ -539,5 +537,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -20,16 +20,15 @@
|
||||
* Tests for the Solidity optimizer.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <memory>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <test/solidityExecutionFramework.h>
|
||||
#include <libevmcore/CommonSubexpressionEliminator.h>
|
||||
#include <libevmcore/ControlFlowGraph.h>
|
||||
#include <libevmcore/Assembly.h>
|
||||
#include <test/libsolidity/solidityExecutionFramework.h>
|
||||
#include <libevmasm/CommonSubexpressionEliminator.h>
|
||||
#include <libevmasm/ControlFlowGraph.h>
|
||||
#include <libevmasm/Assembly.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev::eth;
|
||||
@@ -86,9 +85,20 @@ public:
|
||||
|
||||
AssemblyItems getCSE(AssemblyItems const& _input)
|
||||
{
|
||||
// add dummy locations to each item so that we can check that they are not deleted
|
||||
AssemblyItems input = _input;
|
||||
for (AssemblyItem& item: input)
|
||||
item.setLocation(SourceLocation(1, 3, make_shared<string>("")));
|
||||
|
||||
eth::CommonSubexpressionEliminator cse;
|
||||
BOOST_REQUIRE(cse.feedItems(_input.begin(), _input.end()) == _input.end());
|
||||
return cse.getOptimizedItems();
|
||||
BOOST_REQUIRE(cse.feedItems(input.begin(), input.end()) == input.end());
|
||||
AssemblyItems output = cse.getOptimizedItems();
|
||||
|
||||
for (AssemblyItem const& item: output)
|
||||
{
|
||||
BOOST_CHECK(item == Instruction::POP || !item.getLocation().isEmpty());
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
void checkCSE(AssemblyItems const& _input, AssemblyItems const& _expectation)
|
||||
@@ -816,5 +826,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -20,15 +20,13 @@
|
||||
* Unit tests for the solidity parser.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libsolidity/Scanner.h>
|
||||
#include <libsolidity/Parser.h>
|
||||
#include <libsolidity/Exceptions.h>
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -136,6 +134,31 @@ BOOST_AUTO_TEST_CASE(missing_argument_in_named_args)
|
||||
BOOST_CHECK_THROW(parseText(text), ParserError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(two_exact_functions)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
function fun(uint a) returns(uint r) { return a; }
|
||||
function fun(uint a) returns(uint r) { return a; }
|
||||
}
|
||||
)";
|
||||
// with support of overloaded functions, during parsing,
|
||||
// we can't determine whether they match exactly, however
|
||||
// it will throw DeclarationError in following stage.
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_functions)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
function fun(uint a) returns(uint r) { return a; }
|
||||
function fun(uint a, uint b) returns(uint r) { return a + b; }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
|
||||
{
|
||||
ASTPointer<ContractDefinition> contract;
|
||||
@@ -855,5 +878,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -20,8 +20,6 @@
|
||||
* Unit tests for the solidity scanner.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <libsolidity/Scanner.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@@ -288,5 +286,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
} // end namespaces
|
||||
|
||||
#endif
|
||||
@@ -20,8 +20,6 @@
|
||||
* Unit tests for the type system of Solidity.
|
||||
*/
|
||||
|
||||
#if ETH_SOLIDITY
|
||||
|
||||
#include <libsolidity/Types.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@@ -93,5 +91,3 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include "TestHelper.h"
|
||||
#include "../TestHelper.h"
|
||||
#include <libethereum/State.h>
|
||||
#include <libethereum/Executive.h>
|
||||
#include <libsolidity/CompilerStack.h>
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file main.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Main test functions.
|
||||
*/
|
||||
|
||||
#include <libdevcrypto/TrieDB.h>
|
||||
#include "TrieHash.h"
|
||||
#include "MemTrie.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
int trieTest();
|
||||
int rlpTest();
|
||||
int daggerTest();
|
||||
int cryptoTest();
|
||||
int stateTest();
|
||||
int vmTest();
|
||||
int hexPrefixTest();
|
||||
int peerTest(int argc, char** argv);
|
||||
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libethcore/BlockInfo.h>
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
//BOOST_AUTO_TEST_CASE(basic_tests)
|
||||
//{
|
||||
/* RLPStream s;
|
||||
BlockInfo::genesis().streamRLP(s, false);
|
||||
std::cout << RLP(s.out()) << std::endl;
|
||||
std::cout << toHex(s.out()) << std::endl;
|
||||
std::cout << sha3(s.out()) << std::endl;*/
|
||||
|
||||
// int r = 0;
|
||||
// r += daggerTest();
|
||||
// r += stateTest();
|
||||
// r += peerTest(argc, argv);
|
||||
// BOOST_REQUIRE(!r);
|
||||
//}
|
||||
|
||||
-127
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file natspec.cpp
|
||||
* @author Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
#if ETH_GUI
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libnatspec/NatspecExpressionEvaluator.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(natspec)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(natspec_eval_function_exists)
|
||||
{
|
||||
// given
|
||||
NatspecExpressionEvaluator e;
|
||||
// when
|
||||
string result = e.evalExpression("`typeof natspec.evaluateExpression`").toStdString();
|
||||
// then
|
||||
BOOST_CHECK_EQUAL(result, "function");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(natspec_js_eval)
|
||||
{
|
||||
// given
|
||||
NatspecExpressionEvaluator e;
|
||||
// when
|
||||
string result = e.evalExpression("`1 + 2`").toStdString();
|
||||
// then
|
||||
BOOST_CHECK_EQUAL(result, "3");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(natspec_create_custom_function)
|
||||
{
|
||||
// given
|
||||
NatspecExpressionEvaluator e;
|
||||
// when
|
||||
auto x = e.evalExpression("`test = function (x) { return x + 'ok'; }`"); // ommit var, make it global
|
||||
string result = e.evalExpression("`test(5)`").toStdString();
|
||||
string result2 = e.evalExpression("`typeof test`").toStdString();
|
||||
// then
|
||||
BOOST_CHECK_EQUAL(result, "5ok");
|
||||
BOOST_CHECK_EQUAL(result2, "function");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(natspec_js_eval_separated_expressions)
|
||||
{
|
||||
// given
|
||||
NatspecExpressionEvaluator e;
|
||||
// when
|
||||
string result = e.evalExpression("`x = 1` + `y = 2` will be equal `x + y`").toStdString();
|
||||
// then
|
||||
BOOST_CHECK_EQUAL(result, "1 + 2 will be equal 3");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(natspec_js_eval_input_params)
|
||||
{
|
||||
// given
|
||||
char const* abi = R"([
|
||||
{
|
||||
"name": "multiply",
|
||||
"constant": false,
|
||||
"type": "function",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "a",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}
|
||||
]
|
||||
}
|
||||
])";
|
||||
|
||||
char const* transaction = R"({
|
||||
"jsonrpc": "2.0",
|
||||
"method": "eth_call",
|
||||
"params": [{
|
||||
"to": "0x8521742d3f456bd237e312d6e30724960f72517a",
|
||||
"data": "0xc6888fa10000000000000000000000000000000000000000000000000000000000000004"
|
||||
}],
|
||||
"id": 6
|
||||
})";
|
||||
|
||||
NatspecExpressionEvaluator e(abi, transaction , "multiply");
|
||||
// when
|
||||
string result = e.evalExpression("Will multiply `a` by 7 and return `a * 7`.").toStdString();
|
||||
// then
|
||||
BOOST_CHECK_EQUAL(result, "Will multiply 4 by 7 and return 28.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(natspec_js_eval_error)
|
||||
{
|
||||
// given
|
||||
NatspecExpressionEvaluator e;
|
||||
// when
|
||||
string result = e.evalExpression("`test(`").toStdString();
|
||||
// then
|
||||
BOOST_CHECK_EQUAL(result, "Natspec evaluation failed, wrong input params");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
#endif
|
||||
@@ -1,339 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file net.cpp
|
||||
* @author Alex Leverington <nessence@gmail.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <libdevcore/Worker.h>
|
||||
#include <libdevcore/Assertions.h>
|
||||
#include <libdevcrypto/Common.h>
|
||||
#include <libp2p/UDP.h>
|
||||
#include <libp2p/NodeTable.h>
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::p2p;
|
||||
namespace ba = boost::asio;
|
||||
namespace bi = ba::ip;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(net)
|
||||
|
||||
/**
|
||||
* Only used for testing. Not useful beyond tests.
|
||||
*/
|
||||
class TestHost: public Worker
|
||||
{
|
||||
public:
|
||||
TestHost(): Worker("test",0), m_io() {};
|
||||
virtual ~TestHost() { m_io.stop(); stopWorking(); }
|
||||
void start() { startWorking(); }
|
||||
void doWork() { m_io.run(); }
|
||||
void doneWorking() { m_io.reset(); m_io.poll(); m_io.reset(); }
|
||||
|
||||
protected:
|
||||
ba::io_service m_io;
|
||||
};
|
||||
|
||||
struct TestNodeTable: public NodeTable
|
||||
{
|
||||
/// Constructor
|
||||
TestNodeTable(ba::io_service& _io, KeyPair _alias, bi::address const& _addr, uint16_t _port = 30300): NodeTable(_io, _alias, _addr, _port) {}
|
||||
|
||||
static std::vector<std::pair<KeyPair,unsigned>> createTestNodes(unsigned _count)
|
||||
{
|
||||
std::vector<std::pair<KeyPair,unsigned>> ret;
|
||||
asserts(_count < 1000);
|
||||
static uint16_t s_basePort = 30500;
|
||||
|
||||
ret.clear();
|
||||
for (unsigned i = 0; i < _count; i++)
|
||||
{
|
||||
KeyPair k = KeyPair::create();
|
||||
ret.push_back(make_pair(k,s_basePort+i));
|
||||
}
|
||||
|
||||
return std::move(ret);
|
||||
}
|
||||
|
||||
void pingTestNodes(std::vector<std::pair<KeyPair,unsigned>> const& _testNodes)
|
||||
{
|
||||
bi::address ourIp = bi::address::from_string("127.0.0.1");
|
||||
for (auto& n: _testNodes)
|
||||
{
|
||||
ping(bi::udp::endpoint(ourIp, n.second));
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
void populateTestNodes(std::vector<std::pair<KeyPair,unsigned>> const& _testNodes, size_t _count = 0)
|
||||
{
|
||||
if (!_count)
|
||||
_count = _testNodes.size();
|
||||
|
||||
bi::address ourIp = bi::address::from_string("127.0.0.1");
|
||||
for (auto& n: _testNodes)
|
||||
if (_count--)
|
||||
{
|
||||
// manually add node for test
|
||||
{
|
||||
Guard ln(x_nodes);
|
||||
shared_ptr<NodeEntry> node(new NodeEntry(m_node, n.first.pub(), NodeIPEndpoint(bi::udp::endpoint(ourIp, n.second), bi::tcp::endpoint(ourIp, n.second))));
|
||||
node->pending = false;
|
||||
m_nodes[node->id] = node;
|
||||
}
|
||||
noteActiveNode(n.first.pub(), bi::udp::endpoint(ourIp, n.second));
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
Guard l(x_state);
|
||||
for (auto& n: m_state) n.nodes.clear();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Only used for testing. Not useful beyond tests.
|
||||
*/
|
||||
struct TestNodeTableHost: public TestHost
|
||||
{
|
||||
TestNodeTableHost(unsigned _count = 8): m_alias(KeyPair::create()), nodeTable(new TestNodeTable(m_io, m_alias, bi::address::from_string("127.0.0.1"))), testNodes(TestNodeTable::createTestNodes(_count)) {};
|
||||
~TestNodeTableHost() { m_io.stop(); stopWorking(); }
|
||||
|
||||
void setup() { for (auto n: testNodes) nodeTables.push_back(make_shared<TestNodeTable>(m_io,n.first, bi::address::from_string("127.0.0.1"),n.second)); }
|
||||
|
||||
void pingAll() { for (auto& t: nodeTables) t->pingTestNodes(testNodes); }
|
||||
|
||||
void populateAll(size_t _count = 0) { for (auto& t: nodeTables) t->populateTestNodes(testNodes, _count); }
|
||||
|
||||
void populate(size_t _count = 0) { nodeTable->populateTestNodes(testNodes, _count); }
|
||||
|
||||
KeyPair m_alias;
|
||||
shared_ptr<TestNodeTable> nodeTable;
|
||||
std::vector<std::pair<KeyPair,unsigned>> testNodes; // keypair and port
|
||||
std::vector<shared_ptr<TestNodeTable>> nodeTables;
|
||||
};
|
||||
|
||||
class TestUDPSocket: UDPSocketEvents, public TestHost
|
||||
{
|
||||
public:
|
||||
TestUDPSocket(): m_socket(new UDPSocket<TestUDPSocket, 1024>(m_io, *this, 30300)) {}
|
||||
|
||||
void onDisconnected(UDPSocketFace*) {};
|
||||
void onReceived(UDPSocketFace*, bi::udp::endpoint const&, bytesConstRef _packet) { if (_packet.toString() == "AAAA") success = true; }
|
||||
|
||||
shared_ptr<UDPSocket<TestUDPSocket, 1024>> m_socket;
|
||||
|
||||
bool success = false;
|
||||
};
|
||||
|
||||
BOOST_AUTO_TEST_CASE(requestTimeout)
|
||||
{
|
||||
using TimePoint = std::chrono::steady_clock::time_point;
|
||||
using RequestTimeout = std::pair<NodeId, TimePoint>;
|
||||
|
||||
std::chrono::milliseconds timeout(300);
|
||||
std::list<RequestTimeout> timeouts;
|
||||
|
||||
NodeId nodeA(sha3("a"));
|
||||
NodeId nodeB(sha3("b"));
|
||||
timeouts.push_back(make_pair(nodeA, chrono::steady_clock::now()));
|
||||
this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
timeouts.push_back(make_pair(nodeB, chrono::steady_clock::now()));
|
||||
this_thread::sleep_for(std::chrono::milliseconds(210));
|
||||
|
||||
bool nodeAtriggered = false;
|
||||
bool nodeBtriggered = false;
|
||||
timeouts.remove_if([&](RequestTimeout const& t)
|
||||
{
|
||||
auto now = chrono::steady_clock::now();
|
||||
auto diff = now - t.second;
|
||||
if (t.first == nodeA && diff < timeout)
|
||||
nodeAtriggered = true;
|
||||
if (t.first == nodeB && diff < timeout)
|
||||
nodeBtriggered = true;
|
||||
return (t.first == nodeA || t.first == nodeB);
|
||||
});
|
||||
|
||||
BOOST_REQUIRE(nodeAtriggered == false);
|
||||
BOOST_REQUIRE(nodeBtriggered == true);
|
||||
BOOST_REQUIRE(timeouts.size() == 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(isIPAddressType)
|
||||
{
|
||||
string wildcard = "0.0.0.0";
|
||||
BOOST_REQUIRE(bi::address::from_string(wildcard).is_unspecified());
|
||||
|
||||
string empty = "";
|
||||
BOOST_REQUIRE_THROW(bi::address::from_string(empty).is_unspecified(), std::exception);
|
||||
|
||||
string publicAddress192 = "192.169.0.0";
|
||||
BOOST_REQUIRE(isPublicAddress(publicAddress192));
|
||||
BOOST_REQUIRE(!isPrivateAddress(publicAddress192));
|
||||
BOOST_REQUIRE(!isLocalHostAddress(publicAddress192));
|
||||
|
||||
string publicAddress172 = "172.32.0.0";
|
||||
BOOST_REQUIRE(isPublicAddress(publicAddress172));
|
||||
BOOST_REQUIRE(!isPrivateAddress(publicAddress172));
|
||||
BOOST_REQUIRE(!isLocalHostAddress(publicAddress172));
|
||||
|
||||
string privateAddress192 = "192.168.1.0";
|
||||
BOOST_REQUIRE(isPrivateAddress(privateAddress192));
|
||||
BOOST_REQUIRE(!isPublicAddress(privateAddress192));
|
||||
BOOST_REQUIRE(!isLocalHostAddress(privateAddress192));
|
||||
|
||||
string privateAddress172 = "172.16.0.0";
|
||||
BOOST_REQUIRE(isPrivateAddress(privateAddress172));
|
||||
BOOST_REQUIRE(!isPublicAddress(privateAddress172));
|
||||
BOOST_REQUIRE(!isLocalHostAddress(privateAddress172));
|
||||
|
||||
string privateAddress10 = "10.0.0.0";
|
||||
BOOST_REQUIRE(isPrivateAddress(privateAddress10));
|
||||
BOOST_REQUIRE(!isPublicAddress(privateAddress10));
|
||||
BOOST_REQUIRE(!isLocalHostAddress(privateAddress10));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(v2PingNodePacket)
|
||||
{
|
||||
// test old versino of pingNode packet w/new
|
||||
RLPStream s;
|
||||
s.appendList(3); s << "1.1.1.1" << 30303 << std::chrono::duration_cast<std::chrono::seconds>((std::chrono::system_clock::now() + chrono::seconds(60)).time_since_epoch()).count();
|
||||
|
||||
PingNode p((bi::udp::endpoint()));
|
||||
BOOST_REQUIRE_NO_THROW(p = PingNode::fromBytesConstRef(bi::udp::endpoint(), bytesConstRef(&s.out())));
|
||||
BOOST_REQUIRE(p.version == 2);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(neighboursPacketLength)
|
||||
{
|
||||
KeyPair k = KeyPair::create();
|
||||
std::vector<std::pair<KeyPair,unsigned>> testNodes(TestNodeTable::createTestNodes(16));
|
||||
bi::udp::endpoint to(boost::asio::ip::address::from_string("127.0.0.1"), 30000);
|
||||
|
||||
// hash(32), signature(65), overhead: packet(2), type(1), nodeList(2), ts(9),
|
||||
static unsigned const nlimit = (1280 - 111) / 87;
|
||||
for (unsigned offset = 0; offset < testNodes.size(); offset += nlimit)
|
||||
{
|
||||
Neighbours out(to);
|
||||
|
||||
auto limit = nlimit ? std::min(testNodes.size(), (size_t)(offset + nlimit)) : testNodes.size();
|
||||
for (auto i = offset; i < limit; i++)
|
||||
{
|
||||
Neighbours::Node node;
|
||||
node.ipAddress = boost::asio::ip::address::from_string("200.200.200.200").to_string();
|
||||
node.port = testNodes[i].second;
|
||||
node.node = testNodes[i].first.pub();
|
||||
out.nodes.push_back(node);
|
||||
}
|
||||
|
||||
out.sign(k.sec());
|
||||
BOOST_REQUIRE_LE(out.data.size(), 1280);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_neighbours_packet)
|
||||
{
|
||||
KeyPair k = KeyPair::create();
|
||||
std::vector<std::pair<KeyPair,unsigned>> testNodes(TestNodeTable::createTestNodes(16));
|
||||
bi::udp::endpoint to(boost::asio::ip::address::from_string("127.0.0.1"), 30000);
|
||||
|
||||
Neighbours out(to);
|
||||
for (auto n: testNodes)
|
||||
{
|
||||
Neighbours::Node node;
|
||||
node.ipAddress = boost::asio::ip::address::from_string("127.0.0.1").to_string();
|
||||
node.port = n.second;
|
||||
node.node = n.first.pub();
|
||||
out.nodes.push_back(node);
|
||||
}
|
||||
out.sign(k.sec());
|
||||
|
||||
bytesConstRef packet(out.data.data(), out.data.size());
|
||||
bytesConstRef rlpBytes(packet.cropped(h256::size + Signature::size + 1));
|
||||
Neighbours in = Neighbours::fromBytesConstRef(to, rlpBytes);
|
||||
int count = 0;
|
||||
for (auto n: in.nodes)
|
||||
{
|
||||
BOOST_REQUIRE_EQUAL(testNodes[count].second, n.port);
|
||||
BOOST_REQUIRE_EQUAL(testNodes[count].first.pub(), n.node);
|
||||
BOOST_REQUIRE_EQUAL(sha3(testNodes[count].first.pub()), sha3(n.node));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_findnode_neighbours)
|
||||
{
|
||||
// Executing findNode should result in a list which is serialized
|
||||
// into Neighbours packet. Neighbours packet should then be deserialized
|
||||
// into the same list of nearest nodes.
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_windows_template)
|
||||
{
|
||||
bi::udp::endpoint ep;
|
||||
PingNode p(ep);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(kademlia)
|
||||
{
|
||||
// Not yet a 'real' test.
|
||||
TestNodeTableHost node(8);
|
||||
node.start();
|
||||
node.nodeTable->discover(); // ideally, joining with empty node table logs warning we can check for
|
||||
node.setup();
|
||||
node.populate();
|
||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||
|
||||
node.populateAll();
|
||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||
|
||||
auto nodes = node.nodeTable->nodes();
|
||||
nodes.sort();
|
||||
|
||||
node.nodeTable->reset();
|
||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||
|
||||
node.populate(1);
|
||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||
|
||||
node.nodeTable->discover();
|
||||
this_thread::sleep_for(chrono::milliseconds(2000));
|
||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||
|
||||
BOOST_REQUIRE_EQUAL(node.nodeTable->count(), 8);
|
||||
|
||||
auto netNodes = node.nodeTable->nodes();
|
||||
netNodes.sort();
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_udp_once)
|
||||
{
|
||||
UDPDatagram d(bi::udp::endpoint(boost::asio::ip::address::from_string("127.0.0.1"), 30300), bytes({65,65,65,65}));
|
||||
TestUDPSocket a; a.m_socket->connect(); a.start();
|
||||
a.m_socket->send(d);
|
||||
this_thread::sleep_for(chrono::seconds(1));
|
||||
BOOST_REQUIRE_EQUAL(true, a.success);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file peer.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Peer Network test functions.
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <libp2p/Host.h>
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::p2p;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(p2p)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(host)
|
||||
{
|
||||
auto oldLogVerbosity = g_logVerbosity;
|
||||
g_logVerbosity = 10;
|
||||
|
||||
NetworkPreferences host1prefs("127.0.0.1", 30301, false);
|
||||
NetworkPreferences host2prefs("127.0.0.1", 30302, false);
|
||||
|
||||
Host host1("Test", host1prefs);
|
||||
host1.start();
|
||||
|
||||
Host host2("Test", host2prefs);
|
||||
auto node2 = host2.id();
|
||||
host2.start();
|
||||
|
||||
host1.addNode(node2, bi::address::from_string("127.0.0.1"), host2prefs.listenPort, host2prefs.listenPort);
|
||||
|
||||
this_thread::sleep_for(chrono::seconds(3));
|
||||
|
||||
auto host1peerCount = host1.peerCount();
|
||||
auto host2peerCount = host2.peerCount();
|
||||
BOOST_REQUIRE_EQUAL(host1peerCount, 1);
|
||||
BOOST_REQUIRE_EQUAL(host2peerCount, 1);
|
||||
|
||||
g_logVerbosity = oldLogVerbosity;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(networkConfig)
|
||||
{
|
||||
Host save("Test", NetworkPreferences(false));
|
||||
bytes store(save.saveNetwork());
|
||||
|
||||
Host restore("Test", NetworkPreferences(false), bytesConstRef(&store));
|
||||
BOOST_REQUIRE(save.id() == restore.id());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(save_nodes)
|
||||
{
|
||||
std::list<Host*> hosts;
|
||||
for (auto i:{0,1,2,3,4,5})
|
||||
{
|
||||
Host* h = new Host("Test", NetworkPreferences("127.0.0.1", 30300 + i, false));
|
||||
h->setIdealPeerCount(10);
|
||||
// starting host is required so listenport is available
|
||||
h->start();
|
||||
while (!h->haveNetwork())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
hosts.push_back(h);
|
||||
}
|
||||
|
||||
Host& host = *hosts.front();
|
||||
for (auto const& h: hosts)
|
||||
host.addNode(h->id(), bi::address::from_string("127.0.0.1"), h->listenPort(), h->listenPort());
|
||||
|
||||
Host& host2 = *hosts.back();
|
||||
for (auto const& h: hosts)
|
||||
host2.addNode(h->id(), bi::address::from_string("127.0.0.1"), h->listenPort(), h->listenPort());
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(2000));
|
||||
bytes firstHostNetwork(host.saveNetwork());
|
||||
bytes secondHostNetwork(host.saveNetwork());
|
||||
|
||||
BOOST_REQUIRE_EQUAL(sha3(firstHostNetwork), sha3(secondHostNetwork));
|
||||
|
||||
BOOST_CHECK_EQUAL(host.peerCount(), 5);
|
||||
BOOST_CHECK_EQUAL(host2.peerCount(), 5);
|
||||
|
||||
RLP r(firstHostNetwork);
|
||||
BOOST_REQUIRE(r.itemCount() == 3);
|
||||
BOOST_REQUIRE(r[0].toInt<unsigned>() == dev::p2p::c_protocolVersion);
|
||||
BOOST_REQUIRE_EQUAL(r[1].toBytes().size(), 32); // secret
|
||||
BOOST_REQUIRE_EQUAL(r[2].itemCount(), 5);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
int peerTest(int argc, char** argv)
|
||||
{
|
||||
Public remoteAlias;
|
||||
short listenPort = 30303;
|
||||
string remoteHost;
|
||||
short remotePort = 30303;
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
string arg = argv[i];
|
||||
if (arg == "-l" && i + 1 < argc)
|
||||
listenPort = (short)atoi(argv[++i]);
|
||||
else if (arg == "-r" && i + 1 < argc)
|
||||
remoteHost = argv[++i];
|
||||
else if (arg == "-p" && i + 1 < argc)
|
||||
remotePort = (short)atoi(argv[++i]);
|
||||
else if (arg == "-ra" && i + 1 < argc)
|
||||
remoteAlias = Public(dev::fromHex(argv[++i]));
|
||||
else
|
||||
remoteHost = argv[i];
|
||||
}
|
||||
|
||||
Host ph("Test", NetworkPreferences(listenPort));
|
||||
|
||||
if (!remoteHost.empty() && !remoteAlias)
|
||||
ph.addNode(remoteAlias, bi::address::from_string(remoteHost), remotePort, remotePort);
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(200));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"randomVMtest": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "random",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "10000"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file rlp.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* RLP test functions.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libdevcore/RLP.h>
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <algorithm>
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
namespace js = json_spirit;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
static void buildRLP(js::mValue& _v, RLPStream& _rlp)
|
||||
{
|
||||
if (_v.type() == js::array_type)
|
||||
{
|
||||
RLPStream s;
|
||||
for (auto& i: _v.get_array())
|
||||
buildRLP(i, s);
|
||||
_rlp.appendList(s.out());
|
||||
}
|
||||
else if (_v.type() == js::int_type)
|
||||
_rlp.append(_v.get_uint64());
|
||||
else if (_v.type() == js::str_type)
|
||||
{
|
||||
auto s = _v.get_str();
|
||||
if (s.size() && s[0] == '#')
|
||||
_rlp.append(bigint(s.substr(1)));
|
||||
else
|
||||
_rlp.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
static void getRLPTestCases(js::mValue& v)
|
||||
{
|
||||
string testPath = getTestPath();
|
||||
testPath += "/BasicTests";
|
||||
|
||||
string s = asString(contents(testPath + "/rlptest.json"));
|
||||
BOOST_REQUIRE_MESSAGE( s.length() > 0,
|
||||
"Contents of 'rlptest.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
}
|
||||
|
||||
static void checkRLPTestCase(js::mObject& o)
|
||||
{
|
||||
BOOST_REQUIRE( o.count("in") > 0 );
|
||||
BOOST_REQUIRE( o.count("out") > 0 );
|
||||
BOOST_REQUIRE(!o["out"].is_null());
|
||||
}
|
||||
|
||||
static void checkRLPAgainstJson(js::mValue& v, RLP& u)
|
||||
{
|
||||
if ( v.type() == js::str_type )
|
||||
{
|
||||
const std::string& expectedText = v.get_str();
|
||||
if ( !expectedText.empty() && expectedText.front() == '#' )
|
||||
{
|
||||
// Deal with bigint instead of a raw string
|
||||
std::string bigIntStr = expectedText.substr(1,expectedText.length()-1);
|
||||
std::stringstream bintStream(bigIntStr);
|
||||
bigint val;
|
||||
bintStream >> val;
|
||||
BOOST_CHECK( !u.isList() );
|
||||
BOOST_CHECK( !u.isNull() );
|
||||
BOOST_CHECK( u ); // operator bool()
|
||||
BOOST_CHECK(u == val);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_CHECK( !u.isList() );
|
||||
BOOST_CHECK( !u.isNull() );
|
||||
BOOST_CHECK( u.isData() );
|
||||
BOOST_CHECK( u );
|
||||
BOOST_CHECK( u.size() == expectedText.length() );
|
||||
BOOST_CHECK(u == expectedText);
|
||||
}
|
||||
}
|
||||
else if ( v.type() == js::int_type )
|
||||
{
|
||||
const int expectedValue = v.get_int();
|
||||
BOOST_CHECK( u.isInt() );
|
||||
BOOST_CHECK( !u.isList() );
|
||||
BOOST_CHECK( !u.isNull() );
|
||||
BOOST_CHECK( u ); // operator bool()
|
||||
BOOST_CHECK(u == expectedValue);
|
||||
}
|
||||
else if ( v.type() == js::array_type )
|
||||
{
|
||||
BOOST_CHECK( u.isList() );
|
||||
BOOST_CHECK( !u.isInt() );
|
||||
BOOST_CHECK( !u.isData() );
|
||||
js::mArray& arr = v.get_array();
|
||||
BOOST_CHECK( u.itemCount() == arr.size() );
|
||||
unsigned i;
|
||||
for( i = 0; i < arr.size(); i++ )
|
||||
{
|
||||
RLP item = u[i];
|
||||
checkRLPAgainstJson(arr[i], item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ERROR("Invalid Javascript object!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(BasicTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(rlp_encoding_test)
|
||||
{
|
||||
cnote << "Testing RLP Encoding...";
|
||||
js::mValue v;
|
||||
dev::test::getRLPTestCases(v);
|
||||
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
js::mObject& o = i.second.get_obj();
|
||||
cnote << i.first;
|
||||
dev::test::checkRLPTestCase(o);
|
||||
|
||||
RLPStream s;
|
||||
dev::test::buildRLP(o["in"], s);
|
||||
|
||||
std::string expectedText(o["out"].get_str());
|
||||
std::transform(expectedText.begin(), expectedText.end(), expectedText.begin(), ::tolower );
|
||||
|
||||
const std::string& computedText = toHex(s.out());
|
||||
|
||||
std::stringstream msg;
|
||||
msg << "Encoding Failed: expected: " << expectedText << std::endl;
|
||||
msg << " But Computed: " << computedText;
|
||||
|
||||
BOOST_CHECK_MESSAGE(
|
||||
expectedText == computedText,
|
||||
msg.str()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(rlp_decoding_test)
|
||||
{
|
||||
cnote << "Testing RLP decoding...";
|
||||
// Uses the same test cases as encoding but in reverse.
|
||||
// We read into the string of hex values, convert to bytes,
|
||||
// and then compare the output structure to the json of the
|
||||
// input object.
|
||||
js::mValue v;
|
||||
dev::test::getRLPTestCases(v);
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
js::mObject& o = i.second.get_obj();
|
||||
cnote << i.first;
|
||||
dev::test::checkRLPTestCase(o);
|
||||
|
||||
js::mValue& inputData = o["in"];
|
||||
bytes payloadToDecode = fromHex(o["out"].get_str());
|
||||
|
||||
RLP payload(payloadToDecode);
|
||||
|
||||
dev::test::checkRLPAgainstJson(inputData, payload);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,455 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file crypto.cpp
|
||||
* @author Alex Leverington <nessence@gmail.com>
|
||||
* @date 2015
|
||||
* RLPx test functions.
|
||||
*/
|
||||
|
||||
#include <random>
|
||||
#include <secp256k1/secp256k1.h>
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/RLP.h>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libethereum/Transaction.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <libdevcrypto/SHA3.h>
|
||||
#include <libdevcrypto/ECDHE.h>
|
||||
#include <libdevcrypto/CryptoPP.h>
|
||||
#include <libp2p/RLPxHandshake.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::crypto;
|
||||
using namespace CryptoPP;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(rlpx)
|
||||
|
||||
static Secp256k1 s_secp256k1;
|
||||
static CryptoPP::AutoSeededRandomPool s_rng;
|
||||
static CryptoPP::OID s_curveOID(CryptoPP::ASN1::secp256k1());
|
||||
static CryptoPP::DL_GroupParameters_EC<CryptoPP::ECP> s_params(s_curveOID);
|
||||
static CryptoPP::DL_GroupParameters_EC<CryptoPP::ECP>::EllipticCurve s_curve(s_params.GetCurve());
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_secrets_cpp_vectors)
|
||||
{
|
||||
KeyPair init(Secret(sha3("initiator")));
|
||||
KeyPair initR(Secret(sha3("initiator-random")));
|
||||
h256 initNonce(sha3("initiator-nonce"));
|
||||
|
||||
KeyPair recv(Secret(sha3("remote-recv")));
|
||||
KeyPair recvR(Secret(sha3("remote-recv-random")));
|
||||
h256 recvNonce(sha3("remote-recv-nonce"));
|
||||
|
||||
bytes authCipher(fromHex(""));
|
||||
bytes ackCipher(fromHex(""));
|
||||
|
||||
CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption m_frameEnc;
|
||||
CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption m_frameDec;
|
||||
CryptoPP::ECB_Mode<CryptoPP::AES>::Encryption m_macEnc;
|
||||
CryptoPP::SHA3_256 m_egressMac;
|
||||
CryptoPP::SHA3_256 m_ingressMac;
|
||||
|
||||
// when originated is true, agreement is with init secrets
|
||||
// when originated is true, remoteNonce = recvNonce
|
||||
// when originated is true, nonce = initNonce
|
||||
bool originated = true;
|
||||
auto remoteNonce = recvNonce;
|
||||
auto nonce = initNonce;
|
||||
bytes keyMaterialBytes(64);
|
||||
bytesRef keyMaterial(&keyMaterialBytes);
|
||||
|
||||
// shared-secret = sha3(ecdhe-shared-secret || sha3(nonce || initiator-nonce))
|
||||
Secret ephemeralShared;
|
||||
s_secp256k1.agree(initR.sec(), recvR.pub(), ephemeralShared);
|
||||
Secret expected(fromHex("20d82c1092f351dc217bd66fa183e801234af14ead40423b6ee25112201c6e5a"));
|
||||
BOOST_REQUIRE(expected == ephemeralShared);
|
||||
|
||||
ephemeralShared.ref().copyTo(keyMaterial.cropped(0, h256::size));
|
||||
h512 nonceMaterial;
|
||||
h256 const& leftNonce = originated ? remoteNonce : nonce;
|
||||
h256 const& rightNonce = originated ? nonce : remoteNonce;
|
||||
leftNonce.ref().copyTo(nonceMaterial.ref().cropped(0, h256::size));
|
||||
rightNonce.ref().copyTo(nonceMaterial.ref().cropped(h256::size, h256::size));
|
||||
auto outRef(keyMaterial.cropped(h256::size, h256::size));
|
||||
sha3(nonceMaterial.ref(), outRef); // output h(nonces)
|
||||
|
||||
// test that keyMaterial = ecdhe-shared-secret || sha3(nonce || initiator-nonce)
|
||||
{
|
||||
BOOST_REQUIRE(ephemeralShared == *(Secret*)keyMaterialBytes.data());
|
||||
|
||||
SHA3_256 ctx;
|
||||
ctx.Update(leftNonce.data(), h256::size);
|
||||
ctx.Update(rightNonce.data(), h256::size);
|
||||
bytes expected(32);
|
||||
ctx.Final(expected.data());
|
||||
bytes given(32);
|
||||
outRef.copyTo(&given);
|
||||
BOOST_REQUIRE(expected == given);
|
||||
}
|
||||
bytes preImage(keyMaterialBytes);
|
||||
|
||||
// shared-secret <- sha3(ecdhe-shared-secret || sha3(nonce || initiator-nonce))
|
||||
// keyMaterial = ecdhe-shared-secret || shared-secret
|
||||
sha3(keyMaterial, outRef);
|
||||
bytes sharedSecret(32);
|
||||
outRef.copyTo(&sharedSecret);
|
||||
BOOST_REQUIRE(sharedSecret == fromHex("b65319ce56e00f3be75c4d0da92b5957d5583ca25eeeedac8e29b6dfc8b1ddf7"));
|
||||
|
||||
// test that keyMaterial = ecdhe-shared-secret || shared-secret
|
||||
{
|
||||
BOOST_REQUIRE(ephemeralShared == *(Secret*)keyMaterialBytes.data());
|
||||
|
||||
SHA3_256 ctx;
|
||||
ctx.Update(preImage.data(), preImage.size());
|
||||
bytes expected(32);
|
||||
ctx.Final(expected.data());
|
||||
bytes test(32);
|
||||
outRef.copyTo(&test);
|
||||
BOOST_REQUIRE(expected == test);
|
||||
}
|
||||
|
||||
// token: sha3(outRef)
|
||||
bytes token(32);
|
||||
sha3(outRef, bytesRef(&token));
|
||||
BOOST_REQUIRE(token == fromHex("db41fe0180f372983cf19fca7ee890f7fb5481079d44683d2c027be9e71bbca2"));
|
||||
|
||||
// aes-secret = sha3(ecdhe-shared-secret || shared-secret)
|
||||
sha3(keyMaterial, outRef); // output aes-secret
|
||||
bytes aesSecret(32);
|
||||
outRef.copyTo(&aesSecret);
|
||||
BOOST_REQUIRE(aesSecret == fromHex("12347b4784bcb4e74b84637940482852fe25d78e328cf5c6f7a396bf96cc20bb"));
|
||||
m_frameEnc.SetKeyWithIV(outRef.data(), h128::size, h128().data());
|
||||
m_frameDec.SetKeyWithIV(outRef.data(), h128::size, h128().data());
|
||||
|
||||
// mac-secret = sha3(ecdhe-shared-secret || aes-secret)
|
||||
sha3(keyMaterial, outRef); // output mac-secret
|
||||
bytes macSecret(32);
|
||||
outRef.copyTo(&macSecret);
|
||||
BOOST_REQUIRE(macSecret == fromHex("2ec149072353d54437422837c886b0538a9206e6c559f6b4a55f65a866867723"));
|
||||
m_macEnc.SetKey(outRef.data(), h128::size);
|
||||
|
||||
// Initiator egress-mac: sha3(mac-secret^recipient-nonce || auth-sent-init)
|
||||
// ingress-mac: sha3(mac-secret^initiator-nonce || auth-recvd-ack)
|
||||
// Recipient egress-mac: sha3(mac-secret^initiator-nonce || auth-sent-ack)
|
||||
// ingress-mac: sha3(mac-secret^recipient-nonce || auth-recvd-init)
|
||||
|
||||
(*(h256*)outRef.data() ^ remoteNonce).ref().copyTo(keyMaterial);
|
||||
bytes const& egressCipher = originated ? authCipher : ackCipher;
|
||||
keyMaterialBytes.resize(h256::size + egressCipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
bytesConstRef(&egressCipher).copyTo(keyMaterial.cropped(h256::size, egressCipher.size()));
|
||||
m_egressMac.Update(keyMaterial.data(), keyMaterial.size());
|
||||
|
||||
{
|
||||
bytes egressMac;
|
||||
SHA3_256 h(m_egressMac);
|
||||
bytes digest(16);
|
||||
h.TruncatedFinal(digest.data(), 16);
|
||||
BOOST_REQUIRE(digest == fromHex("23e5e8efb6e3765ecae1fca9160b18df"));
|
||||
}
|
||||
|
||||
// recover mac-secret by re-xoring remoteNonce
|
||||
(*(h256*)keyMaterial.data() ^ remoteNonce ^ nonce).ref().copyTo(keyMaterial);
|
||||
bytes const& ingressCipher = originated ? ackCipher : authCipher;
|
||||
keyMaterialBytes.resize(h256::size + ingressCipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
bytesConstRef(&ingressCipher).copyTo(keyMaterial.cropped(h256::size, ingressCipher.size()));
|
||||
m_ingressMac.Update(keyMaterial.data(), keyMaterial.size());
|
||||
|
||||
{
|
||||
bytes ingressMac;
|
||||
SHA3_256 h(m_ingressMac);
|
||||
bytes digest(16);
|
||||
h.TruncatedFinal(digest.data(), 16);
|
||||
BOOST_REQUIRE(digest == fromHex("ceed64135852064cbdde86e7ea05e8f5"));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_secrets_from_go)
|
||||
{
|
||||
KeyPair init(Secret(fromHex("0x5e173f6ac3c669587538e7727cf19b782a4f2fda07c1eaa662c593e5e85e3051")));
|
||||
KeyPair initR(Secret(fromHex("0x19c2185f4f40634926ebed3af09070ca9e029f2edd5fae6253074896205f5f6c")));
|
||||
h256 initNonce(fromHex("0xcd26fecb93657d1cd9e9eaf4f8be720b56dd1d39f190c4e1c6b7ec66f077bb11"));
|
||||
|
||||
KeyPair recv(Secret(fromHex("0xc45f950382d542169ea207959ee0220ec1491755abe405cd7498d6b16adb6df8")));
|
||||
KeyPair recvR(Secret(fromHex("0xd25688cf0ab10afa1a0e2dba7853ed5f1e5bf1c631757ed4e103b593ff3f5620")));
|
||||
h256 recvNonce(fromHex("0xf37ec61d84cea03dcc5e8385db93248584e8af4b4d1c832d8c7453c0089687a7"));
|
||||
|
||||
bytes authCipher(fromHex("0x04a0274c5951e32132e7f088c9bdfdc76c9d91f0dc6078e848f8e3361193dbdc43b94351ea3d89e4ff33ddcefbc80070498824857f499656c4f79bbd97b6c51a514251d69fd1785ef8764bd1d262a883f780964cce6a14ff206daf1206aa073a2d35ce2697ebf3514225bef186631b2fd2316a4b7bcdefec8d75a1025ba2c5404a34e7795e1dd4bc01c6113ece07b0df13b69d3ba654a36e35e69ff9d482d88d2f0228e7d96fe11dccbb465a1831c7d4ad3a026924b182fc2bdfe016a6944312021da5cc459713b13b86a686cf34d6fe6615020e4acf26bf0d5b7579ba813e7723eb95b3cef9942f01a58bd61baee7c9bdd438956b426a4ffe238e61746a8c93d5e10680617c82e48d706ac4953f5e1c4c4f7d013c87d34a06626f498f34576dc017fdd3d581e83cfd26cf125b6d2bda1f1d56"));
|
||||
bytes ackCipher(fromHex("0x049934a7b2d7f9af8fd9db941d9da281ac9381b5740e1f64f7092f3588d4f87f5ce55191a6653e5e80c1c5dd538169aa123e70dc6ffc5af1827e546c0e958e42dad355bcc1fcb9cdf2cf47ff524d2ad98cbf275e661bf4cf00960e74b5956b799771334f426df007350b46049adb21a6e78ab1408d5e6ccde6fb5e69f0f4c92bb9c725c02f99fa72b9cdc8dd53cff089e0e73317f61cc5abf6152513cb7d833f09d2851603919bf0fbe44d79a09245c6e8338eb502083dc84b846f2fee1cc310d2cc8b1b9334728f97220bb799376233e113"));
|
||||
|
||||
bytes authPlainExpected(fromHex("0x884c36f7ae6b406637c1f61b2f57e1d2cab813d24c6559aaf843c3f48962f32f46662c066d39669b7b2e3ba14781477417600e7728399278b1b5d801a519aa570034fdb5419558137e0d44cd13d319afe5629eeccb47fd9dfe55cc6089426e46cc762dd8a0636e07a54b31169eba0c7a20a1ac1ef68596f1f283b5c676bae4064abfcce24799d09f67e392632d3ffdc12e3d6430dcb0ea19c318343ffa7aae74d4cd26fecb93657d1cd9e9eaf4f8be720b56dd1d39f190c4e1c6b7ec66f077bb1100"));
|
||||
bytes ackPlainExpected(fromHex("0x802b052f8b066640bba94a4fc39d63815c377fced6fcb84d27f791c9921ddf3e9bf0108e298f490812847109cbd778fae393e80323fd643209841a3b7f110397f37ec61d84cea03dcc5e8385db93248584e8af4b4d1c832d8c7453c0089687a700"));
|
||||
|
||||
bytes authPlain = authCipher;
|
||||
BOOST_REQUIRE(s_secp256k1.decryptECIES(recv.sec(), authPlain));
|
||||
bytes ackPlain = ackCipher;
|
||||
BOOST_REQUIRE(s_secp256k1.decryptECIES(init.sec(), ackPlain));
|
||||
|
||||
CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption m_frameEnc;
|
||||
CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption m_frameDec;
|
||||
CryptoPP::ECB_Mode<CryptoPP::AES>::Encryption m_macEnc;
|
||||
CryptoPP::SHA3_256 m_egressMac;
|
||||
CryptoPP::SHA3_256 m_ingressMac;
|
||||
|
||||
// when originated is true, agreement is with init secrets
|
||||
// when originated is true, remoteNonce = recvNonce
|
||||
// when originated is true, nonce = initNonce
|
||||
bool originated = true;
|
||||
auto remoteNonce = recvNonce;
|
||||
auto nonce = initNonce;
|
||||
bytes keyMaterialBytes(64);
|
||||
bytesRef keyMaterial(&keyMaterialBytes);
|
||||
|
||||
// shared-secret = sha3(ecdhe-shared-secret || sha3(nonce || initiator-nonce))
|
||||
Secret ephemeralShared;
|
||||
s_secp256k1.agree(initR.sec(), recvR.pub(), ephemeralShared);
|
||||
Secret expected(fromHex("0xe3f407f83fc012470c26a93fdff534100f2c6f736439ce0ca90e9914f7d1c381"));
|
||||
BOOST_REQUIRE(expected == ephemeralShared);
|
||||
|
||||
ephemeralShared.ref().copyTo(keyMaterial.cropped(0, h256::size));
|
||||
h512 nonceMaterial;
|
||||
h256 const& leftNonce = originated ? remoteNonce : nonce;
|
||||
h256 const& rightNonce = originated ? nonce : remoteNonce;
|
||||
leftNonce.ref().copyTo(nonceMaterial.ref().cropped(0, h256::size));
|
||||
rightNonce.ref().copyTo(nonceMaterial.ref().cropped(h256::size, h256::size));
|
||||
auto outRef(keyMaterial.cropped(h256::size, h256::size));
|
||||
sha3(nonceMaterial.ref(), outRef); // output h(nonces)
|
||||
|
||||
// test that keyMaterial = ecdhe-shared-secret || sha3(nonce || initiator-nonce)
|
||||
{
|
||||
BOOST_REQUIRE(ephemeralShared == *(Secret*)keyMaterialBytes.data());
|
||||
|
||||
SHA3_256 ctx;
|
||||
ctx.Update(leftNonce.data(), h256::size);
|
||||
ctx.Update(rightNonce.data(), h256::size);
|
||||
bytes expected(32);
|
||||
ctx.Final(expected.data());
|
||||
bytes given(32);
|
||||
outRef.copyTo(&given);
|
||||
BOOST_REQUIRE(expected == given);
|
||||
}
|
||||
bytes preImage(keyMaterialBytes);
|
||||
|
||||
// shared-secret <- sha3(ecdhe-shared-secret || sha3(nonce || initiator-nonce))
|
||||
// keyMaterial = ecdhe-shared-secret || shared-secret
|
||||
sha3(keyMaterial, outRef);
|
||||
|
||||
// test that keyMaterial = ecdhe-shared-secret || shared-secret
|
||||
{
|
||||
BOOST_REQUIRE(ephemeralShared == *(Secret*)keyMaterialBytes.data());
|
||||
|
||||
SHA3_256 ctx;
|
||||
ctx.Update(preImage.data(), preImage.size());
|
||||
bytes expected(32);
|
||||
ctx.Final(expected.data());
|
||||
bytes test(32);
|
||||
outRef.copyTo(&test);
|
||||
BOOST_REQUIRE(expected == test);
|
||||
}
|
||||
|
||||
// token: sha3(outRef)
|
||||
bytes token(32);
|
||||
sha3(outRef, bytesRef(&token));
|
||||
BOOST_REQUIRE(token == fromHex("0x3f9ec2592d1554852b1f54d228f042ed0a9310ea86d038dc2b401ba8cd7fdac4"));
|
||||
|
||||
// aes-secret = sha3(ecdhe-shared-secret || shared-secret)
|
||||
sha3(keyMaterial, outRef); // output aes-secret
|
||||
bytes aesSecret(32);
|
||||
outRef.copyTo(&aesSecret);
|
||||
BOOST_REQUIRE(aesSecret == fromHex("0xc0458fa97a5230830e05f4f20b7c755c1d4e54b1ce5cf43260bb191eef4e418d"));
|
||||
m_frameEnc.SetKeyWithIV(outRef.data(), h128::size, h128().data());
|
||||
m_frameDec.SetKeyWithIV(outRef.data(), h128::size, h128().data());
|
||||
|
||||
// mac-secret = sha3(ecdhe-shared-secret || aes-secret)
|
||||
sha3(keyMaterial, outRef); // output mac-secret
|
||||
bytes macSecret(32);
|
||||
outRef.copyTo(&macSecret);
|
||||
BOOST_REQUIRE(macSecret == fromHex("0x48c938884d5067a1598272fcddaa4b833cd5e7d92e8228c0ecdfabbe68aef7f1"));
|
||||
m_macEnc.SetKey(outRef.data(), h256::size);
|
||||
|
||||
// Initiator egress-mac: sha3(mac-secret^recipient-nonce || auth-sent-init)
|
||||
// ingress-mac: sha3(mac-secret^initiator-nonce || auth-recvd-ack)
|
||||
// Recipient egress-mac: sha3(mac-secret^initiator-nonce || auth-sent-ack)
|
||||
// ingress-mac: sha3(mac-secret^recipient-nonce || auth-recvd-init)
|
||||
|
||||
(*(h256*)outRef.data() ^ remoteNonce).ref().copyTo(keyMaterial);
|
||||
bytes const& egressCipher = originated ? authCipher : ackCipher;
|
||||
keyMaterialBytes.resize(h256::size + egressCipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
bytesConstRef(&egressCipher).copyTo(keyMaterial.cropped(h256::size, egressCipher.size()));
|
||||
m_egressMac.Update(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
|
||||
{
|
||||
bytes egressMac;
|
||||
SHA3_256 h(m_egressMac);
|
||||
bytes digest(32);
|
||||
h.Final(digest.data());
|
||||
BOOST_REQUIRE(digest == fromHex("0x09771e93b1a6109e97074cbe2d2b0cf3d3878efafe68f53c41bb60c0ec49097e"));
|
||||
}
|
||||
|
||||
// recover mac-secret by re-xoring remoteNonce
|
||||
bytes recoverMacSecretTest(32);
|
||||
(*(h256*)keyMaterial.data() ^ remoteNonce).ref().copyTo(&recoverMacSecretTest);
|
||||
BOOST_REQUIRE(recoverMacSecretTest == macSecret);
|
||||
|
||||
(*(h256*)keyMaterial.data() ^ remoteNonce ^ nonce).ref().copyTo(keyMaterial);
|
||||
bytes const& ingressCipher = originated ? ackCipher : authCipher;
|
||||
keyMaterialBytes.resize(h256::size + ingressCipher.size());
|
||||
keyMaterial.retarget(keyMaterialBytes.data(), keyMaterialBytes.size());
|
||||
bytesConstRef(&ingressCipher).copyTo(keyMaterial.cropped(h256::size, ingressCipher.size()));
|
||||
m_ingressMac.Update(keyMaterial.data(), keyMaterial.size());
|
||||
|
||||
{
|
||||
bytes ingressMac;
|
||||
SHA3_256 h(m_ingressMac);
|
||||
bytes digest(32);
|
||||
h.Final(digest.data());
|
||||
BOOST_CHECK(digest == fromHex("0x75823d96e23136c89666ee025fb21a432be906512b3dd4a3049e898adb433847"));
|
||||
}
|
||||
|
||||
bytes initHello(fromHex("6ef23fcf1cec7312df623f9ae701e63b550cdb8517fefd8dd398fc2acd1d935e6e0434a2b96769078477637347b7b01924fff9ff1c06df2f804df3b0402bbb9f87365b3c6856b45e1e2b6470986813c3816a71bff9d69dd297a5dbd935ab578f6e5d7e93e4506a44f307c332d95e8a4b102585fd8ef9fc9e3e055537a5cec2e9"));
|
||||
|
||||
bytes recvHello(fromHex("6ef23fcf1cec7312df623f9ae701e63be36a1cdd1b19179146019984f3625d4a6e0434a2b96769050577657247b7b02bc6c314470eca7e3ef650b98c83e9d7dd4830b3f718ff562349aead2530a8d28a8484604f92e5fced2c6183f304344ab0e7c301a0c05559f4c25db65e36820b4b909a226171a60ac6cb7beea09376d6d8"));
|
||||
|
||||
/// test macs of frame headers
|
||||
{
|
||||
SHA3_256 egressmac(m_egressMac);
|
||||
SHA3_256 prevDigest(egressmac);
|
||||
h128 prevDigestOut;
|
||||
prevDigest.TruncatedFinal(prevDigestOut.data(), h128::size);
|
||||
h128 encDigest;
|
||||
m_macEnc.ProcessData(encDigest.data(), prevDigestOut.data(), h128::size);
|
||||
encDigest ^= *(h128*)initHello.data();
|
||||
egressmac.Update(encDigest.data(), h128::size);
|
||||
egressmac.TruncatedFinal(encDigest.data(), h128::size);
|
||||
|
||||
bytes provided(16);
|
||||
bytesConstRef(&initHello).cropped(16, 16).copyTo(bytesRef(&provided));
|
||||
BOOST_REQUIRE(*(h128*)encDigest.data() == *(h128*)provided.data());
|
||||
}
|
||||
|
||||
{
|
||||
SHA3_256 ingressmac(m_ingressMac);
|
||||
SHA3_256 prevDigest(ingressmac);
|
||||
h128 prevDigestOut;
|
||||
prevDigest.TruncatedFinal(prevDigestOut.data(), h128::size);
|
||||
h128 encDigest;
|
||||
m_macEnc.ProcessData(encDigest.data(), prevDigestOut.data(), h128::size);
|
||||
encDigest ^= *(h128*)recvHello.data();
|
||||
ingressmac.Update(encDigest.data(), h128::size);
|
||||
ingressmac.TruncatedFinal(encDigest.data(), h128::size);
|
||||
|
||||
bytes provided(16);
|
||||
bytesConstRef(&recvHello).cropped(16, 16).copyTo(bytesRef(&provided));
|
||||
BOOST_REQUIRE(*(h128*)encDigest.data() == *(h128*)provided.data());
|
||||
}
|
||||
|
||||
// test decrypt of frame headers for recvHello
|
||||
bytes plaintext(16);
|
||||
m_frameDec.ProcessData(plaintext.data(), recvHello.data(), h128::size);
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ecies_interop_test_primitives)
|
||||
{
|
||||
CryptoPP::SHA256 sha256ctx;
|
||||
bytes emptyExpected(fromHex("0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"));
|
||||
bytes empty;
|
||||
sha256ctx.Update(empty.data(), 0);
|
||||
bytes emptyTestOut(32);
|
||||
sha256ctx.Final(emptyTestOut.data());
|
||||
BOOST_REQUIRE(emptyExpected == emptyTestOut);
|
||||
|
||||
bytes hash1Expected(fromHex("0x8949b278bbafb8da1aaa18cb724175c5952280f74be5d29ab4b37d1b45c84b08"));
|
||||
bytes hash1input(fromHex("0x55a53b55afb12affff3c"));
|
||||
sha256ctx.Update(hash1input.data(), hash1input.size());
|
||||
bytes hash1Out(32);
|
||||
sha256ctx.Final(hash1Out.data());
|
||||
BOOST_REQUIRE(hash1Out == hash1Expected);
|
||||
|
||||
h128 hmack(fromHex("0x07a4b6dfa06369a570f2dcba2f11a18f"));
|
||||
CryptoPP::HMAC<SHA256> hmacctx(hmack.data(), h128::size);
|
||||
bytes input(fromHex("0x4dcb92ed4fc67fe86832"));
|
||||
hmacctx.Update(input.data(), input.size());
|
||||
bytes hmacExpected(fromHex("0xc90b62b1a673b47df8e395e671a68bfa68070d6e2ef039598bb829398b89b9a9"));
|
||||
bytes hmacOut(hmacExpected.size());
|
||||
hmacctx.Final(hmacOut.data());
|
||||
BOOST_REQUIRE(hmacExpected == hmacOut);
|
||||
|
||||
// go messageTag
|
||||
bytes tagSecret(fromHex("0xaf6623e52208c596e17c72cea6f1cb09"));
|
||||
bytes tagInput(fromHex("0x3461282bcedace970df2"));
|
||||
bytes tagExpected(fromHex("0xb3ce623bce08d5793677ba9441b22bb34d3e8a7de964206d26589df3e8eb5183"));
|
||||
CryptoPP::HMAC<SHA256> hmactagctx(tagSecret.data(), tagSecret.size());
|
||||
hmactagctx.Update(tagInput.data(), tagInput.size());
|
||||
h256 mac;
|
||||
hmactagctx.Final(mac.data());
|
||||
BOOST_REQUIRE(mac.asBytes() == tagExpected);
|
||||
|
||||
Secret input1(fromHex("0x0de72f1223915fa8b8bf45dffef67aef8d89792d116eb61c9a1eb02c422a4663"));
|
||||
bytes expect1(fromHex("0x1d0c446f9899a3426f2b89a8cb75c14b"));
|
||||
bytes test1;
|
||||
test1 = s_secp256k1.eciesKDF(input1, bytes(), 16);
|
||||
BOOST_REQUIRE(test1 == expect1);
|
||||
|
||||
Secret kdfInput2(fromHex("0x961c065873443014e0371f1ed656c586c6730bf927415757f389d92acf8268df"));
|
||||
bytes kdfExpect2(fromHex("0x4050c52e6d9c08755e5a818ac66fabe478b825b1836fd5efc4d44e40d04dabcc"));
|
||||
bytes kdfTest2;
|
||||
kdfTest2 = s_secp256k1.eciesKDF(kdfInput2, bytes(), 32);
|
||||
BOOST_REQUIRE(kdfTest2 == kdfExpect2);
|
||||
|
||||
KeyPair k(Secret(fromHex("0x332143e9629eedff7d142d741f896258f5a1bfab54dab2121d3ec5000093d74b")));
|
||||
Public p(fromHex("0xf0d2b97981bd0d415a843b5dfe8ab77a30300daab3658c578f2340308a2da1a07f0821367332598b6aa4e180a41e92f4ebbae3518da847f0b1c0bbfe20bcf4e1"));
|
||||
Secret agreeExpected(fromHex("0xee1418607c2fcfb57fda40380e885a707f49000a5dda056d828b7d9bd1f29a08"));
|
||||
Secret agreeTest;
|
||||
s_secp256k1.agree(k.sec(), p, agreeTest);
|
||||
BOOST_REQUIRE(agreeExpected == agreeTest);
|
||||
|
||||
KeyPair kmK(Secret(fromHex("0x57baf2c62005ddec64c357d96183ebc90bf9100583280e848aa31d683cad73cb")));
|
||||
bytes kmCipher(fromHex("0x04ff2c874d0a47917c84eea0b2a4141ca95233720b5c70f81a8415bae1dc7b746b61df7558811c1d6054333907333ef9bb0cc2fbf8b34abb9730d14e0140f4553f4b15d705120af46cf653a1dc5b95b312cf8444714f95a4f7a0425b67fc064d18f4d0a528761565ca02d97faffdac23de10"));
|
||||
bytes kmPlain = kmCipher;
|
||||
bytes kmExpected(asBytes("a"));
|
||||
BOOST_REQUIRE(s_secp256k1.decryptECIES(kmK.sec(), kmPlain));
|
||||
BOOST_REQUIRE(kmExpected == kmPlain);
|
||||
|
||||
KeyPair kenc(Secret(fromHex("0x472413e97f1fd58d84e28a559479e6b6902d2e8a0cee672ef38a3a35d263886b")));
|
||||
Public penc(Public(fromHex("0x7a2aa2951282279dc1171549a7112b07c38c0d97c0fe2c0ae6c4588ba15be74a04efc4f7da443f6d61f68a9279bc82b73e0cc8d090048e9f87e838ae65dd8d4c")));
|
||||
BOOST_REQUIRE(penc == kenc.pub());
|
||||
|
||||
bytes cipher1(fromHex("0x046f647e1bd8a5cd1446d31513bac233e18bdc28ec0e59d46de453137a72599533f1e97c98154343420d5f16e171e5107999a7c7f1a6e26f57bcb0d2280655d08fb148d36f1d4b28642d3bb4a136f0e33e3dd2e3cffe4b45a03fb7c5b5ea5e65617250fdc89e1a315563c20504b9d3a72555"));
|
||||
bytes plainTest1 = cipher1;
|
||||
bytes expectedPlain1 = asBytes("a");
|
||||
BOOST_REQUIRE(s_secp256k1.decryptECIES(kenc.sec(), plainTest1));
|
||||
BOOST_REQUIRE(plainTest1 == expectedPlain1);
|
||||
|
||||
bytes cipher2(fromHex("0x0443c24d6ccef3ad095140760bb143078b3880557a06392f17c5e368502d79532bc18903d59ced4bbe858e870610ab0d5f8b7963dd5c9c4cf81128d10efd7c7aa80091563c273e996578403694673581829e25a865191bdc9954db14285b56eb0043b6288172e0d003c10f42fe413222e273d1d4340c38a2d8344d7aadcbc846ee"));
|
||||
bytes plainTest2 = cipher2;
|
||||
bytes expectedPlain2 = asBytes("aaaaaaaaaaaaaaaa");
|
||||
BOOST_REQUIRE(s_secp256k1.decryptECIES(kenc.sec(), plainTest2));
|
||||
BOOST_REQUIRE(plainTest2 == expectedPlain2);
|
||||
|
||||
bytes cipher3(fromHex("0x04c4e40c86bb5324e017e598c6d48c19362ae527af8ab21b077284a4656c8735e62d73fb3d740acefbec30ca4c024739a1fcdff69ecaf03301eebf156eb5f17cca6f9d7a7e214a1f3f6e34d1ee0ec00ce0ef7d2b242fbfec0f276e17941f9f1bfbe26de10a15a6fac3cda039904ddd1d7e06e7b96b4878f61860e47f0b84c8ceb64f6a900ff23844f4359ae49b44154980a626d3c73226c19e"));
|
||||
bytes plainTest3 = cipher3;
|
||||
bytes expectedPlain3 = asBytes("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
BOOST_REQUIRE(s_secp256k1.decryptECIES(kenc.sec(), plainTest3));
|
||||
BOOST_REQUIRE(plainTest3 == expectedPlain3);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"blockhash0" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "5",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
"0x" : "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d",
|
||||
"0x02" : "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c060"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 0) [[ 1 ]] (BLOCKHASH 5) [[ 2 ]] (BLOCKHASH 4) }",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "285000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"blockhashOutOfRange" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "257",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 0) [[ 1 ]] (BLOCKHASH 257) [[ 2 ]] (BLOCKHASH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "2850000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"blockhashInRange" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "257",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
"0x" : "0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6",
|
||||
"0x01" : "0xad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5",
|
||||
"0x02" : "0x6ca54da2c4784ea43fd88b3402de07ae4bced597cbb19f323b7595857a6720ae"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 1) [[ 1 ]] (BLOCKHASH 2) [[ 2 ]] (BLOCKHASH 256) }",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "285000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,701 +0,0 @@
|
||||
{
|
||||
"callcodeWithHighValue": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "30000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1000000000000000001 0 64 0 2 ) }",
|
||||
"storage": {}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600155603760005360026000f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "3000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"callWithHighValue": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "30000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1000000000000000001 0 64 0 2 ) }",
|
||||
"storage": {}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600155603760005360026000f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "3000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"callWithHighValueAndOOGatTxLevel": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "30000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "3000000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 3000001 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100001 0 0 0 0 ) }",
|
||||
"storage": {}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600155603760005360026000f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "3000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"callWithHighValueOOGinCall": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "30000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (ADD (CALL 10000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 0 0 0 ) 1) }",
|
||||
"storage": {}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600155603760005360026000f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "3000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"Callcode1024BalanceTooLow" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "0xffffffffffffffffffffffffffffffff",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1024",
|
||||
"code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALLCODE 0xfffffffffff 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b @@0 0 0 0 0) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "0xffffffffffffffffffffffffffffff",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Callcode1024OOG" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "0xffffffffffffffffffffffffffffffff",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x0401",
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x0fa3e9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1024",
|
||||
"code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALLCODE (MUL (SUB (GAS) 10000) (SUB 1 (DIV @@0 1025))) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "15720826",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"CallcodeLoseGasOOG" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "0xffffffffffffffffffffffffffffffff",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
"0x02" : "0x03e9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1024",
|
||||
"code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALLCODE (ADD 1(MUL @@0 100000)) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "166262",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call1024BalanceTooLow" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "0xffffffffffffffffffffffffffffffff",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1024",
|
||||
"code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL 0xfffffffffff 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b @@0 0 0 0 0) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "17592186099592",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call1024OOG" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "0xffffffffffffffffffffffffffffffff",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x0401",
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x0fa3e9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1024",
|
||||
"code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL (MUL (SUB (GAS) 10000) (SUB 1 (DIV @@0 1025))) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "15720826",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"CallLoseGasOOG" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "0xffffffffffffffffffffffffffffffff",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
"0x02" : "0x03e9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1024",
|
||||
"code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL (ADD 1(MUL @@0 100000)) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "0xffffffffffffffffffffffffffffff",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"callcodeWithHighValueAndGasOOG": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "30000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 0xffffffffffffffffffffffff 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }",
|
||||
"storage": {}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600155603760005360026000f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "3000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "100000",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"callWithHighValueAndGasOOG": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "30000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 0xffffffffffffffffffffffff 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }",
|
||||
"storage": {}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600155603760005360026000f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "3000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "100000",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"createNameRegistratorendowmentTooHigh": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0x601080600c6000396000f3006000355415600957005b60203560003555) [[ 0 ]] (CREATE 1000000000000000001 3 29) }",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "300000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"createJS_ExampleContract": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : {
|
||||
"balance" : "100000",
|
||||
"code" : "0x60003560e060020a9004806343d726d61461004257806391b7f5ed14610050578063d686f9ee14610061578063f5bade661461006f578063fcfff16f1461008057005b61004a6101de565b60006000f35b61005b6004356100bf565b60006000f35b610069610304565b60006000f35b61007a60043561008e565b60006000f35b6100886100f0565b60006000f35b600054600160a060020a031633600160a060020a031614156100af576100b4565b6100bc565b806001819055505b50565b600054600160a060020a031633600160a060020a031614156100e0576100e5565b6100ed565b806002819055505b50565b600054600160a060020a031633600160a060020a031614806101255750600354600160a060020a031633600160a060020a0316145b61012e57610161565b60016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a16101dc565b60045460011480610173575060015434105b6101b85760016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a142600581905550336003819055506101db565b33600160a060020a03166000346000600060006000848787f16101d757005b5050505b5b565b60006004546000146101ef576101f4565b610301565b600054600160a060020a031633600160a060020a031614801561022c5750600054600160a060020a0316600354600160a060020a0316145b61023557610242565b6000600481905550610301565b600354600160a060020a031633600160a060020a03161461026257610300565b600554420360025402905060015481116102c757600354600160a060020a0316600082600154036000600060006000848787f161029b57005b505050600054600160a060020a03166000826000600060006000848787f16102bf57005b5050506102ee565b600054600160a060020a031660006001546000600060006000848787f16102ea57005b5050505b60006004819055506000546003819055505b5b50565b6000600054600160a060020a031633600160a060020a031614156103275761032c565b61037e565b600554420360025402905060015481116103455761037d565b600054600160a060020a031660006001546000600060006000848787f161036857005b50505060006004819055506000546003819055505b5b5056",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"0x01" : "0x42",
|
||||
"0x02" : "0x23",
|
||||
"0x03" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"0x05" : "0x54c98c81"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000000000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "600000",
|
||||
"to" : "",
|
||||
"value" : "100000",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : "0x60406103ca600439600451602451336000819055506000600481905550816001819055508060028190555042600581905550336003819055505050610381806100496000396000f30060003560e060020a9004806343d726d61461004257806391b7f5ed14610050578063d686f9ee14610061578063f5bade661461006f578063fcfff16f1461008057005b61004a6101de565b60006000f35b61005b6004356100bf565b60006000f35b610069610304565b60006000f35b61007a60043561008e565b60006000f35b6100886100f0565b60006000f35b600054600160a060020a031633600160a060020a031614156100af576100b4565b6100bc565b806001819055505b50565b600054600160a060020a031633600160a060020a031614156100e0576100e5565b6100ed565b806002819055505b50565b600054600160a060020a031633600160a060020a031614806101255750600354600160a060020a031633600160a060020a0316145b61012e57610161565b60016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a16101dc565b60045460011480610173575060015434105b6101b85760016004819055507f59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a560006000a142600581905550336003819055506101db565b33600160a060020a03166000346000600060006000848787f16101d757005b5050505b5b565b60006004546000146101ef576101f4565b610301565b600054600160a060020a031633600160a060020a031614801561022c5750600054600160a060020a0316600354600160a060020a0316145b61023557610242565b6000600481905550610301565b600354600160a060020a031633600160a060020a03161461026257610300565b600554420360025402905060015481116102c757600354600160a060020a0316600082600154036000600060006000848787f161029b57005b505050600054600160a060020a03166000826000600060006000848787f16102bf57005b5050506102ee565b600054600160a060020a031660006001546000600060006000848787f16102ea57005b5050505b60006004819055506000546003819055505b5b50565b6000600054600160a060020a031633600160a060020a031614156103275761032c565b61037e565b600554420360025402905060015481116103455761037d565b600054600160a060020a031660006001546000600060006000848787f161036857005b50505060006004819055506000546003819055505b5b505600000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000023"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
{
|
||||
"add11" : {
|
||||
"env" : "Environment parameters for test execution",
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : "Expected post state result (may be not defined at all)",
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000100000",
|
||||
"code" : "0x6001600101600055",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x02"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "41012",
|
||||
"code" : "0x",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "999999999999858988",
|
||||
"code" : "0x",
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : "Previous state before execution",
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x6001600101600055",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : "could also be defiend via v,r,s instead of secretKey",
|
||||
"transaction" : {
|
||||
"data" : "",
|
||||
"gasLimit" : "400000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "100000"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,817 +0,0 @@
|
||||
{
|
||||
"TransactionCreateRandomInitCode" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "32599"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "67401",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x600a80600c6000396000f200600160008035811a8100",
|
||||
"gasLimit" : "32599",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
|
||||
"NotEnoughCashContractCreation" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "22177"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "22177",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x600a80600c6000396000f200600160008035811a8100",
|
||||
"gasLimit" : "22176",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "100"
|
||||
}
|
||||
},
|
||||
|
||||
"OutOfGasContractCreation" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x600a80600c6000396000f200600160008035811a8100",
|
||||
"gasLimit" : "22000",
|
||||
"gasPrice" : "3",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
"StackUnderFlowContractCreation" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "40000"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "50000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x6000f1",
|
||||
"gasLimit" : "40000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionCreateAutoSuicideContract" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"0000000000000000000000000000000000000000" : {
|
||||
"balance" : "15"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x600a80600c6000396000fff2ffff600160008035811a81",
|
||||
"gasLimit" : "23000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "15"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionCreateStopInInitcode" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : {
|
||||
"balance" : "1"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x600a80600c600039600000f20000600160008035811a81",
|
||||
"gasLimit" : "23000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionCreateSuicideInInitcode" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "23000"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x600a80600c6000396000f200ff600160008035811a81",
|
||||
"gasLimit" : "23000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
|
||||
"CallTheContractToCreateEmptyContract" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1",
|
||||
"nonce" : "1"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
},
|
||||
"d2571607e241ecf590ed94b12d87c94babe36db6" : {
|
||||
"balance" : "0",
|
||||
"code" : "0x",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "0",
|
||||
"nonce": "0",
|
||||
"code": "{(CREATE 0 0 32)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "100000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
|
||||
"CallRecursiveContract" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1",
|
||||
"nonce" : "41",
|
||||
"storage" : {
|
||||
"0x02" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
||||
}
|
||||
},
|
||||
"1a4c83e1a9834cdc7e4a905ff7f0cf44aed73180" : {
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x02" : "0x1a4c83e1a9834cdc7e4a905ff7f0cf44aed73180"
|
||||
}
|
||||
},
|
||||
"8e3411c91d5dd4081b4846fa2f93808f5ad19686" : {
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x02" : "0x8e3411c91d5dd4081b4846fa2f93808f5ad19686"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "0",
|
||||
"nonce": "40",
|
||||
"code": "{[[ 2 ]](ADDRESS)(CODECOPY 0 0 32)(CREATE 0 0 32)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "400000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
|
||||
"CallContractToCreateContractWhichWouldCreateContractInInitCode" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1",
|
||||
"nonce" : "1"
|
||||
},
|
||||
"62c01474f089b07dae603491675dc5b5748f7049" : {
|
||||
"nonce" : "0"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
},
|
||||
"d2571607e241ecf590ed94b12d87c94babe36db6" : {
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x" : "0x0c"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "1",
|
||||
"nonce": "0",
|
||||
"//": "{[[0]] 12 (CREATE 0 64 32)}",
|
||||
"code": "{(MSTORE 0 0x600c600055602060406000f0)(CREATE 0 20 12)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "20000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"CallContractToCreateContractWhichWouldCreateContractIfCalled" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x" : "0xd2571607e241ecf590ed94b12d87c94babe36db6"
|
||||
}
|
||||
},
|
||||
"62c01474f089b07dae603491675dc5b5748f7049" : {
|
||||
"nonce" : "0"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
},
|
||||
"d2571607e241ecf590ed94b12d87c94babe36db6" : {
|
||||
"balance" : "2",
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x" : "0x0c"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "1000",
|
||||
"nonce": "0",
|
||||
"//": "(CREATE 0 64 32)",
|
||||
"//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}",
|
||||
"code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 50000 (SLOAD 0) 1 0 0 0 0)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "20000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"CallContractToCreateContractOOGBonusGas" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x" : "0xd2571607e241ecf590ed94b12d87c94babe36db6"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
},
|
||||
"d2571607e241ecf590ed94b12d87c94babe36db6" : {
|
||||
"balance" : "1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x0c"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "112",
|
||||
"nonce": "0",
|
||||
"//": "(CREATE 0 64 32)",
|
||||
"//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}",
|
||||
"code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 0 (SLOAD 0) 12 0 0 0 0)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "20000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"CallContractToCreateContractOOG" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"nonce" : "0"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "0",
|
||||
"nonce": "0",
|
||||
"//": "Create should fail. So CALL goes to 0x0...0",
|
||||
"//": "(CREATE 0 64 32)",
|
||||
"//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}",
|
||||
"code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 0 (SLOAD 0) 0 0 0 0 0)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "20000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"CallContractToCreateContractAndCallItOOG" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"nonce" : "1",
|
||||
"storage" : {
|
||||
"0x" : "0xd2571607e241ecf590ed94b12d87c94babe36db6"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
},
|
||||
"d2571607e241ecf590ed94b12d87c94babe36db6" : {
|
||||
"balance" : "1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x0c"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "1000",
|
||||
"nonce": "0",
|
||||
"//": "(CREATE 0 64 32)",
|
||||
"//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}",
|
||||
"code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 1000 (SLOAD 0) 0 0 0 0 0)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "203000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"CallContractToCreateContractNoCash" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "100000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"nonce" : "0"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "10000",
|
||||
"nonce": "0",
|
||||
"//": "(CREATE 0 64 32)",
|
||||
"//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}",
|
||||
"code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 100000 11 21)}",
|
||||
"storage": {}
|
||||
},
|
||||
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "20000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"ReturnTest" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"194f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x15"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"194f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0",
|
||||
"code" : "{(CALL 2000 0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b 0 30 1 31 1) [[0]](MLOAD 0) (RETURN 30 2)}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"code" : "{(MSTORE 0 0x15) (RETURN 31 1)}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "300000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "194f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "0"
|
||||
}
|
||||
},
|
||||
|
||||
"ReturnTest2" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "1000000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"194f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"storage" : {
|
||||
"0x" : "0x15",
|
||||
"0x01" : "0x3f"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"194f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0",
|
||||
"code" : "{(MSTORE 0 0x15)(CALL 7000 0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 32 32 32) [[0]](MLOAD 0) [[1]](MLOAD 32) (RETURN 0 64)}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"code" : "{(MSTORE 0 (MUL 3 (CALLDATALOAD 0)))(RETURN 0 32)}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "250000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "194f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,245 +0,0 @@
|
||||
{
|
||||
"mload32bitBound": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "17592320524892",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] (MLOAD 4294967296) } ",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "175923205248920",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "17592320524892",
|
||||
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"mload32bitBound_return": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "175923205248920000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (RETURN 0 4294967297) } ",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1759232052489200000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "175923205248920000",
|
||||
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"mload32bitBound_return2": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "175923205248920000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{[ 0 ] 1 (RETURN 0 4294967296) } ",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1759232052489200000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "175923205248920000",
|
||||
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"mload32bitBound_Msize": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "175923205248920000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x20"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [4294967295] 1 [[ 0 ]] (MSIZE)} ",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1759232052489200000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "175923205248920000",
|
||||
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"mload32bitBound2": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "37791080412587",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] (MLOAD 6294967296) } ",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "377910804219850",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "37791080412587",
|
||||
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"FillStack" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"currentDifficulty" : "5623894562375",
|
||||
"currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "0",
|
||||
"code" : "0x5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe457f00000000000000000000000100000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000017f000000000000000000000000000000000000000000000000000000000000c3504357155320803a975560005155",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x6000355415600957005b60203560003555",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"data" : "0x5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe457f00000000000000000000000100000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000017f000000000000000000000000000000000000000000000000000000000000c3504357155320803a97",
|
||||
"gasLimit" : "3141592",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "264050067"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,682 +0,0 @@
|
||||
{
|
||||
|
||||
"QuadraticComplexitySolidity_CallDataCopy" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "350000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "500000000",
|
||||
"//" : "contract caller ",
|
||||
"//" : "{ ",
|
||||
"//" : " int value; ",
|
||||
"//" : " function run(int count) ",
|
||||
"//" : " { ",
|
||||
"//" : " value = count; ",
|
||||
"//" : " address a = 0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b; ",
|
||||
"//" : " while(count > 0) ",
|
||||
"//" : " { ",
|
||||
"//" : " a.call('just', 'call'); ",
|
||||
"//" : " count = count - 1; ",
|
||||
"//" : " } ",
|
||||
"//" : " } ",
|
||||
"//" : "} ",
|
||||
"code" : "0x60003560e060020a9004806361a4770614601557005b601e6004356024565b60006000f35b60008160008190555073b94f5374fce5edbc8e2a8697c15331677e6ebf0b90505b600082131560bf5780600160a060020a03166000600060007f6a7573740000000000000000000000000000000000000000000000000000000081526004017f63616c6c000000000000000000000000000000000000000000000000000000008152602001600060008560155a03f150506001820391506045565b505056",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "5000000",
|
||||
"code" : "{ (CALLDATACOPY 0 0 50000) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"//" : "run(int256)",
|
||||
"data" : "0x61a47706000000000000000000000000000000000000000000000000000000000000c350",
|
||||
"gasLimit" : "904+68*x+e",
|
||||
"gasLimit" : "350000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "1"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "86000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 1600 0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 50000 0 0) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "85000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Callcode50000" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "86000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "7000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALLCODE 1600 0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 50000 0 0) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "85000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Create1000" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "86000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 1000) [i](+ @i 1) [[ 0 ]] (CREATE 1 0 50000) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "85000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000_ecrec" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "95000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 500 1 1 0 50000 0 0) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "94500000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000_sha256" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "3925000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 78200 2 1 0 50000 0 0) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "3925000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000_rip160" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "3925000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 78200 3 1 0 50000 0 0) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "3925000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000_identity" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "88250000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 1564 4 1 0 50000 0 0) ) [[ 1 ]] @i}",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "88250000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000_identity2" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "88250000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ [ 1 ] 42 (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 1564 4 1 0 50000 1 50000) ) [[ 1 ]] @i [[ 2 ]] @1 }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "88250000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
"Return50000" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "88250000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 1564 0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 50000 0 0) ) [[ 1 ]] @i }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (RETURN (CALLDATALOAD 49999) 1) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "88250000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Return50000_2" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "88250000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 1564 0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 50000 0 0) ) [[ 1 ]] @i }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ [ 0 ] (CALLDATALOAD 49999) (RETURN @0 1) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "88250000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
"Call50000bytesContract50_1" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "882500000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50) [i](+ @i 1) [[ 0 ]] (CALL 88250000000 0xaaa50000fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) ) [[ 1 ]] @i }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaa50000fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "0x600160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010160010Line truncated
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "882500000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000bytesContract50_2" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "882500000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50) [i](+ @i 1) [[ 0 ]] (CALL 88250000000 0xaaa50000fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) ) [[ 1 ]] @i }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaa50000fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "0x60015b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5Line truncated
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "882500000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call50000bytesContract50_3" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "882500000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ (for {} (< @i 50) [i](+ @i 1) [[ 0 ]] (CALL 88250000000 0xaaa50000fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) ) [[ 1 ]] @i }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaa50000fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "0x600161da8e565b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5Line truncated
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "882500000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
},
|
||||
|
||||
"Call1MB1024Calldepth" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "882500000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"pre" :
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "{ [[ 0 ]] (+ @@0 1) (if (LT @@0 1024) [[ 1 ]] (CALL (- (GAS) 1005000) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 1000000 0 0) [[ 2 ]] 1 ) }",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
|
||||
"aaa50000fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xfffffffffffff",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "882500000000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"recursiveCreate": {
|
||||
"env": {
|
||||
"previousHash": "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber": "0",
|
||||
"currentGasLimit": "10000000",
|
||||
"currentDifficulty": "256",
|
||||
"currentTimestamp": 1,
|
||||
"currentCoinbase": "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre": {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||
"balance": "20000000",
|
||||
"nonce" : "0",
|
||||
"code": "{(CODECOPY 0 0 32)(CREATE 0 0 32)}",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code": "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction": {
|
||||
"nonce": "0",
|
||||
"gasPrice": "1",
|
||||
"gasLimit": "465224",
|
||||
"to": "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value": "100000",
|
||||
"secretKey": "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,956 +0,0 @@
|
||||
{
|
||||
"refund_getEtherBack" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "228500",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000010",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "13003"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "2271987",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "2285000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "228500",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_changeNonZeroStorage" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000010",
|
||||
"storage" : {
|
||||
"0x01" : "0x17"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "26006"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "973984",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 23 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "228500",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_OOG" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "26005"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "473995",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "500000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "26005",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_NoOOG_1" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "13003"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "37197",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "50200",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "26006",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund50_1" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "23015"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "76985",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 [[ 2 ]] 0 [[ 3 ]] 0 [[ 4 ]] 0 [[ 5 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x01",
|
||||
"0x03" : "0x01",
|
||||
"0x04" : "0x01",
|
||||
"0x05" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "100000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund50_2" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
"0x0a" : "0x01",
|
||||
"0x0b" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "43021"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "56979",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 10 ]] 1 [[ 11 ]] 1 [[ 1 ]] 0 [[ 2 ]] 0 [[ 3 ]] 0 [[ 4 ]] 0 [[ 5 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x01",
|
||||
"0x03" : "0x01",
|
||||
"0x04" : "0x01",
|
||||
"0x05" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "100000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund50percentCap" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
"0x0a" : "0x8000000000000000000000000000000000000000000000000000000000000000",
|
||||
"0x0b" : "0x0de0b6b3a7640000"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "45600"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "54400"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ @@1 @@2 [[ 10 ]] (EXP 2 0xff) [[ 11 ]] (BALANCE (ADDRESS)) [[ 1 ]] 0 [[ 2 ]] 0 [[ 3 ]] 0 [[ 4 ]] 0 [[ 5 ]] 0 [[ 6 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x01",
|
||||
"0x03" : "0x01",
|
||||
"0x04" : "0x01",
|
||||
"0x05" : "0x01",
|
||||
"0x06" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "100000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund600" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
"0x0b" : "0x0de0b6b3a7640000"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "38105"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "61895"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ @@1 @@2 [[ 10 ]] (EXP 2 0xffff) [[ 11 ]] (BALANCE (ADDRESS)) [[ 1 ]] 0 [[ 2 ]] 0 [[ 3 ]] 0 [[ 4 ]] 0 [[ 5 ]] 0 [[ 6 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x01",
|
||||
"0x03" : "0x01",
|
||||
"0x04" : "0x01",
|
||||
"0x05" : "0x01",
|
||||
"0x06" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "100000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refundSuicide50procentCap" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"storage" : {
|
||||
"0x0a" : "0x01",
|
||||
"0x0b" : "0x01",
|
||||
"0x16" : "0x984476",
|
||||
"0x17" : "0x96bd58"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "70566"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "9929434",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 22 ]] (GAS) [[ 10 ]] 1 [[ 11 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 ) [[ 1 ]] 0 [[ 2 ]] 0 [[ 3 ]] 0 [[ 4 ]] 0 [[ 5 ]] 0 [[ 6 ]] 0 [[ 7 ]] 0 [[ 8 ]] 0 [[ 23 ]] (GAS) }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01",
|
||||
"0x02" : "0x01",
|
||||
"0x03" : "0x01",
|
||||
"0x04" : "0x01",
|
||||
"0x05" : "0x01",
|
||||
"0x06" : "0x01",
|
||||
"0x07" : "0x01",
|
||||
"0x08" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "10000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }",
|
||||
"storage" : {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "10000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_CallToSuicideStorage" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "2000000000000000010",
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "20534"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "99979456",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "10000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_CallToSuicideNoStorage" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "2000000000000000010",
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "20534"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "99979456",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }",
|
||||
"storage" : {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "10000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_TxToSuicide" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000010",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "10502"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "99989488",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "21003",
|
||||
"to" : "aaae7baea6a6c7c4c2dfeb977efac326af552aaa",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_TxToSuicideOOG" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "21002"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "99978998",
|
||||
"nonce" : "1"
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "21002",
|
||||
"to" : "aaae7baea6a6c7c4c2dfeb977efac326af552aaa",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_CallToSuicideTwice" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "2000000000000000010",
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "20566"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "99979424",
|
||||
"nonce" : "1"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 ) (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "10000000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_CallA" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000010",
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "31070"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1968920",
|
||||
"nonce" : "1"
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 5500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "2000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "200000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_CallA_notEnoughGasInCall" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000010",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "31069"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "68921",
|
||||
"nonce" : "1"
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 5005 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "100000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "85000",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"refund_CallA_OOG" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "31069"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "268931",
|
||||
"nonce" : "1"
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (CALL 6000 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 1 ]] 0 }",
|
||||
"storage" : {
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "300000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "31069",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"makeMoney" : {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : 1,
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000"
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "771500"
|
||||
},
|
||||
"aaaaaaaaace5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (MSTORE 0 0x601080600c6000396000f20060003554156009570060203560003555) (CALL 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec 0xaaaaaaaaace5edbc8e2a8697c15331677e6ebf0b 23 0 0 0 0) }",
|
||||
"storage": {}
|
||||
},
|
||||
"aaaaaaaaace5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "0x600160015532600255",
|
||||
"storage": {}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000000",
|
||||
"nonce" : "0",
|
||||
"code" : "",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"nonce" : "0",
|
||||
"gasPrice" : "1",
|
||||
"gasLimit" : "228500",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"data" : ""
|
||||
}
|
||||
},
|
||||
|
||||
"OverflowGasMakeMoney" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "45678256",
|
||||
"currentGasLimit" : "(2**256)-1",
|
||||
"currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : 1,
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"expect" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000"
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "1000",
|
||||
"code" : "",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639435",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "501"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,260 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file state.cpp
|
||||
* @author Christoph Jentzsch <cj@ethdev.com>
|
||||
* @date 2014
|
||||
* State test functions.
|
||||
*/
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libethereum/CanonBlockChain.h>
|
||||
#include <libethereum/State.h>
|
||||
#include <libethereum/ExtVM.h>
|
||||
#include <libethereum/Defaults.h>
|
||||
#include <libevm/VM.h>
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace dev { namespace test {
|
||||
|
||||
void doStateTests(json_spirit::mValue& v, bool _fillin)
|
||||
{
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
std::cout << " " << i.first << "\n";
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
BOOST_REQUIRE(o.count("env") > 0);
|
||||
BOOST_REQUIRE(o.count("pre") > 0);
|
||||
BOOST_REQUIRE(o.count("transaction") > 0);
|
||||
|
||||
ImportTest importer(o, _fillin);
|
||||
|
||||
State theState = importer.m_statePre;
|
||||
bytes output;
|
||||
|
||||
try
|
||||
{
|
||||
Listener::ExecTimeGuard guard{i.first};
|
||||
output = theState.execute(lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "Exception:\n" << diagnostic_information(_e);
|
||||
theState.commit();
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "state execution exception: " << _e.what();
|
||||
}
|
||||
|
||||
if (_fillin)
|
||||
{
|
||||
#if ETH_FATDB
|
||||
importer.exportTest(output, theState);
|
||||
#else
|
||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off"));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_REQUIRE(o.count("post") > 0);
|
||||
BOOST_REQUIRE(o.count("out") > 0);
|
||||
|
||||
// check output
|
||||
checkOutput(output, o);
|
||||
|
||||
// check logs
|
||||
checkLog(theState.pending().size() ? theState.log(0) : LogEntries(), importer.m_environment.sub.logs);
|
||||
|
||||
// check addresses
|
||||
#if ETH_FATDB
|
||||
ImportTest::checkExpectedState(importer.m_statePost, theState);
|
||||
auto expectedAddrs = importer.m_statePost.addresses();
|
||||
auto resultAddrs = theState.addresses();
|
||||
checkAddresses<map<Address, u256> >(expectedAddrs, resultAddrs);
|
||||
#endif
|
||||
BOOST_CHECK_MESSAGE(theState.rootHash() == h256(o["postStateRoot"].get_str()), "wrong post state root");
|
||||
}
|
||||
}
|
||||
}
|
||||
} }// Namespace Close
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(StateTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stExample)
|
||||
{
|
||||
dev::test::executeTests("stExample", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stSystemOperationsTest)
|
||||
{
|
||||
dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stCallCreateCallCodeTest)
|
||||
{
|
||||
dev::test::executeTests("stCallCreateCallCodeTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stPreCompiledContracts)
|
||||
{
|
||||
dev::test::executeTests("stPreCompiledContracts", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stLogTests)
|
||||
{
|
||||
dev::test::executeTests("stLogTests", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stRecursiveCreate)
|
||||
{
|
||||
dev::test::executeTests("stRecursiveCreate", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stInitCodeTest)
|
||||
{
|
||||
dev::test::executeTests("stInitCodeTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stTransactionTest)
|
||||
{
|
||||
dev::test::executeTests("stTransactionTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stSpecialTest)
|
||||
{
|
||||
dev::test::executeTests("stSpecialTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stRefundTest)
|
||||
{
|
||||
dev::test::executeTests("stRefundTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stBlockHashTest)
|
||||
{
|
||||
dev::test::executeTests("stBlockHashTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stQuadraticComplexityTest)
|
||||
{
|
||||
if (test::Options::get().quadratic)
|
||||
dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stMemoryStressTest)
|
||||
{
|
||||
if (test::Options::get().memory)
|
||||
dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stSolidityTest)
|
||||
{
|
||||
dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stMemoryTest)
|
||||
{
|
||||
dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stCreateTest)
|
||||
{
|
||||
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
|
||||
{
|
||||
string arg = boost::unit_test::framework::master_test_suite().argv[i];
|
||||
if (arg == "--createtest")
|
||||
{
|
||||
if (boost::unit_test::framework::master_test_suite().argc <= i + 2)
|
||||
{
|
||||
cnote << "usage: ./testeth --createtest <PathToConstructor> <PathToDestiny>\n";
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
cnote << "Populating tests...";
|
||||
json_spirit::mValue v;
|
||||
string s = asString(dev::contents(boost::unit_test::framework::master_test_suite().argv[i + 1]));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + (string)boost::unit_test::framework::master_test_suite().argv[i + 1] + " is empty.");
|
||||
json_spirit::read_string(s, v);
|
||||
dev::test::doStateTests(v, true);
|
||||
writeFile(boost::unit_test::framework::master_test_suite().argv[i + 2], asBytes(json_spirit::write_string(v, true)));
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed state test with Exception: " << diagnostic_information(_e));
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed state test with Exception: " << _e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(stRandom)
|
||||
{
|
||||
test::Options::get(); // parse command line options, e.g. to enable JIT
|
||||
|
||||
string testPath = dev::test::getTestPath();
|
||||
testPath += "/StateTests/RandomTests";
|
||||
|
||||
vector<boost::filesystem::path> testFiles;
|
||||
boost::filesystem::directory_iterator iterator(testPath);
|
||||
for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
|
||||
if (boost::filesystem::is_regular_file(iterator->path()) && iterator->path().extension() == ".json")
|
||||
testFiles.push_back(iterator->path());
|
||||
|
||||
for (auto& path: testFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
cnote << "Testing ..." << path.filename();
|
||||
json_spirit::mValue v;
|
||||
string s = asString(dev::contents(path.string()));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");
|
||||
json_spirit::read_string(s, v);
|
||||
test::Listener::notifySuiteStarted(path.filename().string());
|
||||
dev::test::doStateTests(v, false);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed test with Exception: " << _e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(userDefinedFileState)
|
||||
{
|
||||
dev::test::userDefinedTest("--singletest", dev::test::doStateTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file stateOriginal.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* State test functions.
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <secp256k1/secp256k1.h>
|
||||
#include <libethereum/CanonBlockChain.h>
|
||||
#include <libethereum/State.h>
|
||||
#include <libethereum/Farm.h>
|
||||
#include <libethereum/Defaults.h>
|
||||
#include "TestHelper.h"
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
|
||||
int stateTest();
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(StateIntegration)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Basic)
|
||||
{
|
||||
State s;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Complex)
|
||||
{
|
||||
cnote << "Testing State...";
|
||||
|
||||
KeyPair me = sha3("Gav Wood");
|
||||
KeyPair myMiner = sha3("Gav's Miner");
|
||||
// KeyPair you = sha3("123");
|
||||
|
||||
Defaults::setDBPath(boost::filesystem::temp_directory_path().string() + "/" + toString(chrono::system_clock::now().time_since_epoch().count()));
|
||||
|
||||
OverlayDB stateDB = State::openDB();
|
||||
CanonBlockChain bc;
|
||||
cout << bc;
|
||||
|
||||
State s(stateDB, BaseState::Empty, myMiner.address());
|
||||
cout << s;
|
||||
|
||||
// Sync up - this won't do much until we use the last state.
|
||||
s.sync(bc);
|
||||
|
||||
cout << s;
|
||||
|
||||
// Mine to get some ether!
|
||||
mine(s, bc);
|
||||
|
||||
bc.attemptImport(s.blockData(), stateDB);
|
||||
|
||||
cout << bc;
|
||||
|
||||
s.sync(bc);
|
||||
|
||||
cout << s;
|
||||
|
||||
// Inject a transaction to transfer funds from miner to me.
|
||||
Transaction t(1000, 10000, 10000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret());
|
||||
assert(t.sender() == myMiner.address());
|
||||
s.execute(bc.lastHashes(), t);
|
||||
|
||||
cout << s;
|
||||
|
||||
// Mine to get some ether and set in stone.
|
||||
s.commitToMine(bc);
|
||||
s.commitToMine(bc);
|
||||
mine(s, bc);
|
||||
bc.attemptImport(s.blockData(), stateDB);
|
||||
|
||||
cout << bc;
|
||||
|
||||
s.sync(bc);
|
||||
|
||||
cout << s;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
}
|
||||
-200
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file transaction.cpp
|
||||
* @author Dmitrii Khokhlov <winsvega@mail.ru>
|
||||
* @date 2015
|
||||
* Transaaction test functions.
|
||||
*/
|
||||
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
namespace dev { namespace test {
|
||||
|
||||
void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
|
||||
{
|
||||
for (auto& i: _v.get_obj())
|
||||
{
|
||||
cerr << i.first << endl;
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
if (_fillin)
|
||||
{
|
||||
BOOST_REQUIRE(o.count("transaction") > 0);
|
||||
mObject tObj = o["transaction"].get_obj();
|
||||
|
||||
//Construct Rlp of the given transaction
|
||||
RLPStream rlpStream = createRLPStreamFromTransactionFields(tObj);
|
||||
o["rlp"] = "0x" + toHex(rlpStream.out());
|
||||
|
||||
try
|
||||
{
|
||||
Transaction txFromFields(rlpStream.out(), CheckTransaction::Everything);
|
||||
if (!txFromFields.signature().isValid())
|
||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") );
|
||||
|
||||
o["sender"] = toString(txFromFields.sender());
|
||||
}
|
||||
catch(Exception const& _e)
|
||||
{
|
||||
//Transaction is InValid
|
||||
cnote << "Transaction Exception: " << diagnostic_information(_e);
|
||||
o.erase(o.find("transaction"));
|
||||
if (o.count("expect") > 0)
|
||||
{
|
||||
bool expectInValid = (o["expect"].get_str() == "invalid");
|
||||
if (Options::get().checkState)
|
||||
BOOST_CHECK_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!");
|
||||
else
|
||||
BOOST_WARN_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!");
|
||||
|
||||
o.erase(o.find("expect"));
|
||||
}
|
||||
}
|
||||
|
||||
//Transaction is Valid
|
||||
if (o.count("expect") > 0)
|
||||
{
|
||||
bool expectValid = (o["expect"].get_str() == "valid");
|
||||
if (Options::get().checkState)
|
||||
BOOST_CHECK_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!");
|
||||
else
|
||||
BOOST_WARN_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!");
|
||||
|
||||
o.erase(o.find("expect"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_REQUIRE(o.count("rlp") > 0);
|
||||
Transaction txFromRlp;
|
||||
try
|
||||
{
|
||||
bytes stream = importByteArray(o["rlp"].get_str());
|
||||
RLP rlp(stream);
|
||||
txFromRlp = Transaction(rlp.data(), CheckTransaction::Everything);
|
||||
if (!txFromRlp.signature().isValid())
|
||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") );
|
||||
}
|
||||
catch(Exception const& _e)
|
||||
{
|
||||
cnote << i.first;
|
||||
cnote << "Transaction Exception: " << diagnostic_information(_e);
|
||||
BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!");
|
||||
continue;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!");
|
||||
continue;
|
||||
}
|
||||
|
||||
BOOST_REQUIRE(o.count("transaction") > 0);
|
||||
|
||||
mObject tObj = o["transaction"].get_obj();
|
||||
Transaction txFromFields(createRLPStreamFromTransactionFields(tObj).out(), CheckTransaction::Everything);
|
||||
|
||||
//Check the fields restored from RLP to original fields
|
||||
BOOST_CHECK_MESSAGE(txFromFields.data() == txFromRlp.data(), "Data in given RLP not matching the Transaction data!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields.value() == txFromRlp.value(), "Value in given RLP not matching the Transaction value!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields.gasPrice() == txFromRlp.gasPrice(), "GasPrice in given RLP not matching the Transaction gasPrice!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields.gas() == txFromRlp.gas(),"Gas in given RLP not matching the Transaction gas!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields.nonce() == txFromRlp.nonce(),"Nonce in given RLP not matching the Transaction nonce!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields.receiveAddress() == txFromRlp.receiveAddress(), "Receive address in given RLP not matching the Transaction 'to' address!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields.sender() == txFromRlp.sender(), "Transaction sender address in given RLP not matching the Transaction 'vrs' signature!");
|
||||
BOOST_CHECK_MESSAGE(txFromFields == txFromRlp, "However, txFromFields != txFromRlp!");
|
||||
BOOST_REQUIRE (o.count("sender") > 0);
|
||||
|
||||
Address addressReaded = Address(o["sender"].get_str());
|
||||
BOOST_CHECK_MESSAGE(txFromFields.sender() == addressReaded || txFromRlp.sender() == addressReaded, "Signature address of sender does not match given sender address!");
|
||||
}
|
||||
}//for
|
||||
}//doTransactionTests
|
||||
|
||||
} }// Namespace Close
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TransactionTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ttTransactionTest)
|
||||
{
|
||||
dev::test::executeTests("ttTransactionTest", "/TransactionTests", dev::test::doTransactionTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ttWrongRLPTransaction)
|
||||
{
|
||||
dev::test::executeTests("ttWrongRLPTransaction", "/TransactionTests", dev::test::doTransactionTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(tt10mbDataField)
|
||||
{
|
||||
if (test::Options::get().bigData)
|
||||
{
|
||||
auto start = chrono::steady_clock::now();
|
||||
|
||||
dev::test::executeTests("tt10mbDataField", "/TransactionTests", dev::test::doTransactionTests);
|
||||
|
||||
auto end = chrono::steady_clock::now();
|
||||
auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
|
||||
cnote << "test duration: " << duration.count() << " milliseconds.\n";
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ttCreateTest)
|
||||
{
|
||||
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
|
||||
{
|
||||
string arg = boost::unit_test::framework::master_test_suite().argv[i];
|
||||
if (arg == "--createtest")
|
||||
{
|
||||
if (boost::unit_test::framework::master_test_suite().argc <= i + 2)
|
||||
{
|
||||
cnote << "usage: ./testeth --createtest <PathToConstructor> <PathToDestiny>\n";
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
cnote << "Populating tests...";
|
||||
json_spirit::mValue v;
|
||||
string s = asString(dev::contents(boost::unit_test::framework::master_test_suite().argv[i + 1]));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + (string)boost::unit_test::framework::master_test_suite().argv[i + 1] + " is empty.");
|
||||
json_spirit::read_string(s, v);
|
||||
dev::test::doTransactionTests(v, true);
|
||||
writeFile(boost::unit_test::framework::master_test_suite().argv[i + 2], asBytes(json_spirit::write_string(v, true)));
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed transaction test with Exception: " << diagnostic_information(_e));
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed transaction test with Exception: " << _e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(userDefinedFile)
|
||||
{
|
||||
dev::test::userDefinedTest("--singletest", dev::test::doTransactionTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -1,553 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file trie.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* Trie test functions.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libdevcrypto/TrieDB.h>
|
||||
#include "TrieHash.h"
|
||||
#include "MemTrie.h"
|
||||
#include "TestHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
|
||||
namespace js = json_spirit;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
|
||||
static unsigned fac(unsigned _i)
|
||||
{
|
||||
return _i > 2 ? _i * fac(_i - 1) : _i;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
using dev::operator <<;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TrieTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(fat_trie)
|
||||
{
|
||||
h256 r;
|
||||
MemoryDB fm;
|
||||
{
|
||||
FatGenericTrieDB<MemoryDB> ft(&fm);
|
||||
ft.init();
|
||||
ft.insert(h256("69", h256::FromHex, h256::AlignRight).ref(), h256("414243", h256::FromHex, h256::AlignRight).ref());
|
||||
for (auto i: ft)
|
||||
cnote << i.first << i.second;
|
||||
r = ft.root();
|
||||
}
|
||||
{
|
||||
FatGenericTrieDB<MemoryDB> ft(&fm);
|
||||
ft.setRoot(r);
|
||||
for (auto i: ft)
|
||||
cnote << i.first << i.second;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hex_encoded_securetrie_test)
|
||||
{
|
||||
string testPath = test::getTestPath();
|
||||
|
||||
testPath += "/TrieTests";
|
||||
|
||||
cnote << "Testing Secure Trie...";
|
||||
js::mValue v;
|
||||
string s = asString(contents(testPath + "/hex_encoded_securetrie_test.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'hex_encoded_securetrie_test.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
cnote << i.first;
|
||||
js::mObject& o = i.second.get_obj();
|
||||
vector<pair<string, string>> ss;
|
||||
for (auto i: o["in"].get_obj())
|
||||
{
|
||||
ss.push_back(make_pair(i.first, i.second.get_str()));
|
||||
if (!ss.back().first.find("0x"))
|
||||
ss.back().first = asString(fromHex(ss.back().first.substr(2)));
|
||||
if (!ss.back().second.find("0x"))
|
||||
ss.back().second = asString(fromHex(ss.back().second.substr(2)));
|
||||
}
|
||||
for (unsigned j = 0; j < min(1000000000u, dev::test::fac((unsigned)ss.size())); ++j)
|
||||
{
|
||||
next_permutation(ss.begin(), ss.end());
|
||||
MemoryDB m;
|
||||
GenericTrieDB<MemoryDB> t(&m);
|
||||
MemoryDB hm;
|
||||
HashedGenericTrieDB<MemoryDB> ht(&hm);
|
||||
MemoryDB fm;
|
||||
FatGenericTrieDB<MemoryDB> ft(&fm);
|
||||
t.init();
|
||||
ht.init();
|
||||
ft.init();
|
||||
BOOST_REQUIRE(t.check(true));
|
||||
BOOST_REQUIRE(ht.check(true));
|
||||
BOOST_REQUIRE(ft.check(true));
|
||||
for (auto const& k: ss)
|
||||
{
|
||||
t.insert(k.first, k.second);
|
||||
ht.insert(k.first, k.second);
|
||||
ft.insert(k.first, k.second);
|
||||
BOOST_REQUIRE(t.check(true));
|
||||
BOOST_REQUIRE(ht.check(true));
|
||||
BOOST_REQUIRE(ft.check(true));
|
||||
for (auto i = ft.begin(), j = t.begin(); i != ft.end() && j != t.end(); ++i, ++j)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(i == ft.end(), j == t.end());
|
||||
BOOST_REQUIRE((*i).first.toBytes() == (*j).first.toBytes());
|
||||
BOOST_REQUIRE((*i).second.toBytes() == (*j).second.toBytes());
|
||||
}
|
||||
BOOST_CHECK_EQUAL(ht.root(), ft.root());
|
||||
}
|
||||
BOOST_REQUIRE(!o["root"].is_null());
|
||||
BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(ht.root().asArray()));
|
||||
BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(ft.root().asArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(trie_test_anyorder)
|
||||
{
|
||||
string testPath = test::getTestPath();
|
||||
|
||||
testPath += "/TrieTests";
|
||||
|
||||
cnote << "Testing Trie...";
|
||||
js::mValue v;
|
||||
string s = asString(contents(testPath + "/trieanyorder.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'trieanyorder.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
cnote << i.first;
|
||||
js::mObject& o = i.second.get_obj();
|
||||
vector<pair<string, string>> ss;
|
||||
for (auto i: o["in"].get_obj())
|
||||
{
|
||||
ss.push_back(make_pair(i.first, i.second.get_str()));
|
||||
if (!ss.back().first.find("0x"))
|
||||
ss.back().first = asString(fromHex(ss.back().first.substr(2)));
|
||||
if (!ss.back().second.find("0x"))
|
||||
ss.back().second = asString(fromHex(ss.back().second.substr(2)));
|
||||
}
|
||||
for (unsigned j = 0; j < min(1000u, dev::test::fac((unsigned)ss.size())); ++j)
|
||||
{
|
||||
next_permutation(ss.begin(), ss.end());
|
||||
MemoryDB m;
|
||||
GenericTrieDB<MemoryDB> t(&m);
|
||||
MemoryDB hm;
|
||||
HashedGenericTrieDB<MemoryDB> ht(&hm);
|
||||
MemoryDB fm;
|
||||
FatGenericTrieDB<MemoryDB> ft(&fm);
|
||||
t.init();
|
||||
ht.init();
|
||||
ft.init();
|
||||
BOOST_REQUIRE(t.check(true));
|
||||
BOOST_REQUIRE(ht.check(true));
|
||||
BOOST_REQUIRE(ft.check(true));
|
||||
for (auto const& k: ss)
|
||||
{
|
||||
t.insert(k.first, k.second);
|
||||
ht.insert(k.first, k.second);
|
||||
ft.insert(k.first, k.second);
|
||||
BOOST_REQUIRE(t.check(true));
|
||||
BOOST_REQUIRE(ht.check(true));
|
||||
BOOST_REQUIRE(ft.check(true));
|
||||
for (auto i = ft.begin(), j = t.begin(); i != ft.end() && j != t.end(); ++i, ++j)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(i == ft.end(), j == t.end());
|
||||
BOOST_REQUIRE((*i).first.toBytes() == (*j).first.toBytes());
|
||||
BOOST_REQUIRE((*i).second.toBytes() == (*j).second.toBytes());
|
||||
}
|
||||
BOOST_CHECK_EQUAL(ht.root(), ft.root());
|
||||
}
|
||||
BOOST_REQUIRE(!o["root"].is_null());
|
||||
BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(t.root().asArray()));
|
||||
BOOST_CHECK_EQUAL(ht.root(), ft.root());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(trie_tests_ordered)
|
||||
{
|
||||
string testPath = test::getTestPath();
|
||||
|
||||
testPath += "/TrieTests";
|
||||
|
||||
cnote << "Testing Trie...";
|
||||
js::mValue v;
|
||||
string s = asString(contents(testPath + "/trietest.json"));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'trietest.json' is empty. Have you cloned the 'tests' repo branch develop?");
|
||||
js::read_string(s, v);
|
||||
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
cnote << i.first;
|
||||
js::mObject& o = i.second.get_obj();
|
||||
vector<pair<string, string>> ss;
|
||||
vector<string> keysToBeDeleted;
|
||||
for (auto& i: o["in"].get_array())
|
||||
{
|
||||
vector<string> values;
|
||||
for (auto& s: i.get_array())
|
||||
{
|
||||
if (s.type() == json_spirit::str_type)
|
||||
values.push_back(s.get_str());
|
||||
else if (s.type() == json_spirit::null_type)
|
||||
{
|
||||
// mark entry for deletion
|
||||
values.push_back("");
|
||||
if (!values[0].find("0x"))
|
||||
values[0] = asString(fromHex(values[0].substr(2)));
|
||||
keysToBeDeleted.push_back(values[0]);
|
||||
}
|
||||
else
|
||||
BOOST_FAIL("Bad type (expected string)");
|
||||
}
|
||||
|
||||
BOOST_REQUIRE(values.size() == 2);
|
||||
ss.push_back(make_pair(values[0], values[1]));
|
||||
if (!ss.back().first.find("0x"))
|
||||
ss.back().first = asString(fromHex(ss.back().first.substr(2)));
|
||||
if (!ss.back().second.find("0x"))
|
||||
ss.back().second = asString(fromHex(ss.back().second.substr(2)));
|
||||
}
|
||||
|
||||
MemoryDB m;
|
||||
GenericTrieDB<MemoryDB> t(&m);
|
||||
MemoryDB hm;
|
||||
HashedGenericTrieDB<MemoryDB> ht(&hm);
|
||||
MemoryDB fm;
|
||||
FatGenericTrieDB<MemoryDB> ft(&fm);
|
||||
t.init();
|
||||
ht.init();
|
||||
ft.init();
|
||||
BOOST_REQUIRE(t.check(true));
|
||||
BOOST_REQUIRE(ht.check(true));
|
||||
BOOST_REQUIRE(ft.check(true));
|
||||
|
||||
for (auto const& k: ss)
|
||||
{
|
||||
if (find(keysToBeDeleted.begin(), keysToBeDeleted.end(), k.first) != keysToBeDeleted.end() && k.second.empty())
|
||||
t.remove(k.first), ht.remove(k.first), ft.remove(k.first);
|
||||
else
|
||||
t.insert(k.first, k.second), ht.insert(k.first, k.second), ft.insert(k.first, k.second);
|
||||
BOOST_REQUIRE(t.check(true));
|
||||
BOOST_REQUIRE(ht.check(true));
|
||||
BOOST_REQUIRE(ft.check(true));
|
||||
for (auto i = ft.begin(), j = t.begin(); i != ft.end() && j != t.end(); ++i, ++j)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(i == ft.end(), j == t.end());
|
||||
BOOST_REQUIRE((*i).first.toBytes() == (*j).first.toBytes());
|
||||
BOOST_REQUIRE((*i).second.toBytes() == (*j).second.toBytes());
|
||||
}
|
||||
BOOST_CHECK_EQUAL(ht.root(), ft.root());
|
||||
}
|
||||
|
||||
BOOST_REQUIRE(!o["root"].is_null());
|
||||
BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(t.root().asArray()));
|
||||
}
|
||||
}
|
||||
|
||||
inline h256 stringMapHash256(StringMap const& _s)
|
||||
{
|
||||
return hash256(_s);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(moreTrieTests)
|
||||
{
|
||||
cnote << "Testing Trie more...";
|
||||
#if 0
|
||||
// More tests...
|
||||
{
|
||||
MemoryDB m;
|
||||
GenericTrieDB<MemoryDB> t(&m);
|
||||
t.init(); // initialise as empty tree.
|
||||
cout << t;
|
||||
cout << m;
|
||||
cout << t.root() << endl;
|
||||
cout << hash256(StringMap()) << endl;
|
||||
|
||||
t.insert(string("tesz"), string("test"));
|
||||
cout << t;
|
||||
cout << m;
|
||||
cout << t.root() << endl;
|
||||
cout << stringMapHash256({{"test", "test"}}) << endl;
|
||||
|
||||
t.insert(string("tesa"), string("testy"));
|
||||
cout << t;
|
||||
cout << m;
|
||||
cout << t.root() << endl;
|
||||
cout << stringMapHash256({{"test", "test"}, {"te", "testy"}}) << endl;
|
||||
cout << t.at(string("test")) << endl;
|
||||
cout << t.at(string("te")) << endl;
|
||||
cout << t.at(string("t")) << endl;
|
||||
|
||||
t.remove(string("te"));
|
||||
cout << m;
|
||||
cout << t.root() << endl;
|
||||
cout << stringMapHash256({{"test", "test"}}) << endl;
|
||||
|
||||
t.remove(string("test"));
|
||||
cout << m;
|
||||
cout << t.root() << endl;
|
||||
cout << hash256(StringMap()) << endl;
|
||||
}
|
||||
{
|
||||
MemoryDB m;
|
||||
GenericTrieDB<MemoryDB> t(&m);
|
||||
t.init(); // initialise as empty tree.
|
||||
t.insert(string("a"), string("A"));
|
||||
t.insert(string("b"), string("B"));
|
||||
cout << t;
|
||||
cout << m;
|
||||
cout << t.root() << endl;
|
||||
cout << stringMapHash256({{"b", "B"}, {"a", "A"}}) << endl;
|
||||
cout << RLP(rlp256({{"b", "B"}, {"a", "A"}})) << endl;
|
||||
}
|
||||
{
|
||||
MemTrie t;
|
||||
t.insert("dog", "puppy");
|
||||
cout << hex << t.hash256() << endl;
|
||||
cout << RLP(t.rlp()) << endl;
|
||||
}
|
||||
{
|
||||
MemTrie t;
|
||||
t.insert("bed", "d");
|
||||
t.insert("be", "e");
|
||||
cout << hex << t.hash256() << endl;
|
||||
cout << RLP(t.rlp()) << endl;
|
||||
}
|
||||
{
|
||||
cout << hex << stringMapHash256({{"dog", "puppy"}, {"doe", "reindeer"}}) << endl;
|
||||
MemTrie t;
|
||||
t.insert("dog", "puppy");
|
||||
t.insert("doe", "reindeer");
|
||||
cout << hex << t.hash256() << endl;
|
||||
cout << RLP(t.rlp()) << endl;
|
||||
cout << toHex(t.rlp()) << endl;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
MemoryDB m;
|
||||
GenericTrieDB<MemoryDB> d(&m);
|
||||
d.init(); // initialise as empty tree.
|
||||
MemTrie t;
|
||||
StringMap s;
|
||||
|
||||
auto add = [&](char const* a, char const* b)
|
||||
{
|
||||
d.insert(string(a), string(b));
|
||||
t.insert(a, b);
|
||||
s[a] = b;
|
||||
|
||||
/*cout << endl << "-------------------------------" << endl;
|
||||
cout << a << " -> " << b << endl;
|
||||
cout << d;
|
||||
cout << m;
|
||||
cout << d.root() << endl;
|
||||
cout << hash256(s) << endl;*/
|
||||
|
||||
BOOST_REQUIRE(d.check(true));
|
||||
BOOST_REQUIRE_EQUAL(t.hash256(), hash256(s));
|
||||
BOOST_REQUIRE_EQUAL(d.root(), hash256(s));
|
||||
for (auto const& i: s)
|
||||
{
|
||||
(void)i;
|
||||
BOOST_REQUIRE_EQUAL(t.at(i.first), i.second);
|
||||
BOOST_REQUIRE_EQUAL(d.at(i.first), i.second);
|
||||
}
|
||||
};
|
||||
|
||||
auto remove = [&](char const* a)
|
||||
{
|
||||
s.erase(a);
|
||||
t.remove(a);
|
||||
d.remove(string(a));
|
||||
|
||||
/*cout << endl << "-------------------------------" << endl;
|
||||
cout << "X " << a << endl;
|
||||
cout << d;
|
||||
cout << m;
|
||||
cout << d.root() << endl;
|
||||
cout << hash256(s) << endl;*/
|
||||
|
||||
BOOST_REQUIRE(d.check(true));
|
||||
BOOST_REQUIRE(t.at(a).empty());
|
||||
BOOST_REQUIRE(d.at(string(a)).empty());
|
||||
BOOST_REQUIRE_EQUAL(t.hash256(), hash256(s));
|
||||
BOOST_REQUIRE_EQUAL(d.root(), hash256(s));
|
||||
for (auto const& i: s)
|
||||
{
|
||||
(void)i;
|
||||
BOOST_REQUIRE_EQUAL(t.at(i.first), i.second);
|
||||
BOOST_REQUIRE_EQUAL(d.at(i.first), i.second);
|
||||
}
|
||||
};
|
||||
|
||||
add("dogglesworth", "cat");
|
||||
add("doe", "reindeer");
|
||||
remove("dogglesworth");
|
||||
add("horse", "stallion");
|
||||
add("do", "verb");
|
||||
add("doge", "coin");
|
||||
remove("horse");
|
||||
remove("do");
|
||||
remove("doge");
|
||||
remove("doe");
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(trieLowerBound)
|
||||
{
|
||||
cnote << "Stress-testing Trie.lower_bound...";
|
||||
if (0)
|
||||
{
|
||||
MemoryDB dm;
|
||||
EnforceRefs e(dm, true);
|
||||
GenericTrieDB<MemoryDB> d(&dm);
|
||||
d.init(); // initialise as empty tree.
|
||||
for (int a = 0; a < 20; ++a)
|
||||
{
|
||||
StringMap m;
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
auto k = randomWord();
|
||||
auto v = toString(i);
|
||||
m[k] = v;
|
||||
d.insert(k, v);
|
||||
}
|
||||
|
||||
for (auto i: d)
|
||||
{
|
||||
auto it = d.lower_bound(i.first);
|
||||
for (auto iit = d.begin(); iit != d.end(); ++iit)
|
||||
if ((*iit).first.toString() >= i.first.toString())
|
||||
{
|
||||
BOOST_REQUIRE(it == iit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
auto k = randomWord();
|
||||
auto it = d.lower_bound(k);
|
||||
for (auto iit = d.begin(); iit != d.end(); ++iit)
|
||||
if ((*iit).first.toString() >= k)
|
||||
{
|
||||
BOOST_REQUIRE(it == iit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(trieStess)
|
||||
{
|
||||
cnote << "Stress-testing Trie...";
|
||||
if (0)
|
||||
{
|
||||
MemoryDB m;
|
||||
MemoryDB dm;
|
||||
EnforceRefs e(dm, true);
|
||||
GenericTrieDB<MemoryDB> d(&dm);
|
||||
d.init(); // initialise as empty tree.
|
||||
MemTrie t;
|
||||
BOOST_REQUIRE(d.check(true));
|
||||
for (int a = 0; a < 20; ++a)
|
||||
{
|
||||
StringMap m;
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
auto k = randomWord();
|
||||
auto v = toString(i);
|
||||
m[k] = v;
|
||||
t.insert(k, v);
|
||||
d.insert(k, v);
|
||||
BOOST_REQUIRE_EQUAL(hash256(m), t.hash256());
|
||||
BOOST_REQUIRE_EQUAL(hash256(m), d.root());
|
||||
BOOST_REQUIRE(d.check(true));
|
||||
}
|
||||
while (!m.empty())
|
||||
{
|
||||
auto k = m.begin()->first;
|
||||
auto v = m.begin()->second;
|
||||
d.remove(k);
|
||||
t.remove(k);
|
||||
m.erase(k);
|
||||
if (!d.check(true))
|
||||
{
|
||||
// cwarn << m;
|
||||
for (auto i: d)
|
||||
cwarn << i.first.toString() << i.second.toString();
|
||||
|
||||
MemoryDB dm2;
|
||||
EnforceRefs e2(dm2, true);
|
||||
GenericTrieDB<MemoryDB> d2(&dm2);
|
||||
d2.init(); // initialise as empty tree.
|
||||
for (auto i: d)
|
||||
d2.insert(i.first, i.second);
|
||||
|
||||
cwarn << "Good:" << d2.root();
|
||||
// for (auto i: dm2.get())
|
||||
// cwarn << i.first.abridged() << ": " << RLP(i.second);
|
||||
d2.debugStructure(cerr);
|
||||
cwarn << "Broken:" << d.root(); // Leaves an extension -> extension (3c1... -> 742...)
|
||||
// for (auto i: dm.get())
|
||||
// cwarn << i.first.abridged() << ": " << RLP(i.second);
|
||||
d.debugStructure(cerr);
|
||||
|
||||
d2.insert(k, v);
|
||||
cwarn << "Pres:" << d2.root();
|
||||
// for (auto i: dm2.get())
|
||||
// cwarn << i.first.abridged() << ": " << RLP(i.second);
|
||||
d2.debugStructure(cerr);
|
||||
g_logVerbosity = 99;
|
||||
d2.remove(k);
|
||||
g_logVerbosity = 4;
|
||||
|
||||
cwarn << "Good?" << d2.root();
|
||||
}
|
||||
BOOST_REQUIRE(d.check(true));
|
||||
BOOST_REQUIRE_EQUAL(hash256(m), t.hash256());
|
||||
BOOST_REQUIRE_EQUAL(hash256(m), d.root());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"String10MbData" :
|
||||
{
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091011121314151617181920212223240102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910111213141516171819202122232401020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030405060708091001020304050607080910010203040506070809100102030Line truncated
|
||||
"gasLimit" : "2000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,673 +0,0 @@
|
||||
{
|
||||
"RightVRSTest" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"NotEnoughGasLimit" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x",
|
||||
"gasLimit" : "20000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"V_overflow32bit" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x5544",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "4294967323",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"V_overflow32bitSigned" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x5544",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "2147483647",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"V_overflow64bit" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x5544",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "18446744073709551643",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"V_overflow64bitSigned" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x5544",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "18446744073709551388",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"WrongVRSTestVEqual26" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "26",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"WrongVRSTestVEqual29" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "29",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"WrongVRSTestVEqual31" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "31",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"WrongVRSTestVOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "310",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"WrongVRSTestIncorrectSize" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a02c3",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a302c3"
|
||||
}
|
||||
},
|
||||
|
||||
"SenderTest" : {
|
||||
"//" : "sender 0f65fe9276bc9a24ae7083ae28e2660ef72df99e",
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "secretkey 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"DataTestNotEnoughGAS" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x0358ac39584bc98a7c979f984b03",
|
||||
"gasLimit" : "21020",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "secretkey 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"DataTestEnoughGAS" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x0358ac39584bc98a7c979f984b03",
|
||||
"gasLimit" : "23000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "secretkey 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithTooManyRLPElements" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "10",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
|
||||
"extrafield" : "128472387293"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithTooFewRLPElements" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithHihghValue" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"TransactionWithHighValueOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "115792089237316195423570985008687907853269984665640564039457584007913129639936",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithSvalueHigh" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithSvalueTooHigh" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithSvalueOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f0000"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithRvalueOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd03641410000",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithRvalueHigh" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithRvalueTooHigh" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithRvaluePrefixed00" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0xebaaedce6af48a03bbfd25e8cd0364141",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithSvaluePrefixed00" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0xef0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithHihghNonce" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithNonceOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639936",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithHihghGas" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithHihghGasPrice" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithGasLimitxPriceOverflow" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||
"gasPrice" : "100000000000000000",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithGasPriceOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "115792089237316195423570985008687907853269984665640564039457584007913129639936",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"TransactionWithGasLimitOverflow" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639936",
|
||||
"gasPrice" : "123",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"AddressMoreThan20PrefixedBy0" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "0x12",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "123",
|
||||
"nonce" : "54",
|
||||
"to" : "0x0000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "11",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"EmptyTransaction" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "0",
|
||||
"gasPrice" : "0",
|
||||
"nonce" : "0",
|
||||
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0",
|
||||
"v" : "27",
|
||||
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
|
||||
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
|
||||
}
|
||||
},
|
||||
|
||||
"AddressMoreThan20" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b1c",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"AddressLessThan20" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "b9331677e6ebf",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"AddressLessThan20Prefixed0" : {
|
||||
"expect" : "valid",
|
||||
"transaction" :
|
||||
{
|
||||
"data" : "",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "0",
|
||||
"to" : "0x000000000000000000000000000b9331677e6ebf",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
|
||||
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
|
||||
}
|
||||
},
|
||||
|
||||
"unpadedRValue": {
|
||||
"expect" : "valid",
|
||||
"transaction": {
|
||||
"nonce": "13",
|
||||
"gasPrice": "0x09184e72a000",
|
||||
"gasLimit": "0xf710",
|
||||
"to": "7c47ef93268a311f4cad0c750724299e9b72c268",
|
||||
"data": "0x379607f50000000000000000000000000000000000000000000000000000000000000005",
|
||||
"r": "0x006ab6dda9f4df56ea45583af36660329147f1753f3724ea5eb9ed83e812ca77",
|
||||
"s": "0x495701e230667832c8999e884e366a61028633ecf951e8cd66d119f381ae5718",
|
||||
"v": "28",
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
|
||||
"libsecp256k1test": {
|
||||
"expect" : "valid",
|
||||
"transaction": {
|
||||
"nonce": "0",
|
||||
"gasPrice": "0x09184e72a000",
|
||||
"gasLimit": "0xf388",
|
||||
"to": "",
|
||||
"data": "0x",
|
||||
"r": "44",
|
||||
"s": "4",
|
||||
"v": "27",
|
||||
"value": "0"
|
||||
}
|
||||
},
|
||||
|
||||
"dataTx_bcValidBlockTest": {
|
||||
"expect" : "valid",
|
||||
"transaction": {
|
||||
"nonce": "0",
|
||||
"gasPrice": "50",
|
||||
"gasLimit": "50000",
|
||||
"to": "",
|
||||
"data": "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56",
|
||||
"r" : "0xc5689ed1ad124753d54576dfb4b571465a41900a1dff4058d8adf16f752013d0",
|
||||
"s" : "0xe221cbd70ec28c94a3b55ec771bcbc70778d6ee0b51ca7ea9514594c861b1884",
|
||||
"v": "28",
|
||||
"value": "0"
|
||||
}
|
||||
},
|
||||
|
||||
"RSsecp256k1" : {
|
||||
"expect" : "invalid",
|
||||
"transaction" : {
|
||||
"data" : "0x",
|
||||
"gasLimit" : "21000",
|
||||
"gasPrice" : "1",
|
||||
"nonce" : "3",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "10",
|
||||
"v" : "28",
|
||||
"r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",
|
||||
"s" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
|
||||
}
|
||||
}
|
||||
}
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file txTest.cpp
|
||||
* @author Marko Simovic <markobarko@gmail.com>
|
||||
* @date 2014
|
||||
* Simple peer transaction send test.
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <libethereum/Client.h>
|
||||
#include <libethereum/CanonBlockChain.h>
|
||||
#include <libethereum/EthereumHost.h>
|
||||
#include "TestHelper.h"
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
|
||||
// Disabled since tests shouldn't block. Need a short cut to avoid real mining.
|
||||
/*
|
||||
BOOST_AUTO_TEST_CASE(mine_local_simple_tx)
|
||||
{
|
||||
KeyPair kp1 = KeyPair::create();
|
||||
KeyPair kp2 = KeyPair::create();
|
||||
|
||||
Client c1("TestClient1", kp1.address(), (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
|
||||
//mine some blocks so that client 1 has a balance
|
||||
mine(c1, 1);
|
||||
auto c1bal = c1.state().balance(kp1.address());
|
||||
BOOST_REQUIRE(c1bal > 0);
|
||||
|
||||
//send c2 some eth from c1
|
||||
auto txAmount = c1bal / 2u;
|
||||
auto gasPrice = 10 * szabo;
|
||||
auto gas = dev::eth::c_callGas;
|
||||
c1.submitTransaction(kp1.secret(), txAmount, kp2.address(), bytes(), gas, gasPrice);
|
||||
|
||||
//mine some more to include the transaction on chain
|
||||
mine(c1, 1);
|
||||
auto c2bal = c1.state().balance(kp2.address());
|
||||
BOOST_REQUIRE(c2bal > 0);
|
||||
BOOST_REQUIRE(c2bal == txAmount);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(mine_and_send_to_peer)
|
||||
{
|
||||
KeyPair kp1 = KeyPair::create();
|
||||
KeyPair kp2 = KeyPair::create();
|
||||
|
||||
Client c1("TestClient1", kp1.address(), (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
Client c2("TestClient2", kp2.address(), (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
|
||||
connectClients(c1, c2);
|
||||
|
||||
//mine some blocks so that client 1 has a balance
|
||||
mine(c1, 1);
|
||||
auto c1bal = c1.state().balance(kp1.address());
|
||||
BOOST_REQUIRE(c1bal > 0);
|
||||
|
||||
//send c2 some eth from c1
|
||||
auto txAmount = c1bal / 2u;
|
||||
auto gasPrice = 10 * szabo;
|
||||
auto gas = dev::eth::c_callGas;
|
||||
c1.submitTransaction(kp1.secret(), txAmount, kp2.address(), bytes(), gas, gasPrice);
|
||||
|
||||
//mine some more to include the transaction on chain
|
||||
mine(c1, 1);
|
||||
auto c2bal = c2.state().balance(kp2.address());
|
||||
BOOST_REQUIRE(c2bal > 0);
|
||||
BOOST_REQUIRE(c2bal == txAmount);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(mine_and_send_to_peer_fee_check)
|
||||
{
|
||||
KeyPair kp1 = KeyPair::create();
|
||||
KeyPair kp2 = KeyPair::create();
|
||||
|
||||
Client c1("TestClient1", kp1.address(), (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
Client c2("TestClient2", kp2.address(), (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
|
||||
|
||||
connectClients(c1, c2);
|
||||
|
||||
//mine some blocks so that client 1 has a balance
|
||||
mine(c1, 1);
|
||||
|
||||
auto c1StartBalance = c1.state().balance(kp1.address());
|
||||
auto c2StartBalance = c2.state().balance(kp2.address());
|
||||
BOOST_REQUIRE(c1StartBalance > 0);
|
||||
BOOST_REQUIRE(c2StartBalance == 0);
|
||||
|
||||
//send c2 some eth from c1
|
||||
auto txAmount = c1StartBalance / 2u;
|
||||
auto gasPrice = 10 * szabo;
|
||||
auto gas = dev::eth::c_callGas;
|
||||
c1.submitTransaction(kp1.secret(), txAmount, c2.address(), bytes(), gas, gasPrice);
|
||||
|
||||
//mine some more, this time with second client (so he can get fees from first client's tx)
|
||||
mine(c2, 1);
|
||||
|
||||
auto c1EndBalance = c1.state().balance(kp1.address());
|
||||
auto c2EndBalance = c2.state().balance(kp2.address());
|
||||
BOOST_REQUIRE(c1EndBalance > 0);
|
||||
BOOST_REQUIRE(c1EndBalance == c1StartBalance - txAmount - gasPrice * gas);
|
||||
BOOST_REQUIRE(c2EndBalance > 0);
|
||||
}
|
||||
*/
|
||||
@@ -1,566 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file vm.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* vm test functions.
|
||||
*/
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <libethereum/Executive.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
#include "vm.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::test;
|
||||
|
||||
FakeExtVM::FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth): /// TODO: XXX: remove the default argument & fix.
|
||||
ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytes(), _previousBlock, _currentBlock, test::lastHashes(_currentBlock.number), _depth) {}
|
||||
|
||||
h160 FakeExtVM::create(u256 _endowment, u256& io_gas, bytesConstRef _init, OnOpFunc const&)
|
||||
{
|
||||
Address na = right160(sha3(rlpList(myAddress, get<1>(addresses[myAddress]))));
|
||||
|
||||
Transaction t(_endowment, gasPrice, io_gas, _init.toBytes());
|
||||
callcreates.push_back(t);
|
||||
return na;
|
||||
}
|
||||
|
||||
bool FakeExtVM::call(Address _receiveAddress, u256 _value, bytesConstRef _data, u256& io_gas, bytesRef _out, OnOpFunc const&, Address _myAddressOverride, Address _codeAddressOverride)
|
||||
{
|
||||
Transaction t(_value, gasPrice, io_gas, _receiveAddress, _data.toVector());
|
||||
callcreates.push_back(t);
|
||||
(void)_out;
|
||||
(void)_myAddressOverride;
|
||||
(void)_codeAddressOverride;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FakeExtVM::setTransaction(Address _caller, u256 _value, u256 _gasPrice, bytes const& _data)
|
||||
{
|
||||
caller = origin = _caller;
|
||||
value = _value;
|
||||
data = &(thisTxData = _data);
|
||||
gasPrice = _gasPrice;
|
||||
}
|
||||
|
||||
void FakeExtVM::setContract(Address _myAddress, u256 _myBalance, u256 _myNonce, map<u256, u256> const& _storage, bytes const& _code)
|
||||
{
|
||||
myAddress = _myAddress;
|
||||
set(myAddress, _myBalance, _myNonce, _storage, _code);
|
||||
}
|
||||
|
||||
void FakeExtVM::set(Address _a, u256 _myBalance, u256 _myNonce, map<u256, u256> const& _storage, bytes const& _code)
|
||||
{
|
||||
get<0>(addresses[_a]) = _myBalance;
|
||||
get<1>(addresses[_a]) = _myNonce;
|
||||
get<2>(addresses[_a]) = _storage;
|
||||
get<3>(addresses[_a]) = _code;
|
||||
}
|
||||
|
||||
void FakeExtVM::reset(u256 _myBalance, u256 _myNonce, map<u256, u256> const& _storage)
|
||||
{
|
||||
callcreates.clear();
|
||||
addresses.clear();
|
||||
set(myAddress, _myBalance, _myNonce, _storage, get<3>(addresses[myAddress]));
|
||||
}
|
||||
|
||||
void FakeExtVM::push(mObject& o, string const& _n, u256 _v)
|
||||
{
|
||||
o[_n] = toString(_v);
|
||||
}
|
||||
|
||||
void FakeExtVM::push(mArray& a, u256 _v)
|
||||
{
|
||||
a.push_back(toString(_v));
|
||||
}
|
||||
|
||||
mObject FakeExtVM::exportEnv()
|
||||
{
|
||||
mObject ret;
|
||||
ret["previousHash"] = toString(currentBlock.parentHash);
|
||||
push(ret, "currentDifficulty", currentBlock.difficulty);
|
||||
push(ret, "currentTimestamp", currentBlock.timestamp);
|
||||
ret["currentCoinbase"] = toString(currentBlock.coinbaseAddress);
|
||||
push(ret, "currentNumber", currentBlock.number);
|
||||
push(ret, "currentGasLimit", currentBlock.gasLimit);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FakeExtVM::importEnv(mObject& _o)
|
||||
{
|
||||
// cant use BOOST_REQUIRE, because this function is used outside boost test (createRandomTest)
|
||||
assert(_o.count("previousHash") > 0);
|
||||
assert(_o.count("currentGasLimit") > 0);
|
||||
assert(_o.count("currentDifficulty") > 0);
|
||||
assert(_o.count("currentTimestamp") > 0);
|
||||
assert(_o.count("currentCoinbase") > 0);
|
||||
assert(_o.count("currentNumber") > 0);
|
||||
|
||||
currentBlock.parentHash = h256(_o["previousHash"].get_str());
|
||||
currentBlock.number = toInt(_o["currentNumber"]);
|
||||
lastHashes = test::lastHashes(currentBlock.number);
|
||||
currentBlock.gasLimit = toInt(_o["currentGasLimit"]);
|
||||
currentBlock.difficulty = toInt(_o["currentDifficulty"]);
|
||||
currentBlock.timestamp = toInt(_o["currentTimestamp"]);
|
||||
currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str());
|
||||
}
|
||||
|
||||
mObject FakeExtVM::exportState()
|
||||
{
|
||||
mObject ret;
|
||||
for (auto const& a: addresses)
|
||||
{
|
||||
mObject o;
|
||||
push(o, "balance", get<0>(a.second));
|
||||
push(o, "nonce", get<1>(a.second));
|
||||
|
||||
{
|
||||
mObject store;
|
||||
for (auto const& s: get<2>(a.second))
|
||||
store["0x"+toHex(toCompactBigEndian(s.first))] = "0x"+toHex(toCompactBigEndian(s.second));
|
||||
o["storage"] = store;
|
||||
}
|
||||
o["code"] = "0x" + toHex(get<3>(a.second));
|
||||
|
||||
ret[toString(a.first)] = o;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FakeExtVM::importState(mObject& _object)
|
||||
{
|
||||
for (auto const& i: _object)
|
||||
{
|
||||
mObject o = i.second.get_obj();
|
||||
// cant use BOOST_REQUIRE, because this function is used outside boost test (createRandomTest)
|
||||
assert(o.count("balance") > 0);
|
||||
assert(o.count("nonce") > 0);
|
||||
assert(o.count("storage") > 0);
|
||||
assert(o.count("code") > 0);
|
||||
|
||||
auto& a = addresses[Address(i.first)];
|
||||
get<0>(a) = toInt(o["balance"]);
|
||||
get<1>(a) = toInt(o["nonce"]);
|
||||
for (auto const& j: o["storage"].get_obj())
|
||||
get<2>(a)[toInt(j.first)] = toInt(j.second);
|
||||
|
||||
get<3>(a) = importCode(o);
|
||||
}
|
||||
}
|
||||
|
||||
mObject FakeExtVM::exportExec()
|
||||
{
|
||||
mObject ret;
|
||||
ret["address"] = toString(myAddress);
|
||||
ret["caller"] = toString(caller);
|
||||
ret["origin"] = toString(origin);
|
||||
push(ret, "value", value);
|
||||
push(ret, "gasPrice", gasPrice);
|
||||
push(ret, "gas", gas);
|
||||
ret["data"] = "0x" + toHex(data);
|
||||
ret["code"] = "0x" + toHex(code);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FakeExtVM::importExec(mObject& _o)
|
||||
{
|
||||
// cant use BOOST_REQUIRE, because this function is used outside boost test (createRandomTest)
|
||||
assert(_o.count("address")> 0);
|
||||
assert(_o.count("caller") > 0);
|
||||
assert(_o.count("origin") > 0);
|
||||
assert(_o.count("value") > 0);
|
||||
assert(_o.count("data") > 0);
|
||||
assert(_o.count("gasPrice") > 0);
|
||||
assert(_o.count("gas") > 0);
|
||||
|
||||
myAddress = Address(_o["address"].get_str());
|
||||
caller = Address(_o["caller"].get_str());
|
||||
origin = Address(_o["origin"].get_str());
|
||||
value = toInt(_o["value"]);
|
||||
gasPrice = toInt(_o["gasPrice"]);
|
||||
gas = toInt(_o["gas"]);
|
||||
|
||||
thisTxCode.clear();
|
||||
code = thisTxCode;
|
||||
|
||||
thisTxCode = importCode(_o);
|
||||
if (_o["code"].type() != str_type && _o["code"].type() != array_type)
|
||||
code.clear();
|
||||
|
||||
thisTxData.clear();
|
||||
thisTxData = importData(_o);
|
||||
|
||||
data = &thisTxData;
|
||||
}
|
||||
|
||||
mArray FakeExtVM::exportCallCreates()
|
||||
{
|
||||
mArray ret;
|
||||
for (Transaction const& tx: callcreates)
|
||||
{
|
||||
mObject o;
|
||||
o["destination"] = tx.isCreation() ? "" : toString(tx.receiveAddress());
|
||||
push(o, "gasLimit", tx.gas());
|
||||
push(o, "value", tx.value());
|
||||
o["data"] = "0x" + toHex(tx.data());
|
||||
ret.push_back(o);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FakeExtVM::importCallCreates(mArray& _callcreates)
|
||||
{
|
||||
for (mValue& v: _callcreates)
|
||||
{
|
||||
auto tx = v.get_obj();
|
||||
assert(tx.count("data") > 0);
|
||||
assert(tx.count("value") > 0);
|
||||
assert(tx.count("destination") > 0);
|
||||
assert(tx.count("gasLimit") > 0);
|
||||
Transaction t = tx["destination"].get_str().empty() ?
|
||||
Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), fromHex(tx["data"].get_str())) :
|
||||
Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), Address(tx["destination"].get_str()), fromHex(tx["data"].get_str()));
|
||||
callcreates.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
eth::OnOpFunc FakeExtVM::simpleTrace()
|
||||
{
|
||||
|
||||
return [](uint64_t steps, eth::Instruction inst, bigint newMemSize, bigint gasCost, dev::eth::VM* voidVM, dev::eth::ExtVMFace const* voidExt)
|
||||
{
|
||||
FakeExtVM const& ext = *static_cast<FakeExtVM const*>(voidExt);
|
||||
eth::VM& vm = *voidVM;
|
||||
|
||||
std::ostringstream o;
|
||||
o << std::endl << " STACK" << std::endl;
|
||||
for (auto i: vm.stack())
|
||||
o << (h256)i << std::endl;
|
||||
o << " MEMORY" << std::endl << memDump(vm.memory());
|
||||
o << " STORAGE" << std::endl;
|
||||
|
||||
for (auto const& i: std::get<2>(ext.addresses.find(ext.myAddress)->second))
|
||||
o << std::showbase << std::hex << i.first << ": " << i.second << std::endl;
|
||||
|
||||
dev::LogOutputStream<eth::VMTraceChannel, false>(true) << o.str();
|
||||
dev::LogOutputStream<eth::VMTraceChannel, false>(false) << " | " << std::dec << ext.depth << " | " << ext.myAddress << " | #" << steps << " | " << std::hex << std::setw(4) << std::setfill('0') << vm.curPC() << " : " << instructionInfo(inst).name << " | " << std::dec << vm.gas() << " | -" << std::dec << gasCost << " | " << newMemSize << "x32" << " ]";
|
||||
|
||||
/*creates json stack trace*/
|
||||
if (eth::VMTraceChannel::verbosity <= g_logVerbosity)
|
||||
{
|
||||
Object o_step;
|
||||
|
||||
/*add the stack*/
|
||||
Array a_stack;
|
||||
for (auto i: vm.stack())
|
||||
a_stack.push_back((string)i);
|
||||
|
||||
o_step.push_back(Pair( "stack", a_stack ));
|
||||
|
||||
/*add the memory*/
|
||||
Array a_mem;
|
||||
for(auto i: vm.memory())
|
||||
a_mem.push_back(i);
|
||||
|
||||
o_step.push_back(Pair("memory", a_mem));
|
||||
|
||||
/*add the storage*/
|
||||
Object storage;
|
||||
for (auto const& i: std::get<2>(ext.addresses.find(ext.myAddress)->second))
|
||||
storage.push_back(Pair( (string)i.first , (string)i.second));
|
||||
|
||||
/*add all the other details*/
|
||||
o_step.push_back(Pair("storage", storage));
|
||||
o_step.push_back(Pair("depth", to_string(ext.depth)));
|
||||
o_step.push_back(Pair("gas", (string)vm.gas()));
|
||||
o_step.push_back(Pair("address", "0x" + toString(ext.myAddress )));
|
||||
o_step.push_back(Pair("step", steps ));
|
||||
o_step.push_back(Pair("pc", (int)vm.curPC()));
|
||||
o_step.push_back(Pair("opcode", instructionInfo(inst).name ));
|
||||
|
||||
/*append the JSON object to the log file*/
|
||||
Value v(o_step);
|
||||
ofstream os( "./stackTrace.json", ofstream::app);
|
||||
os << write_string(v, true) << ",";
|
||||
os.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace dev { namespace test {
|
||||
|
||||
void doVMTests(json_spirit::mValue& v, bool _fillin)
|
||||
{
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
std::cout << " " << i.first << "\n";
|
||||
mObject& o = i.second.get_obj();
|
||||
|
||||
BOOST_REQUIRE(o.count("env") > 0);
|
||||
BOOST_REQUIRE(o.count("pre") > 0);
|
||||
BOOST_REQUIRE(o.count("exec") > 0);
|
||||
|
||||
FakeExtVM fev;
|
||||
fev.importEnv(o["env"].get_obj());
|
||||
fev.importState(o["pre"].get_obj());
|
||||
|
||||
if (_fillin)
|
||||
o["pre"] = mValue(fev.exportState());
|
||||
|
||||
fev.importExec(o["exec"].get_obj());
|
||||
if (fev.code.empty())
|
||||
{
|
||||
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
|
||||
fev.code = fev.thisTxCode;
|
||||
}
|
||||
|
||||
bytes output;
|
||||
u256 gas;
|
||||
bool vmExceptionOccured = false;
|
||||
try
|
||||
{
|
||||
auto vm = eth::VMFactory::create(fev.gas);
|
||||
auto vmtrace = Options::get().vmtrace ? fev.simpleTrace() : OnOpFunc{};
|
||||
auto outputRef = bytesConstRef{};
|
||||
{
|
||||
Listener::ExecTimeGuard guard{i.first};
|
||||
outputRef = vm->go(fev, vmtrace);
|
||||
}
|
||||
output = outputRef.toBytes();
|
||||
gas = vm->gas();
|
||||
}
|
||||
catch (VMException const&)
|
||||
{
|
||||
std::cout << " Safe VM Exception\n";
|
||||
vmExceptionOccured = true;
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << diagnostic_information(_e);
|
||||
BOOST_ERROR("Failed VM Test with Exception: " << _e.what());
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
cnote << "VM did throw an exception: " << _e.what();
|
||||
BOOST_ERROR("Failed VM Test with Exception: " << _e.what());
|
||||
}
|
||||
|
||||
// delete null entries in storage for the sake of comparison
|
||||
|
||||
for (auto &a: fev.addresses)
|
||||
{
|
||||
vector<u256> keystoDelete;
|
||||
for (auto &s: get<2>(a.second))
|
||||
{
|
||||
if (s.second == 0)
|
||||
keystoDelete.push_back(s.first);
|
||||
}
|
||||
for (auto const key: keystoDelete )
|
||||
{
|
||||
get<2>(a.second).erase(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (_fillin)
|
||||
{
|
||||
o["env"] = mValue(fev.exportEnv());
|
||||
o["exec"] = mValue(fev.exportExec());
|
||||
if (!vmExceptionOccured)
|
||||
{
|
||||
o["post"] = mValue(fev.exportState());
|
||||
|
||||
if (o.count("expect") > 0)
|
||||
{
|
||||
State postState(OverlayDB(), eth::BaseState::Empty);
|
||||
State expectState(OverlayDB(), eth::BaseState::Empty);
|
||||
stateOptionsMap expectStateMap;
|
||||
ImportTest::importState(o["post"].get_obj(), postState);
|
||||
ImportTest::importState(o["expect"].get_obj(), expectState, expectStateMap);
|
||||
ImportTest::checkExpectedState(expectState, postState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow);
|
||||
o.erase(o.find("expect"));
|
||||
}
|
||||
|
||||
o["callcreates"] = fev.exportCallCreates();
|
||||
o["out"] = "0x" + toHex(output);
|
||||
fev.push(o, "gas", gas);
|
||||
o["logs"] = exportLog(fev.sub.logs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (o.count("post") > 0) // No exceptions expected
|
||||
{
|
||||
BOOST_CHECK(!vmExceptionOccured);
|
||||
|
||||
BOOST_REQUIRE(o.count("post") > 0);
|
||||
BOOST_REQUIRE(o.count("callcreates") > 0);
|
||||
BOOST_REQUIRE(o.count("out") > 0);
|
||||
BOOST_REQUIRE(o.count("gas") > 0);
|
||||
BOOST_REQUIRE(o.count("logs") > 0);
|
||||
|
||||
dev::test::FakeExtVM test;
|
||||
test.importState(o["post"].get_obj());
|
||||
test.importCallCreates(o["callcreates"].get_array());
|
||||
test.sub.logs = importLog(o["logs"].get_array());
|
||||
|
||||
checkOutput(output, o);
|
||||
|
||||
BOOST_CHECK_EQUAL(toInt(o["gas"]), gas);
|
||||
|
||||
State postState, expectState;
|
||||
mObject mPostState = fev.exportState();
|
||||
ImportTest::importState(mPostState, postState);
|
||||
ImportTest::importState(o["post"].get_obj(), expectState);
|
||||
ImportTest::checkExpectedState(expectState, postState);
|
||||
|
||||
checkAddresses<std::map<Address, std::tuple<u256, u256, std::map<u256, u256>, bytes> > >(test.addresses, fev.addresses);
|
||||
|
||||
checkCallCreates(fev.callcreates, test.callcreates);
|
||||
|
||||
checkLog(fev.sub.logs, test.sub.logs);
|
||||
}
|
||||
else // Exception expected
|
||||
BOOST_CHECK(vmExceptionOccured);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} } // Namespace Close
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(VMTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vm_tests)
|
||||
{
|
||||
dev::test::executeTests("vmtests", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmArithmeticTest)
|
||||
{
|
||||
dev::test::executeTests("vmArithmeticTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmBitwiseLogicOperationTest)
|
||||
{
|
||||
dev::test::executeTests("vmBitwiseLogicOperationTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmSha3Test)
|
||||
{
|
||||
dev::test::executeTests("vmSha3Test", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmEnvironmentalInfoTest)
|
||||
{
|
||||
dev::test::executeTests("vmEnvironmentalInfoTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmBlockInfoTest)
|
||||
{
|
||||
dev::test::executeTests("vmBlockInfoTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmIOandFlowOperationsTest)
|
||||
{
|
||||
dev::test::executeTests("vmIOandFlowOperationsTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmPushDupSwapTest)
|
||||
{
|
||||
dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmLogTest)
|
||||
{
|
||||
dev::test::executeTests("vmLogTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmSystemOperationsTest)
|
||||
{
|
||||
dev::test::executeTests("vmSystemOperationsTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmPerformanceTest)
|
||||
{
|
||||
if (test::Options::get().performance)
|
||||
dev::test::executeTests("vmPerformanceTest", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmInputLimitsTest1)
|
||||
{
|
||||
if (test::Options::get().inputLimits)
|
||||
dev::test::executeTests("vmInputLimits1", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmInputLimitsTest2)
|
||||
{
|
||||
if (test::Options::get().inputLimits)
|
||||
dev::test::executeTests("vmInputLimits2", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmInputLimitsLightTest)
|
||||
{
|
||||
if (test::Options::get().inputLimits)
|
||||
dev::test::executeTests("vmInputLimitsLight", "/VMTests", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vmRandom)
|
||||
{
|
||||
test::Options::get(); // parse command line options, e.g. to enable JIT
|
||||
|
||||
string testPath = getTestPath();
|
||||
testPath += "/VMTests/RandomTests";
|
||||
|
||||
vector<boost::filesystem::path> testFiles;
|
||||
boost::filesystem::directory_iterator iterator(testPath);
|
||||
for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
|
||||
if (boost::filesystem::is_regular_file(iterator->path()) && iterator->path().extension() == ".json")
|
||||
testFiles.push_back(iterator->path());
|
||||
|
||||
for (auto& path: testFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::cout << "TEST " << path.filename() << "\n";
|
||||
json_spirit::mValue v;
|
||||
string s = asString(dev::contents(path.string()));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");
|
||||
json_spirit::read_string(s, v);
|
||||
test::Listener::notifySuiteStarted(path.filename().string());
|
||||
doVMTests(v, false);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
BOOST_ERROR("Failed test with Exception: " << _e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(userDefinedFile)
|
||||
{
|
||||
dev::test::userDefinedTest("--singletest", dev::test::doVMTests);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file vm.h
|
||||
* @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
* vm test functions.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <json_spirit/json_spirit.h>
|
||||
#include <libdevcore/Log.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libevmcore/Instruction.h>
|
||||
#include <libevm/ExtVMFace.h>
|
||||
#include <libevm/VM.h>
|
||||
#include <liblll/Compiler.h>
|
||||
#include <libethereum/Transaction.h>
|
||||
#include <libethereum/ExtVM.h>
|
||||
#include <libethereum/State.h>
|
||||
#include "TestHelper.h"
|
||||
|
||||
namespace dev { namespace test {
|
||||
|
||||
struct FakeExtVMFailure : virtual Exception {};
|
||||
|
||||
class FakeExtVM: public eth::ExtVMFace
|
||||
{
|
||||
public:
|
||||
FakeExtVM() = default;
|
||||
FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth = 0);
|
||||
|
||||
virtual u256 store(u256 _n) override { return std::get<2>(addresses[myAddress])[_n]; }
|
||||
virtual void setStore(u256 _n, u256 _v) override { std::get<2>(addresses[myAddress])[_n] = _v; }
|
||||
virtual bool exists(Address _a) override { return !!addresses.count(_a); }
|
||||
virtual u256 balance(Address _a) override { return std::get<0>(addresses[_a]); }
|
||||
virtual void subBalance(u256 _a) override { std::get<0>(addresses[myAddress]) -= _a; }
|
||||
virtual u256 txCount(Address _a) override { return std::get<1>(addresses[_a]); }
|
||||
virtual void suicide(Address _a) override { std::get<0>(addresses[_a]) += std::get<0>(addresses[myAddress]); addresses.erase(myAddress); }
|
||||
virtual bytes const& codeAt(Address _a) override { return std::get<3>(addresses[_a]); }
|
||||
virtual h160 create(u256 _endowment, u256& io_gas, bytesConstRef _init, eth::OnOpFunc const&) override;
|
||||
virtual bool call(Address _receiveAddress, u256 _value, bytesConstRef _data, u256& io_gas, bytesRef _out, eth::OnOpFunc const&, Address, Address) override;
|
||||
void setTransaction(Address _caller, u256 _value, u256 _gasPrice, bytes const& _data);
|
||||
void setContract(Address _myAddress, u256 _myBalance, u256 _myNonce, std::map<u256, u256> const& _storage, bytes const& _code);
|
||||
void set(Address _a, u256 _myBalance, u256 _myNonce, std::map<u256, u256> const& _storage, bytes const& _code);
|
||||
void reset(u256 _myBalance, u256 _myNonce, std::map<u256, u256> const& _storage);
|
||||
void push(json_spirit::mObject& o, std::string const& _n, u256 _v);
|
||||
void push(json_spirit::mArray& a, u256 _v);
|
||||
u256 doPosts();
|
||||
json_spirit::mObject exportEnv();
|
||||
void importEnv(json_spirit::mObject& _o);
|
||||
json_spirit::mObject exportState();
|
||||
void importState(json_spirit::mObject& _object);
|
||||
json_spirit::mObject exportExec();
|
||||
void importExec(json_spirit::mObject& _o);
|
||||
json_spirit::mArray exportCallCreates();
|
||||
void importCallCreates(json_spirit::mArray& _callcreates);
|
||||
|
||||
eth::OnOpFunc simpleTrace();
|
||||
|
||||
std::map<Address, std::tuple<u256, u256, std::map<u256, u256>, bytes>> addresses;
|
||||
eth::Transactions callcreates;
|
||||
bytes thisTxData;
|
||||
bytes thisTxCode;
|
||||
u256 gas;
|
||||
};
|
||||
|
||||
|
||||
} } // Namespace Close
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,411 +0,0 @@
|
||||
{
|
||||
"blockhashNotExistingBlock": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "1",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 2) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"blockhashUnderFlow": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "1",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "(asm BLOCKHASH)",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"blockhashMyBlock": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "1",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 1) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"blockhash258Block": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "258",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 1) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"blockhash257Block": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "257",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"blockhashInRange": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "257",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6",
|
||||
"0x01" : "0xad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5",
|
||||
"0x02" : "0x6ca54da2c4784ea43fd88b3402de07ae4bced597cbb19f323b7595857a6720ae"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 1) [[ 1 ]] (BLOCKHASH 2) [[ 2 ]] (BLOCKHASH 256) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"blockhashOutOfRange": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "257",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (BLOCKHASH 0) [[ 1 ]] (BLOCKHASH 257) [[ 2 ]] (BLOCKHASH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"coinbase": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (COINBASE) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"timestamp": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (TIMESTAMP) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"number": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "1",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (NUMBER) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"difficulty": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x0100"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (DIFFICULTY) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"gaslimit": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x0f4240"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (GASLIMIT) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,176 +0,0 @@
|
||||
{
|
||||
"manyFunctions100": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"//" : "ManyFunctions.sol",
|
||||
"code" : "0x60e060020a60003504806301f99ad7146108c3578063023a624a146108d857806303bdecf5146108ed57806305fe035f14610902578063082d8f4914610917578063090bf3b71461092c5780630bd9c534146109415780630c4bfa94146109565780630e20ebe21461096b5780630f76de0d1461098057806310cfcc191461099557806313ce15a9146109aa578063140dcec4146109bf57806314d07a3e146109d45780631687f112146109e957806316eb6603146109fe578063172cf71714610a135780631bd6f59614610a285780631cdb857114610a3d5780631cf74ece14610a525780631d09ba2c14610a675780631f69aa5114610a7c578063223dcc7414610a9157806325e524d314610aa6578063261de7c414610abb5780632632924d14610ad05780632909cc5d14610ae55780632981699814610afa5780632a85a45d14610b0f5780632ca36da014610b245780632cbf1f0d14610b395780632d0f557314610b4e5780632d97867814610b6357806331db9efd14610b7857806332064db714610b8d57806332931fbb14610ba2578063355f51a014610bb7578063361bb34014610bcc578063364ddb0e14610be15780633792a01814610bf657806338c68f8f14610c0b57806338e586fd14610c20578063392d42ae14610c3557806339a87bd914610c4a5780633a95a33214610c5f5780633b8ecdf914610c745780633cf0659a14610c895780633eaf992314610c9e5780633fe97ead14610cb35780633ff11c8b14610cc8578063404efc5314610cdd578063407fce7b14610cf257806340c3b18714610d07578063440208c314610d1c57806344e86b2f14610d31578063455df57914610d465780634689ab4d14610d5b57806346be2e0c14610d70578063487cd86f14610d8557806348e6178214610d9a57806349d4a34414610daf5780634a0f597414610dc45780634bc24ec514610dd95780634c2fe45614610dee5780634cc885d414610e035780634eaaad7b14610e185780634eb166af14610e2d5780635050093414610e42578063506bff1114610e57578063508762c114610e6c578063526938f814610e8157806354400c6014610e96578063559510d814610eab57806355a5f70214610ec057806356ca528f14610ed5578063570a2a1614610eea5780635dab2e0f14610eff5780635dca53d314610f1457806362017ebc14610f29578063621a25f814610f3e578063626d4a3614610f5357806362b6a28214610f6857806364faf22c14610f7d57806366d7ffde14610f9257806367b886e814610fa757806367e902c714610fbc57806369d7774014610fd15780636b7ae8e614610fe65780636c3b659114610ffb5780636e54181e146110105780636e978d91146110255780636f63d2ec1461103a578063706332d11461104f57806370ac4bb9146110645780637138ef521461107957806371dd46a91461108e57806372a7c229146110a35780637376fc8d146110b8578063738a2679146110cd57806374552650146110e2578063746fc8d0146110f757806379254bb81461110c5780637adaa3f8146111215780637e4eb35b14611136578063885ec18e1461114b5780638b9ff6b6146111605780638ce113dc146111755780638defbc5e1461118a5780638f4613d51461119f5780638fdc24ba146111b45780639002dba4146111c957806391d15735146111de57806391d43b23146111f357806393b14daa1461120857806394d63afd1461121d57806395805dad1461123257806396f68782146112475780639740e4a21461125c578063981290131461127157806399a3f0e8146112865780639acb1ad41461129b5780639be07908146112b05780639c15be0b146112c55780639d451c4d146112da5780639d8ee943146112ef5780639ef6ca0f14611304578063a0db0a2214611319578063a18e2eb91461132e578063a408384914611343578063a57544da14611358578063a5a83e4d1461136d578063a6843f3414611382578063a6dacdd714611397578063a8c4c8bc146113ac578063aa058a73146113c1578063aad62da2146113d6578063aaf3e4f4146113eb578063ab81e77314611400578063abc93aee14611415578063abde33f71461142a578063b114b96c1461143f578063b3df873714611454578063b4174cb014611469578063b5d02a561461147e578063b731e84814611493578063b7b96723146114a8578063bbcded7a146114bd578063bbececa9146114d2578063beca7440146114e7578063bf8981c0146114fc578063c028c67414611511578063c2385fa614611526578063c319a02c1461153b578063c569bae014611550578063c6715f8114611565578063c7b98dec1461157a578063c9acab841461158f578063ca9efc73146115a4578063cad80024146115b9578063cdadb0fa146115ce578063cdbdf391146115e3578063cf460fa5146115f8578063cf69318a1461160d578063d1835b8c14611622578063d353a1cb14611637578063d3e141e01461164c578063d5ec7e1d14611661578063d7ead1de14611676578063d90b02aa1461168b578063d959e244146116a0578063d9e68b44146116b5578063daacb24f146116ca578063dc12a805146116df578063dd946033146116f4578063dda5142414611709578063de6612171461171e578063dfb9560c14611733578063e03827d214611748578063e21720001461175d578063e2c718d814611772578063e3da539914611787578063e48e603f1461179c578063e5f9ec29146117b1578063e6c0459a146117c6578063e70addec146117db578063e7a01215146117f0578063ea7f4d2714611805578063ebb6c59f1461181a578063ed6302be1461182f578063ed64b36b14611844578063eecd278914611859578063f0ed14e01461186e578063f0f2134414611883578063f1e328f914611898578063f1e6f4cd146118ad578063f32fe995146118c2578063f75165c6146118d7578063f7ed71d0146118ec578063f80f44f314611901578063f8bc050514611916578063fbd3c51a1461192b578063fd72009014611940578063fed3a3001461195557005b6108ce600435612edf565b8060005260206000f35b6108e3600435612fb5565b8060005260206000f35b6108f8600435613f47565b8060005260206000f35b61090d600435612a11565b8060005260206000f35b6109226004356127ec565b8060005260206000f35b61093760043561215c565b8060005260206000f35b61094c6004356128c2565b8060005260206000f35b61096160043561310f565b8060005260206000f35b610976600435614e0b565b8060005260206000f35b61098b600435613269565b8060005260206000f35b6109a0600435611a82565b8060005260206000f35b6109b5600435613e71565Line truncated
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"//" : "ManyFunctions.start(1)",
|
||||
"data" : "0x95805DAD0000000000000000000000000000000000000000000000000000000000000001",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
"ackermann31": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"//" : "PerformanceTester.sol",
|
||||
"code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"//" : "ackermann(3, 1)",
|
||||
"data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
"ackermann32": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"//" : "PerformanceTester.sol",
|
||||
"code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"//" : "ackermann(3, 2)",
|
||||
"data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
"ackermann33": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"//" : "PerformanceTester.sol",
|
||||
"code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"//" : "ackermann(3, 3)",
|
||||
"data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
"fibonacci10": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"//" : "PerformanceTester.sol",
|
||||
"code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"//" : "fibonacci(10)",
|
||||
"data" : "0x61047ff4000000000000000000000000000000000000000000000000000000000000000a",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
"fibonacci16": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "100000000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"//" : "PerformanceTester.sol",
|
||||
"code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"//" : "fibonacci(16)",
|
||||
"data" : "0x61047ff40000000000000000000000000000000000000000000000000000000000000010",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,589 +0,0 @@
|
||||
{
|
||||
"sha3_0": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 0 0)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "1000000000",
|
||||
"gas" : "100000000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_1": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 4 5)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_2": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x6bd2dd6bd408cbee33429358bf24fdc64612fbf8b1b4db604518f40ffd34b607"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 10 10)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_3": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 1000 0xfffff)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_4": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 0xfffffffff 100)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_5": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 10000 0xfffffffff )}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_6": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_bigSize": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x10000000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_bigOffset": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 2)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x10000000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_bigOffset2": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 0x1000000 2)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeNoQuadraticCost31": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 960 1)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost32": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 992 1)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost32_zeroSize": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 1024 0)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost33": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 1024 1)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost63": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 1984 1)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost64": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 2016 1)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost64_2": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 2016 32)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
},
|
||||
|
||||
"sha3_memSizeQuadraticCost65": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"expect" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"storage" : {
|
||||
"0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"nonce" : "0",
|
||||
"code" : "{ [[ 0 ]] (SHA3 2048 1)}",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"data" : "",
|
||||
"gasPrice" : "1",
|
||||
"gas" : "0x100000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,114 +0,0 @@
|
||||
{
|
||||
"suicide": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "(suicide (caller))",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"arith": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "{ (call (- (gas) 200) (caller) (+ 2 2 (* 4 4 4) (/ 2 2) (% 3 2) (- 8 2 2)) 0 0 0 0) }",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"boolean": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "(seq (when (and 1 1) (call (- (gas) 200) (caller) 2 0 0 0 0)) (when (and 1 0) (call (- (gas) 200) (caller) 3 0 0 0 0)) (when (and 0 1) (call (- (gas) 200) (caller) 4 0 0 0 0)) (when (and 0 0) (call (- (gas) 200) (caller) 5 0 0 0 0)) (when (or 1 1) (call (- (gas) 200) (caller) 12 0 0 0 0)) (when (or 1 0) (call (- (gas) 200) (caller) 13 0 0 0 0)) (when (or 0 1) (call (- (gas) 200) (caller) 14 0 0 0 0)) (when (or 0 0) (call (- (gas) 200) (caller) 15 0 0 0 0)) )",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"data" : "",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000"
|
||||
}
|
||||
},
|
||||
|
||||
"mktx": {
|
||||
"env" : {
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||
"currentNumber" : "0",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentDifficulty" : "256",
|
||||
"currentTimestamp" : "1",
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "100000000000000000000000",
|
||||
"nonce" : "0",
|
||||
"code" : "(call (- (gas) 200) (caller) 500000000000000000 0 0 0 0)",
|
||||
"storage": {}
|
||||
}
|
||||
},
|
||||
"exec" :
|
||||
{
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"gas" : "100000",
|
||||
"data" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,595 +0,0 @@
|
||||
/**
|
||||
* This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY!
|
||||
*/
|
||||
|
||||
#ifndef JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
|
||||
#define JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
|
||||
|
||||
#include <jsonrpccpp/client.h>
|
||||
|
||||
class WebThreeStubClient : public jsonrpc::Client
|
||||
{
|
||||
public:
|
||||
WebThreeStubClient(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {}
|
||||
|
||||
std::string web3_sha3(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("web3_sha3",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string web3_clientVersion() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("web3_clientVersion",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string net_version() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("net_version",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string net_peerCount() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("net_peerCount",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool net_listening() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("net_listening",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_protocolVersion() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_protocolVersion",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_hashrate() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_hashrate",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_coinbase",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_mining() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_mining",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_gasPrice",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_accounts() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_accounts",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_blockNumber() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_blockNumber",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getBalance(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getBalance",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getStorageAt(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
p.append(param3);
|
||||
Json::Value result = this->CallMethod("eth_getStorageAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getTransactionCount(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getTransactionCount",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getBlockTransactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getBlockTransactionCountByHash",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getBlockTransactionCountByNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getBlockTransactionCountByNumber",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getUncleCountByBlockHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getUncleCountByBlockHash",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getUncleCountByBlockNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getUncleCountByBlockNumber",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_getCode(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getCode",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_sendTransaction(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_sendTransaction",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_call(const Json::Value& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_call",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_flush() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_flush",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getBlockByHash(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getBlockByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getBlockByNumber(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getBlockByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getTransactionByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getTransactionByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getTransactionByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getTransactionByBlockHashAndIndex",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getTransactionByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getTransactionByBlockNumberAndIndex",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getUncleByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getUncleByBlockHashAndIndex",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getUncleByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_getUncleByBlockNumberAndIndex",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getCompilers() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_getCompilers",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_compileLLL(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_compileLLL",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_compileSerpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_compileSerpent",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_compileSolidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_compileSolidity",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_newFilter",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_newBlockFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_newBlockFilter",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_uninstallFilter",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getFilterChanges",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getFilterLogs(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getFilterLogs",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getLogs(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_getLogs",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_getWork() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_getWork",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_submitWork(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_submitWork",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_register(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_register",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_unregister(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_unregister",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_fetchQueuedTransactions(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_fetchQueuedTransactions",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
p.append(param3);
|
||||
Json::Value result = this->CallMethod("db_put",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("db_get",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_post",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_newIdentity() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("shh_newIdentity",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool shh_hasIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_hasIdentity",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("shh_newGroup",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("shh_addToGroup",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_newFilter",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool shh_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_uninstallFilter",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value shh_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_getFilterChanges",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value shh_getMessages(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_getMessages",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
};
|
||||
|
||||
#endif //JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
|
||||
@@ -1,301 +0,0 @@
|
||||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file whisperTopic.cpp
|
||||
* @author Gav Wood <i@gavwood.com>
|
||||
* @date 2014
|
||||
*/
|
||||
#include <functional>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <libp2p/Host.h>
|
||||
#include <libwhisper/WhisperPeer.h>
|
||||
#include <libwhisper/WhisperHost.h>
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::p2p;
|
||||
using namespace dev::shh;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(whisper)
|
||||
|
||||
#if ALEX_HASH_FIXED_NETWORKING
|
||||
BOOST_AUTO_TEST_CASE(topic)
|
||||
{
|
||||
cnote << "Testing Whisper...";
|
||||
auto oldLogVerbosity = g_logVerbosity;
|
||||
g_logVerbosity = 0;
|
||||
|
||||
Host host1("Test", NetworkPreferences(30303, "127.0.0.1", false, true));
|
||||
auto whost1 = host1.registerCapability(new WhisperHost());
|
||||
host1.start();
|
||||
|
||||
while (!host1.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
bool started = false;
|
||||
unsigned result = 0;
|
||||
std::thread listener([&]()
|
||||
{
|
||||
setThreadName("other");
|
||||
started = true;
|
||||
|
||||
/// Only interested in odd packets
|
||||
auto w = whost1->installWatch(BuildTopicMask("odd"));
|
||||
|
||||
started = true;
|
||||
set<unsigned> received;
|
||||
|
||||
for (int iterout = 0, last = 0; iterout < 200 && last < 81; ++iterout)
|
||||
{
|
||||
for (auto i: whost1->checkWatch(w))
|
||||
{
|
||||
Message msg = whost1->envelope(i).open(whost1->fullTopic(w));
|
||||
last = RLP(msg.payload()).toInt<unsigned>();
|
||||
if (received.count(last))
|
||||
continue;
|
||||
received.insert(last);
|
||||
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
|
||||
result += last;
|
||||
}
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Host host2("Test", NetworkPreferences(30300, "127.0.0.1", false, true));
|
||||
auto whost2 = host2.registerCapability(new WhisperHost());
|
||||
host2.start();
|
||||
|
||||
while (!host2.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(100));
|
||||
host2.addNode(host1.id(), "127.0.0.1", 30303, 30303);
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(500));
|
||||
|
||||
while (!started)
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
KeyPair us = KeyPair::create();
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
whost2->post(us.sec(), RLPStream().append(i * i).out(), BuildTopic(i)(i % 2 ? "odd" : "even"));
|
||||
this_thread::sleep_for(chrono::milliseconds(250));
|
||||
}
|
||||
|
||||
listener.join();
|
||||
g_logVerbosity = oldLogVerbosity;
|
||||
|
||||
BOOST_REQUIRE_EQUAL(result, 1 + 9 + 25 + 49 + 81);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(forwarding)
|
||||
{
|
||||
cnote << "Testing Whisper forwarding...";
|
||||
auto oldLogVerbosity = g_logVerbosity;
|
||||
g_logVerbosity = 0;
|
||||
|
||||
// Host must be configured not to share peers.
|
||||
Host host1("Listner", NetworkPreferences(30303, "", false, true));
|
||||
host1.setIdealPeerCount(0);
|
||||
auto whost1 = host1.registerCapability(new WhisperHost());
|
||||
host1.start();
|
||||
while (!host1.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
unsigned result = 0;
|
||||
bool done = false;
|
||||
|
||||
bool startedListener = false;
|
||||
std::thread listener([&]()
|
||||
{
|
||||
setThreadName("listener");
|
||||
|
||||
startedListener = true;
|
||||
|
||||
/// Only interested in odd packets
|
||||
auto w = whost1->installWatch(BuildTopicMask("test"));
|
||||
|
||||
for (int i = 0; i < 200 && !result; ++i)
|
||||
{
|
||||
for (auto i: whost1->checkWatch(w))
|
||||
{
|
||||
Message msg = whost1->envelope(i).open(whost1->fullTopic(w));
|
||||
unsigned last = RLP(msg.payload()).toInt<unsigned>();
|
||||
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
|
||||
result = last;
|
||||
}
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Host must be configured not to share peers.
|
||||
Host host2("Forwarder", NetworkPreferences(30305, "", false, true));
|
||||
host2.setIdealPeerCount(1);
|
||||
auto whost2 = host2.registerCapability(new WhisperHost());
|
||||
host2.start();
|
||||
while (!host2.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
Public fwderid;
|
||||
bool startedForwarder = false;
|
||||
std::thread forwarder([&]()
|
||||
{
|
||||
setThreadName("forwarder");
|
||||
|
||||
while (!startedListener)
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(500));
|
||||
host2.addNode(host1.id(), "127.0.0.1", 30303, 30303);
|
||||
|
||||
startedForwarder = true;
|
||||
|
||||
/// Only interested in odd packets
|
||||
auto w = whost2->installWatch(BuildTopicMask("test"));
|
||||
|
||||
while (!done)
|
||||
{
|
||||
for (auto i: whost2->checkWatch(w))
|
||||
{
|
||||
Message msg = whost2->envelope(i).open(whost2->fullTopic(w));
|
||||
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
|
||||
}
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
}
|
||||
});
|
||||
|
||||
while (!startedForwarder)
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
|
||||
Host ph("Sender", NetworkPreferences(30300, "", false, true));
|
||||
ph.setIdealPeerCount(1);
|
||||
shared_ptr<WhisperHost> wh = ph.registerCapability(new WhisperHost());
|
||||
ph.start();
|
||||
ph.addNode(host2.id(), "127.0.0.1", 30305, 30305);
|
||||
while (!ph.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(10));
|
||||
|
||||
KeyPair us = KeyPair::create();
|
||||
wh->post(us.sec(), RLPStream().append(1).out(), BuildTopic("test"));
|
||||
this_thread::sleep_for(chrono::milliseconds(250));
|
||||
|
||||
listener.join();
|
||||
done = true;
|
||||
forwarder.join();
|
||||
g_logVerbosity = oldLogVerbosity;
|
||||
|
||||
BOOST_REQUIRE_EQUAL(result, 1);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(asyncforwarding)
|
||||
{
|
||||
cnote << "Testing Whisper async forwarding...";
|
||||
auto oldLogVerbosity = g_logVerbosity;
|
||||
g_logVerbosity = 2;
|
||||
|
||||
unsigned result = 0;
|
||||
bool done = false;
|
||||
|
||||
// Host must be configured not to share peers.
|
||||
Host host1("Forwarder", NetworkPreferences(30305, "", false, true));
|
||||
host1.setIdealPeerCount(1);
|
||||
auto whost1 = host1.registerCapability(new WhisperHost());
|
||||
host1.start();
|
||||
while (!host1.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
bool startedForwarder = false;
|
||||
std::thread forwarder([&]()
|
||||
{
|
||||
setThreadName("forwarder");
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(500));
|
||||
// ph.addNode("127.0.0.1", 30303, 30303);
|
||||
|
||||
startedForwarder = true;
|
||||
|
||||
/// Only interested in odd packets
|
||||
auto w = whost1->installWatch(BuildTopicMask("test"));
|
||||
|
||||
while (!done)
|
||||
{
|
||||
for (auto i: whost1->checkWatch(w))
|
||||
{
|
||||
Message msg = whost1->envelope(i).open(whost1->fullTopic(w));
|
||||
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
|
||||
}
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
}
|
||||
});
|
||||
|
||||
while (!startedForwarder)
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
|
||||
{
|
||||
Host host2("Sender", NetworkPreferences(30300, "", false, true));
|
||||
host2.setIdealPeerCount(1);
|
||||
shared_ptr<WhisperHost> whost2 = host2.registerCapability(new WhisperHost());
|
||||
host2.start();
|
||||
while (!host2.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
host2.addNode(host1.id(), "127.0.0.1", 30305, 30305);
|
||||
|
||||
while (!host2.peerCount())
|
||||
this_thread::sleep_for(chrono::milliseconds(5));
|
||||
|
||||
KeyPair us = KeyPair::create();
|
||||
whost2->post(us.sec(), RLPStream().append(1).out(), BuildTopic("test"));
|
||||
this_thread::sleep_for(chrono::milliseconds(250));
|
||||
}
|
||||
|
||||
{
|
||||
Host ph("Listener", NetworkPreferences(30300, "", false, true));
|
||||
ph.setIdealPeerCount(1);
|
||||
shared_ptr<WhisperHost> wh = ph.registerCapability(new WhisperHost());
|
||||
ph.start();
|
||||
while (!ph.isStarted())
|
||||
this_thread::sleep_for(chrono::milliseconds(2));
|
||||
ph.addNode(host1.id(), "127.0.0.1", 30305, 30305);
|
||||
|
||||
/// Only interested in odd packets
|
||||
auto w = wh->installWatch(BuildTopicMask("test"));
|
||||
|
||||
for (int i = 0; i < 200 && !result; ++i)
|
||||
{
|
||||
for (auto i: wh->checkWatch(w))
|
||||
{
|
||||
Message msg = wh->envelope(i).open(wh->fullTopic(w));
|
||||
unsigned last = RLP(msg.payload()).toInt<unsigned>();
|
||||
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
|
||||
result = last;
|
||||
}
|
||||
this_thread::sleep_for(chrono::milliseconds(50));
|
||||
}
|
||||
}
|
||||
|
||||
done = true;
|
||||
forwarder.join();
|
||||
g_logVerbosity = oldLogVerbosity;
|
||||
|
||||
BOOST_REQUIRE_EQUAL(result, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
Reference in new issue
Block a user