mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'develop' of https://github.com/ethereum/cpp-ethereum into develop
This commit is contained in:
commit
2f73e8e6bc
@ -4,11 +4,12 @@ aux_source_directory(. SRC_LIST)
|
|||||||
list(REMOVE_ITEM SRC_LIST "./createRandomTest.cpp")
|
list(REMOVE_ITEM SRC_LIST "./createRandomTest.cpp")
|
||||||
list(REMOVE_ITEM SRC_LIST "./checkRandomTest.cpp")
|
list(REMOVE_ITEM SRC_LIST "./checkRandomTest.cpp")
|
||||||
|
|
||||||
|
include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS})
|
||||||
|
include_directories(BEFORE ..)
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
include_directories(${CRYPTOPP_INCLUDE_DIRS})
|
include_directories(${CRYPTOPP_INCLUDE_DIRS})
|
||||||
include_directories(${JSONCPP_INCLUDE_DIRS})
|
|
||||||
include_directories(${JSON_RPC_CPP_INCLUDE_DIRS})
|
include_directories(${JSON_RPC_CPP_INCLUDE_DIRS})
|
||||||
include_directories(..)
|
|
||||||
|
|
||||||
file(GLOB HEADERS "*.h")
|
file(GLOB HEADERS "*.h")
|
||||||
add_executable(testeth ${SRC_LIST} ${HEADERS})
|
add_executable(testeth ${SRC_LIST} ${HEADERS})
|
||||||
|
1513
ManyFunctions.sol
Normal file
1513
ManyFunctions.sol
Normal file
File diff suppressed because it is too large
Load Diff
24
ManyFunctionsGenerator.py
Normal file
24
ManyFunctionsGenerator.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
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)
|
17
PerformaceTester.sol
Normal file
17
PerformaceTester.sol
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(smoke_test)
|
|||||||
"}\n";
|
"}\n";
|
||||||
bytes code = compileContract(sourceCode);
|
bytes code = compileContract(sourceCode);
|
||||||
|
|
||||||
unsigned boilerplateSize = 69;
|
unsigned boilerplateSize = 70;
|
||||||
bytes expectation({byte(Instruction::JUMPDEST),
|
bytes expectation({byte(Instruction::JUMPDEST),
|
||||||
byte(Instruction::PUSH1), 0x0, // initialize local variable x
|
byte(Instruction::PUSH1), 0x0, // initialize local variable x
|
||||||
byte(Instruction::PUSH1), 0x2,
|
byte(Instruction::PUSH1), 0x2,
|
||||||
@ -114,8 +114,8 @@ BOOST_AUTO_TEST_CASE(ifStatement)
|
|||||||
" function f() { bool x; if (x) 77; else if (!x) 78; else 79; }"
|
" function f() { bool x; if (x) 77; else if (!x) 78; else 79; }"
|
||||||
"}\n";
|
"}\n";
|
||||||
bytes code = compileContract(sourceCode);
|
bytes code = compileContract(sourceCode);
|
||||||
unsigned shift = 56;
|
unsigned shift = 57;
|
||||||
unsigned boilerplateSize = 69;
|
unsigned boilerplateSize = 70;
|
||||||
bytes expectation({byte(Instruction::JUMPDEST),
|
bytes expectation({byte(Instruction::JUMPDEST),
|
||||||
byte(Instruction::PUSH1), 0x0,
|
byte(Instruction::PUSH1), 0x0,
|
||||||
byte(Instruction::DUP1),
|
byte(Instruction::DUP1),
|
||||||
@ -155,8 +155,8 @@ BOOST_AUTO_TEST_CASE(loops)
|
|||||||
" function f() { while(true){1;break;2;continue;3;return;4;} }"
|
" function f() { while(true){1;break;2;continue;3;return;4;} }"
|
||||||
"}\n";
|
"}\n";
|
||||||
bytes code = compileContract(sourceCode);
|
bytes code = compileContract(sourceCode);
|
||||||
unsigned shift = 56;
|
unsigned shift = 57;
|
||||||
unsigned boilerplateSize = 69;
|
unsigned boilerplateSize = 70;
|
||||||
bytes expectation({byte(Instruction::JUMPDEST),
|
bytes expectation({byte(Instruction::JUMPDEST),
|
||||||
byte(Instruction::JUMPDEST),
|
byte(Instruction::JUMPDEST),
|
||||||
byte(Instruction::PUSH1), 0x1,
|
byte(Instruction::PUSH1), 0x1,
|
||||||
|
@ -2273,6 +2273,21 @@ BOOST_AUTO_TEST_CASE(store_bytes)
|
|||||||
BOOST_CHECK(callContractFunction("save()", "abcdefg") == encodeArgs(24));
|
BOOST_CHECK(callContractFunction("save()", "abcdefg") == encodeArgs(24));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(bytes_from_calldata_to_memory)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract C {
|
||||||
|
function() returns (hash) {
|
||||||
|
return sha3("abc", msg.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
bytes calldata1 = bytes(61, 0x22) + bytes(12, 0x12);
|
||||||
|
sendMessage(calldata1, false);
|
||||||
|
BOOST_CHECK(m_output == encodeArgs(dev::sha3(bytes{'a', 'b', 'c'} + calldata1)));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(call_forward_bytes)
|
BOOST_AUTO_TEST_CASE(call_forward_bytes)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
@ -2424,6 +2439,144 @@ BOOST_AUTO_TEST_CASE(bytes_length_member)
|
|||||||
BOOST_CHECK(callContractFunction("getLength()") == encodeArgs(4+32+32));
|
BOOST_CHECK(callContractFunction("getLength()") == encodeArgs(4+32+32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(struct_copy)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
struct Nested { uint x; uint y; }
|
||||||
|
struct Struct { uint a; mapping(uint => Struct) b; Nested nested; uint c; }
|
||||||
|
mapping(uint => Struct) public data;
|
||||||
|
function set(uint k) returns (bool) {
|
||||||
|
data[k].a = 1;
|
||||||
|
data[k].nested.x = 3;
|
||||||
|
data[k].nested.y = 4;
|
||||||
|
data[k].c = 2;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function copy(uint from, uint to) returns (bool) {
|
||||||
|
data[to] = data[from];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function retrieve(uint k) returns (uint a, uint x, uint y, uint c)
|
||||||
|
{
|
||||||
|
a = data[k].a;
|
||||||
|
x = data[k].nested.x;
|
||||||
|
y = data[k].nested.y;
|
||||||
|
c = data[k].c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("set(uint256)", 7) == encodeArgs(true));
|
||||||
|
BOOST_CHECK(callContractFunction("retrieve(uint256)", 7) == encodeArgs(1, 3, 4, 2));
|
||||||
|
BOOST_CHECK(callContractFunction("copy(uint256,uint256)", 7, 8) == encodeArgs(true));
|
||||||
|
BOOST_CHECK(callContractFunction("retrieve(uint256)", 7) == encodeArgs(1, 3, 4, 2));
|
||||||
|
BOOST_CHECK(callContractFunction("retrieve(uint256)", 8) == encodeArgs(1, 3, 4, 2));
|
||||||
|
BOOST_CHECK(callContractFunction("copy(uint256,uint256)", 0, 7) == encodeArgs(true));
|
||||||
|
BOOST_CHECK(callContractFunction("retrieve(uint256)", 7) == encodeArgs(0, 0, 0, 0));
|
||||||
|
BOOST_CHECK(callContractFunction("retrieve(uint256)", 8) == encodeArgs(1, 3, 4, 2));
|
||||||
|
BOOST_CHECK(callContractFunction("copy(uint256,uint256)", 7, 8) == encodeArgs(true));
|
||||||
|
BOOST_CHECK(callContractFunction("retrieve(uint256)", 8) == encodeArgs(0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(struct_copy_via_local)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
struct Struct { uint a; uint b; }
|
||||||
|
Struct data1;
|
||||||
|
Struct data2;
|
||||||
|
function test() returns (bool) {
|
||||||
|
data1.a = 1;
|
||||||
|
data1.b = 2;
|
||||||
|
var x = data1;
|
||||||
|
data2 = x;
|
||||||
|
return data2.a == data1.a && data2.b == data1.b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("test()") == encodeArgs(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(using_enums)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
choices = ActionChoices.GoStraight;
|
||||||
|
}
|
||||||
|
function getChoice() returns (uint d)
|
||||||
|
{
|
||||||
|
d = uint256(choices);
|
||||||
|
}
|
||||||
|
ActionChoices choices;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("getChoice()") == encodeArgs(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(constructing_enums_from_ints)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
enum Truth { False, True }
|
||||||
|
function test() returns (uint)
|
||||||
|
{
|
||||||
|
return uint(Truth(uint8(0x701)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("test()") == encodeArgs(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_function)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
function f(uint a) returns (uint) { return a; }
|
||||||
|
function test(uint a, uint b) external returns (uint r_a, uint r_b) {
|
||||||
|
r_a = f(a + 7);
|
||||||
|
r_b = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("test(uint256,uint256)", 2, 3) == encodeArgs(2+7, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(bytes_in_arguments)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
uint result;
|
||||||
|
function f(uint a, uint b) { result += a + b; }
|
||||||
|
function g(uint a) { result *= a; }
|
||||||
|
function test(uint a, bytes data1, bytes data2, uint b) external returns (uint r_a, uint r, uint r_b, uint l) {
|
||||||
|
r_a = a;
|
||||||
|
this.call(data1);
|
||||||
|
this.call(data2);
|
||||||
|
r = result;
|
||||||
|
r_b = b;
|
||||||
|
l = data1.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
string innercalldata1 = asString(FixedHash<4>(dev::sha3("f(uint256,uint256)")).asBytes() + encodeArgs(8, 9));
|
||||||
|
bytes calldata1 = encodeArgs(u256(innercalldata1.length()), 12, innercalldata1, 13);
|
||||||
|
string innercalldata2 = asString(FixedHash<4>(dev::sha3("g(uint256)")).asBytes() + encodeArgs(3));
|
||||||
|
bytes calldata = encodeArgs(
|
||||||
|
u256(innercalldata1.length()), u256(innercalldata2.length()),
|
||||||
|
12, innercalldata1, innercalldata2, 13);
|
||||||
|
BOOST_CHECK(callContractFunction("test(uint256,bytes,bytes,uint256)", calldata)
|
||||||
|
== encodeArgs(12, (8 + 9) * 3, 13, u256(innercalldata1.length())));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,24 +111,6 @@ BOOST_AUTO_TEST_CASE(exclude_fallback_function)
|
|||||||
BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}");
|
BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(event)
|
|
||||||
{
|
|
||||||
ContractDefinition const& contract = checkInterface(
|
|
||||||
"contract test { event Event; }");
|
|
||||||
BOOST_REQUIRE_EQUAL(1, contract.getEvents().size());
|
|
||||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getEvents().front()),
|
|
||||||
"event Event;");
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(event_arguments)
|
|
||||||
{
|
|
||||||
ContractDefinition const& contract = checkInterface(
|
|
||||||
"contract test { event Event(uint a, uint indexed b); }");
|
|
||||||
BOOST_REQUIRE_EQUAL(1, contract.getEvents().size());
|
|
||||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getEvents().front()),
|
|
||||||
"event Event(uint256 a,uint256 indexed b);");
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(events)
|
BOOST_AUTO_TEST_CASE(events)
|
||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
@ -137,10 +119,8 @@ BOOST_AUTO_TEST_CASE(events)
|
|||||||
" event e2(); \n"
|
" event e2(); \n"
|
||||||
"}\n";
|
"}\n";
|
||||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||||
set<string> expectation({"event e1(uint256 b,address indexed c);", "event e2;"});
|
// events should not appear in the Solidity Interface
|
||||||
BOOST_REQUIRE_EQUAL(2, contract.getEvents().size());
|
BOOST_REQUIRE_EQUAL(0, contract.getEvents().size());
|
||||||
BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.getEvents().at(0)),
|
|
||||||
getSourcePart(*contract.getEvents().at(1))}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(inheritance)
|
BOOST_AUTO_TEST_CASE(inheritance)
|
||||||
@ -155,12 +135,8 @@ BOOST_AUTO_TEST_CASE(inheritance)
|
|||||||
" event derivedEvent(uint indexed evtArgDerived); \n"
|
" event derivedEvent(uint indexed evtArgDerived); \n"
|
||||||
" }";
|
" }";
|
||||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||||
set<string> expectedEvents({"event derivedEvent(uint256 indexed evtArgDerived);",
|
|
||||||
"event baseEvent(string32 indexed evtArgBase);"});
|
|
||||||
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
|
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
|
||||||
"function derivedFunction(string32 p)returns(string32 i){}"});
|
"function derivedFunction(string32 p)returns(string32 i){}"});
|
||||||
BOOST_CHECK(expectedEvents == set<string>({getSourcePart(*contract.getEvents().at(0)),
|
|
||||||
getSourcePart(*contract.getEvents().at(1))}));
|
|
||||||
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
||||||
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
||||||
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
||||||
|
@ -332,7 +332,7 @@ BOOST_AUTO_TEST_CASE(assignment_to_struct)
|
|||||||
" data = a;\n"
|
" data = a;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(returns_in_constructor)
|
BOOST_AUTO_TEST_CASE(returns_in_constructor)
|
||||||
@ -992,6 +992,177 @@ BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big)
|
|||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_member_access)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
choices = ActionChoices.GoStraight;
|
||||||
|
}
|
||||||
|
ActionChoices choices;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_invalid_member_access)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
choices = ActionChoices.RunAroundWavingYourHands;
|
||||||
|
}
|
||||||
|
ActionChoices choices;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
a = uint256(ActionChoices.GoStraight);
|
||||||
|
b = uint64(ActionChoices.Sit);
|
||||||
|
}
|
||||||
|
uint256 a;
|
||||||
|
uint64 b;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(int_to_enum_explicit_conversion_is_okay)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
a = 2;
|
||||||
|
b = ActionChoices(a);
|
||||||
|
}
|
||||||
|
uint256 a;
|
||||||
|
ActionChoices b;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
a = ActionChoices.GoStraight;
|
||||||
|
b = ActionChoices.Sit;
|
||||||
|
}
|
||||||
|
uint256 a;
|
||||||
|
uint64 b;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_duplicate_values)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoLeft, Sit }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(text), DeclarationError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(private_visibility)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract base {
|
||||||
|
function f() private {}
|
||||||
|
}
|
||||||
|
contract derived is base {
|
||||||
|
function g() { f(); }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), DeclarationError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(private_visibility_via_explicit_base_access)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract base {
|
||||||
|
function f() private {}
|
||||||
|
}
|
||||||
|
contract derived is base {
|
||||||
|
function g() { base.f(); }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_visibility)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
function f() external {}
|
||||||
|
function g() { f(); }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), DeclarationError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_base_visibility)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract base {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
contract derived is base {
|
||||||
|
function g() { base.f(); }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_argument_assign)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
function f(uint a) external { a = 1; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_argument_increment)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
function f(uint a) external { a++; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_argument_delete)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
function f(uint a) external { delete a; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -703,6 +703,56 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expression
|
|||||||
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_valid_declaration)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract c {
|
||||||
|
enum validEnum { Value1, Value2, Value3, Value4 }
|
||||||
|
function c ()
|
||||||
|
{
|
||||||
|
a = foo.Value3;
|
||||||
|
}
|
||||||
|
uint256 a;
|
||||||
|
})";
|
||||||
|
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(empty_enum_declaration)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract c {
|
||||||
|
enum foo { }
|
||||||
|
})";
|
||||||
|
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(malformed_enum_declaration)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract c {
|
||||||
|
enum foo { WARNING,}
|
||||||
|
})";
|
||||||
|
BOOST_CHECK_THROW(parseText(text), ParserError);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_function)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract c {
|
||||||
|
function x() external {}
|
||||||
|
})";
|
||||||
|
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(external_variable)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract c {
|
||||||
|
uint external x;
|
||||||
|
})";
|
||||||
|
BOOST_CHECK_THROW(parseText(text), ParserError);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -504,6 +504,49 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj)
|
||||||
|
{
|
||||||
|
//Construct Rlp of the given transaction
|
||||||
|
RLPStream rlpStream;
|
||||||
|
rlpStream.appendList(_tObj.size());
|
||||||
|
|
||||||
|
if (_tObj.count("nonce"))
|
||||||
|
rlpStream << bigint(_tObj["nonce"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("gasPrice"))
|
||||||
|
rlpStream << bigint(_tObj["gasPrice"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("gasLimit"))
|
||||||
|
rlpStream << bigint(_tObj["gasLimit"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("to"))
|
||||||
|
{
|
||||||
|
if (_tObj["to"].get_str().empty())
|
||||||
|
rlpStream << "";
|
||||||
|
else
|
||||||
|
rlpStream << importByteArray(_tObj["to"].get_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_tObj.count("value"))
|
||||||
|
rlpStream << bigint(_tObj["value"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("data"))
|
||||||
|
rlpStream << importData(_tObj);
|
||||||
|
|
||||||
|
if (_tObj.count("v"))
|
||||||
|
rlpStream << bigint(_tObj["v"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("r"))
|
||||||
|
rlpStream << bigint(_tObj["r"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("s"))
|
||||||
|
rlpStream << bigint(_tObj["s"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("extrafield"))
|
||||||
|
rlpStream << bigint(_tObj["extrafield"].get_str());
|
||||||
|
|
||||||
|
return rlpStream;
|
||||||
|
}
|
||||||
|
|
||||||
void processCommandLineOptions()
|
void processCommandLineOptions()
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace test
|
|||||||
class ImportTest
|
class ImportTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ImportTest() = default;
|
ImportTest(json_spirit::mObject& _o) : m_TestObject(_o) {}
|
||||||
ImportTest(json_spirit::mObject& _o, bool isFiller);
|
ImportTest(json_spirit::mObject& _o, bool isFiller);
|
||||||
|
|
||||||
// imports
|
// imports
|
||||||
@ -79,6 +79,7 @@ void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _e
|
|||||||
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, std::function<void(json_spirit::mValue&, bool)> doTests);
|
||||||
std::string getTestPath();
|
std::string getTestPath();
|
||||||
void userDefinedTest(std::string testTypeFlag, 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);
|
||||||
void processCommandLineOptions();
|
void processCommandLineOptions();
|
||||||
eth::LastHashes lastHashes(u256 _currentBlockNumber);
|
eth::LastHashes lastHashes(u256 _currentBlockNumber);
|
||||||
|
|
||||||
|
687
blInvalidHeaderTestFiller.json
Normal file
687
blInvalidHeaderTestFiller.json
Normal file
@ -0,0 +1,687 @@
|
|||||||
|
{
|
||||||
|
"log1_wrongBlockNumber" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"number" : "2"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"log1_wrongBloom" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongCoinbase" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongDifficulty" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"difficulty" : "10000"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"DifferentExtraData" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"extraData" : "42"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongGasLimit" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"gasLimit" : "100000"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongGasUsed" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"gasUsed" : "0"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongNumber" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"number" : "0"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongParentHash" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongReceiptTrie" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongStateRoot" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongTimestamp" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"timestamp" : "0x54c98c80"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongTransactionsTrie" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"wrongUncleHash" : {
|
||||||
|
"blockHeader" : {
|
||||||
|
"uncleHash" : "0x0dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
381
blValidBlockTestFiller.json
Normal file
381
blValidBlockTestFiller.json
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
{
|
||||||
|
"diffTooLowToChange" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "1023",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "850",
|
||||||
|
"gasPrice" : "1",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"diff1024" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "1024",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "850",
|
||||||
|
"gasPrice" : "1",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"gasPrice0" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "850",
|
||||||
|
"gasPrice" : "0",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"gasLimitTooHigh" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "1000000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "850",
|
||||||
|
"gasPrice" : "0",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"SimpleTx" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "500",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"txOrder" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "500",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "7000000000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "500",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "8000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"txEqualValue" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "500",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "500",
|
||||||
|
"gasPrice" : "9",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"log1_correct" : {
|
||||||
|
"genesisBlockHeader" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "10000",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "100000",
|
||||||
|
"gasUsed" : "0",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "0",
|
||||||
|
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "10000000000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "100",
|
||||||
|
"nonce" : "0",
|
||||||
|
"code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "",
|
||||||
|
"gasLimit" : "5000",
|
||||||
|
"gasPrice" : "10",
|
||||||
|
"nonce" : "0",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"value" : "5000000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uncleHeaders" : [
|
||||||
|
],
|
||||||
|
|
||||||
|
"firstBlockTest" : {
|
||||||
|
"block" : {
|
||||||
|
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
|
||||||
|
"difficulty" : "023101",
|
||||||
|
"extraData" : "42",
|
||||||
|
"gasLimit" : "0x0dddb6",
|
||||||
|
"gasUsed" : "100",
|
||||||
|
"nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
|
||||||
|
"number" : "62",
|
||||||
|
"parentHash" : "0xefb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5",
|
||||||
|
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
|
||||||
|
"timestamp" : "0x54c98c81",
|
||||||
|
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
},
|
||||||
|
"transactions" : [
|
||||||
|
{
|
||||||
|
"data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56",
|
||||||
|
"gasLimit" : "0x0f3e6f",
|
||||||
|
"gasPrice" : "0x09184e72a000",
|
||||||
|
"nonce" : "0",
|
||||||
|
"r" : "0xd4287e915ebac7a8af390560fa53c8f0b7f13802ba0393d7afa5823c2560ca89",
|
||||||
|
"s" : "0xae75db31a34f7e386ad459646de98ec3a1c88cc91b11620b4ffd86871f579942",
|
||||||
|
"to" : "",
|
||||||
|
"v" : "0x1b",
|
||||||
|
"value" : ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
509
block.cpp
Normal file
509
block.cpp
Normal file
@ -0,0 +1,509 @@
|
|||||||
|
/*
|
||||||
|
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 <libdevcrypto/FileSystem.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)
|
||||||
|
{
|
||||||
|
RLPStream rlpStream;
|
||||||
|
rlpStream.appendList(_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 << importByteArray(_tObj["extraData"].get_str());
|
||||||
|
|
||||||
|
if (_tObj.count("nonce"))
|
||||||
|
rlpStream << importByteArray(_tObj["nonce"].get_str());
|
||||||
|
|
||||||
|
return rlpStream.out();
|
||||||
|
}
|
||||||
|
|
||||||
|
void doBlockTests(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 blockFromFields;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// construct genesis block
|
||||||
|
const bytes c_blockRLP = createBlockRLPFromFields(o["genesisBlockHeader"].get_obj());
|
||||||
|
const RLP c_bRLP(c_blockRLP);
|
||||||
|
blockFromFields.populateFromHeader(c_bRLP, false);
|
||||||
|
}
|
||||||
|
catch (Exception const& _e)
|
||||||
|
{
|
||||||
|
cnote << "block population did throw an exception: " << diagnostic_information(_e);
|
||||||
|
BOOST_ERROR("Failed block population with Exception: " << _e.what());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
catch (std::exception const& _e)
|
||||||
|
{
|
||||||
|
BOOST_ERROR("Failed block population with Exception: " << _e.what());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
cnote << "block population did throw an unknown exception\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_REQUIRE(o.count("pre"));
|
||||||
|
|
||||||
|
ImportTest importer(o["pre"].get_obj());
|
||||||
|
State state(Address(), OverlayDB(), BaseState::Empty);
|
||||||
|
importer.importState(o["pre"].get_obj(), state);
|
||||||
|
state.commit();
|
||||||
|
|
||||||
|
if (_fillin)
|
||||||
|
blockFromFields.stateRoot = state.rootHash();
|
||||||
|
else
|
||||||
|
BOOST_CHECK_MESSAGE(blockFromFields.stateRoot == state.rootHash(), "root hash does not match");
|
||||||
|
|
||||||
|
if (_fillin)
|
||||||
|
{
|
||||||
|
// find new valid nonce
|
||||||
|
ProofOfWork pow;
|
||||||
|
MineInfo ret;
|
||||||
|
while (!ProofOfWork::verify(blockFromFields.headerHash(WithoutNonce), blockFromFields.nonce, blockFromFields.difficulty))
|
||||||
|
tie(ret, blockFromFields.nonce) = pow.mine(blockFromFields.headerHash(WithoutNonce), blockFromFields.difficulty, 1000, true, true);
|
||||||
|
|
||||||
|
//update genesis block in json file
|
||||||
|
o["genesisBlockHeader"].get_obj()["stateRoot"] = toString(blockFromFields.stateRoot);
|
||||||
|
o["genesisBlockHeader"].get_obj()["nonce"] = toString(blockFromFields.nonce);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create new "genesis" block
|
||||||
|
RLPStream rlpStream;
|
||||||
|
blockFromFields.streamRLP(rlpStream, WithNonce);
|
||||||
|
|
||||||
|
RLPStream block(3);
|
||||||
|
block.appendRaw(rlpStream.out());
|
||||||
|
block.appendRaw(RLPEmptyList);
|
||||||
|
block.appendRaw(RLPEmptyList);
|
||||||
|
|
||||||
|
blockFromFields.verifyInternals(&block.out());
|
||||||
|
|
||||||
|
// construct blockchain
|
||||||
|
BlockChain bc(block.out(), string(), true);
|
||||||
|
|
||||||
|
if (_fillin)
|
||||||
|
{
|
||||||
|
BOOST_REQUIRE(o.count("transactions"));
|
||||||
|
|
||||||
|
TransactionQueue txs;
|
||||||
|
|
||||||
|
for (auto const& txObj: o["transactions"].get_array())
|
||||||
|
{
|
||||||
|
mObject tx = txObj.get_obj();
|
||||||
|
importer.importTransaction(tx);
|
||||||
|
if (!txs.attemptImport(importer.m_transaction.rlp()))
|
||||||
|
cnote << "failed importing transaction\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
state.sync(bc);
|
||||||
|
state.sync(bc,txs);
|
||||||
|
state.commitToMine(bc);
|
||||||
|
MineInfo info;
|
||||||
|
for (info.completed = false; !info.completed; info = state.mine()) {}
|
||||||
|
state.completeMine();
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write valid txs
|
||||||
|
mArray txArray;
|
||||||
|
Transactions txList;
|
||||||
|
for (auto const& txi: txs.transactions())
|
||||||
|
{
|
||||||
|
Transaction tx(txi.second, CheckSignature::Sender);
|
||||||
|
txList.push_back(tx);
|
||||||
|
mObject txObject;
|
||||||
|
txObject["nonce"] = toString(tx.nonce());
|
||||||
|
txObject["data"] = toHex(tx.data());
|
||||||
|
txObject["gasLimit"] = toString(tx.gas());
|
||||||
|
txObject["gasPrice"] = toString(tx.gasPrice());
|
||||||
|
txObject["r"] = "0x" + toString(tx.signature().r);
|
||||||
|
txObject["s"] = "0x" + toString(tx.signature().s);
|
||||||
|
txObject["v"] = to_string(tx.signature().v + 27);
|
||||||
|
txObject["to"] = toString(tx.receiveAddress());
|
||||||
|
txObject["value"] = toString(tx.value());
|
||||||
|
|
||||||
|
txArray.push_back(txObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
o["transactions"] = txArray;
|
||||||
|
o["rlp"] = "0x" + toHex(state.blockData());
|
||||||
|
|
||||||
|
BlockInfo current_BlockHeader = state.info();
|
||||||
|
|
||||||
|
// overwrite blockheader with (possible wrong) data from "blockheader" in filler;
|
||||||
|
|
||||||
|
if (o.count("blockHeader"))
|
||||||
|
{
|
||||||
|
if (o["blockHeader"].get_obj().size() != 14)
|
||||||
|
{
|
||||||
|
|
||||||
|
BlockInfo tmp = current_BlockHeader;
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("parentHash"))
|
||||||
|
tmp.parentHash = h256(o["blockHeader"].get_obj()["parentHash"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("uncleHash"))
|
||||||
|
tmp.sha3Uncles = h256(o["blockHeader"].get_obj()["uncleHash"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("coinbase"))
|
||||||
|
tmp.coinbaseAddress = Address(o["blockHeader"].get_obj()["coinbase"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("stateRoot"))
|
||||||
|
tmp.stateRoot = h256(o["blockHeader"].get_obj()["stateRoot"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("transactionsTrie"))
|
||||||
|
tmp.transactionsRoot = h256(o["blockHeader"].get_obj()["transactionsTrie"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("receiptTrie"))
|
||||||
|
tmp.receiptsRoot = h256(o["blockHeader"].get_obj()["receiptTrie"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("bloom"))
|
||||||
|
tmp.logBloom = LogBloom(o["blockHeader"].get_obj()["bloom"].get_str());
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("difficulty"))
|
||||||
|
tmp.difficulty = toInt(o["blockHeader"].get_obj()["difficulty"]);
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("number"))
|
||||||
|
tmp.number = toInt(o["blockHeader"].get_obj()["number"]);
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("gasLimit"))
|
||||||
|
tmp.gasLimit = toInt(o["blockHeader"].get_obj()["gasLimit"]);
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("gasUsed"))
|
||||||
|
tmp.gasUsed = toInt(o["blockHeader"].get_obj()["gasUsed"]);
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("timestamp"))
|
||||||
|
tmp.timestamp = toInt(o["blockHeader"].get_obj()["timestamp"]);
|
||||||
|
|
||||||
|
if (o["blockHeader"].get_obj().count("extraData"))
|
||||||
|
tmp.extraData = importByteArray(o["blockHeader"].get_obj()["extraData"].get_str());
|
||||||
|
|
||||||
|
// find new valid nonce
|
||||||
|
|
||||||
|
if (tmp != current_BlockHeader)
|
||||||
|
{
|
||||||
|
current_BlockHeader = tmp;
|
||||||
|
cout << "new header!\n";
|
||||||
|
ProofOfWork pow;
|
||||||
|
MineInfo ret;
|
||||||
|
while (!ProofOfWork::verify(current_BlockHeader.headerHash(WithoutNonce), current_BlockHeader.nonce, current_BlockHeader.difficulty))
|
||||||
|
tie(ret, current_BlockHeader.nonce) = pow.mine(current_BlockHeader.headerHash(WithoutNonce), current_BlockHeader.difficulty, 10000, true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// take the blockheader as is
|
||||||
|
const bytes c_blockRLP = createBlockRLPFromFields(o["blockHeader"].get_obj());
|
||||||
|
const RLP c_bRLP(c_blockRLP);
|
||||||
|
current_BlockHeader.populateFromHeader(c_bRLP, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// write block header
|
||||||
|
|
||||||
|
mObject oBlockHeader;
|
||||||
|
oBlockHeader["parentHash"] = toString(current_BlockHeader.parentHash);
|
||||||
|
oBlockHeader["uncleHash"] = toString(current_BlockHeader.sha3Uncles);
|
||||||
|
oBlockHeader["coinbase"] = toString(current_BlockHeader.coinbaseAddress);
|
||||||
|
oBlockHeader["stateRoot"] = toString(current_BlockHeader.stateRoot);
|
||||||
|
oBlockHeader["transactionsTrie"] = toString(current_BlockHeader.transactionsRoot);
|
||||||
|
oBlockHeader["receiptTrie"] = toString(current_BlockHeader.receiptsRoot);
|
||||||
|
oBlockHeader["bloom"] = toString(current_BlockHeader.logBloom);
|
||||||
|
oBlockHeader["difficulty"] = toString(current_BlockHeader.difficulty);
|
||||||
|
oBlockHeader["number"] = toString(current_BlockHeader.number);
|
||||||
|
oBlockHeader["gasLimit"] = toString(current_BlockHeader.gasLimit);
|
||||||
|
oBlockHeader["gasUsed"] = toString(current_BlockHeader.gasUsed);
|
||||||
|
oBlockHeader["timestamp"] = toString(current_BlockHeader.timestamp);
|
||||||
|
oBlockHeader["extraData"] = toHex(current_BlockHeader.extraData);
|
||||||
|
oBlockHeader["nonce"] = toString(current_BlockHeader.nonce);
|
||||||
|
|
||||||
|
o["blockHeader"] = oBlockHeader;
|
||||||
|
|
||||||
|
// write uncle list
|
||||||
|
mArray aUncleList; // as of now, our parent is always the genesis block, so we can not have uncles.
|
||||||
|
o["uncleHeaders"] = aUncleList;
|
||||||
|
|
||||||
|
//txs:
|
||||||
|
|
||||||
|
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 rlpStream2;
|
||||||
|
current_BlockHeader.streamRLP(rlpStream2, WithNonce);
|
||||||
|
|
||||||
|
RLPStream block2(3);
|
||||||
|
block2.appendRaw(rlpStream2.out());
|
||||||
|
block2.appendRaw(txStream.out());
|
||||||
|
block2.appendRaw(RLPEmptyList);
|
||||||
|
|
||||||
|
o["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";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ImportTest importerTmp(o["pre"].get_obj());
|
||||||
|
State stateTmp(Address(), OverlayDB(), BaseState::Empty);
|
||||||
|
importerTmp.importState(o["pre"].get_obj(), stateTmp);
|
||||||
|
stateTmp.commit();
|
||||||
|
BlockChain bcTmp(block.out(), getDataDir() + "/tmpBlockChain.bc", true);
|
||||||
|
stateTmp.sync(bcTmp);
|
||||||
|
bc.import(block2.out(), stateTmp.db());
|
||||||
|
stateTmp.sync(bcTmp);
|
||||||
|
}
|
||||||
|
// if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
cnote << "block is invalid!\n";
|
||||||
|
o.erase(o.find("blockHeader"));
|
||||||
|
o.erase(o.find("uncleHeaders"));
|
||||||
|
o.erase(o.find("transactions"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bytes blockRLP;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
state.sync(bc);
|
||||||
|
blockRLP = importByteArray(o["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(o.count("blockHeader") == 0);
|
||||||
|
BOOST_CHECK(o.count("transactions") == 0);
|
||||||
|
BOOST_CHECK(o.count("uncleHeaders") == 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
catch (std::exception const& _e)
|
||||||
|
{
|
||||||
|
cnote << "state sync or block import did throw an exception: " << _e.what();
|
||||||
|
BOOST_CHECK(o.count("blockHeader") == 0);
|
||||||
|
BOOST_CHECK(o.count("transactions") == 0);
|
||||||
|
BOOST_CHECK(o.count("uncleHeaders") == 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
cnote << "state sync or block import did throw an exception\n";
|
||||||
|
BOOST_CHECK(o.count("blockHeader") == 0);
|
||||||
|
BOOST_CHECK(o.count("transactions") == 0);
|
||||||
|
BOOST_CHECK(o.count("uncleHeaders") == 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_REQUIRE(o.count("blockHeader"));
|
||||||
|
|
||||||
|
mObject tObj = o["blockHeader"].get_obj();
|
||||||
|
BlockInfo blockHeaderFromFields;
|
||||||
|
const bytes c_rlpBytesBlockHeader = createBlockRLPFromFields(tObj);
|
||||||
|
const RLP c_blockHeaderRLP(c_rlpBytesBlockHeader);
|
||||||
|
blockHeaderFromFields.populateFromHeader(c_blockHeaderRLP, false);
|
||||||
|
|
||||||
|
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.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: o["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(), CheckSignature::Sender);
|
||||||
|
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(), CheckSignature::Sender);
|
||||||
|
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 in rlp and in transaction field do not match");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check uncle list
|
||||||
|
BOOST_CHECK_MESSAGE((o["uncleList"].type() == json_spirit::null_type ? 0 : o["uncleList"].get_array().size()) == 0, "Uncle list is not empty, but the genesis block can not have uncles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} }// Namespace Close
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_SUITE(BlockTests)
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(blValidBlockTest)
|
||||||
|
{
|
||||||
|
dev::test::executeTests("blValidBlockTest", "/BlockTests", dev::test::doBlockTests);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(blInvalidHeaderTest)
|
||||||
|
{
|
||||||
|
dev::test::executeTests("blInvalidHeaderTest", "/BlockTests", dev::test::doBlockTests);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(userDefinedFileBl)
|
||||||
|
{
|
||||||
|
dev::test::userDefinedTest("--bltest", dev::test::doBlockTests);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_SUITE_END()
|
@ -81,13 +81,13 @@
|
|||||||
"pre" : {
|
"pre" : {
|
||||||
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
"balance" : "1000000000000000000",
|
"balance" : "1000000000000000000",
|
||||||
"nonce" : 0,
|
"nonce" : "0",
|
||||||
"code" : "0x444242424245434253f0",
|
"code" : "0x444242424245434253f0",
|
||||||
"storage": {}
|
"storage": {}
|
||||||
},
|
},
|
||||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
"balance" : "1000000000000000000",
|
"balance" : "1000000000000000000",
|
||||||
"nonce" : 0,
|
"nonce" : "0",
|
||||||
"code" : "",
|
"code" : "",
|
||||||
"storage": {}
|
"storage": {}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TestHelper.h"
|
#include "TestHelper.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace json_spirit;
|
using namespace json_spirit;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
@ -28,50 +29,6 @@ using namespace dev::eth;
|
|||||||
|
|
||||||
namespace dev { namespace test {
|
namespace dev { namespace test {
|
||||||
|
|
||||||
RLPStream createRLPStreamFromTransactionFields(mObject& _tObj)
|
|
||||||
{
|
|
||||||
//Construct Rlp of the given transaction
|
|
||||||
RLPStream rlpStream;
|
|
||||||
rlpStream.appendList(_tObj.size());
|
|
||||||
|
|
||||||
if (_tObj.count("nonce") > 0)
|
|
||||||
rlpStream << bigint(_tObj["nonce"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("gasPrice") > 0)
|
|
||||||
rlpStream << bigint(_tObj["gasPrice"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("gasLimit") > 0)
|
|
||||||
rlpStream << bigint(_tObj["gasLimit"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("to") > 0)
|
|
||||||
{
|
|
||||||
if (_tObj["to"].get_str().empty())
|
|
||||||
rlpStream << "";
|
|
||||||
else
|
|
||||||
rlpStream << importByteArray(_tObj["to"].get_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_tObj.count("value") > 0)
|
|
||||||
rlpStream << bigint(_tObj["value"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("data") > 0)
|
|
||||||
rlpStream << importData(_tObj);
|
|
||||||
|
|
||||||
if (_tObj.count("v") > 0)
|
|
||||||
rlpStream << bigint(_tObj["v"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("r") > 0)
|
|
||||||
rlpStream << bigint(_tObj["r"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("s") > 0)
|
|
||||||
rlpStream << bigint(_tObj["s"].get_str());
|
|
||||||
|
|
||||||
if (_tObj.count("extrafield") > 0)
|
|
||||||
rlpStream << bigint(_tObj["extrafield"].get_str());
|
|
||||||
|
|
||||||
return rlpStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
|
void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
|
||||||
{
|
{
|
||||||
for (auto& i: _v.get_obj())
|
for (auto& i: _v.get_obj())
|
||||||
@ -115,7 +72,6 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
|
|||||||
|
|
||||||
Address addressReaded = Address(o["sender"].get_str());
|
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!");
|
BOOST_CHECK_MESSAGE(txFromFields.sender() == addressReaded || txFromRlp.sender() == addressReaded, "Signature address of sender does not match given sender address!");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -141,6 +97,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
|
|||||||
}
|
}
|
||||||
}//for
|
}//for
|
||||||
}//doTransactionTests
|
}//doTransactionTests
|
||||||
|
|
||||||
} }// Namespace Close
|
} }// Namespace Close
|
||||||
|
|
||||||
|
|
||||||
|
26
vm.cpp
26
vm.cpp
@ -513,13 +513,39 @@ BOOST_AUTO_TEST_CASE(vmSystemOperationsTest)
|
|||||||
dev::test::executeTests("vmSystemOperationsTest", "/VMTests", dev::test::doVMTests);
|
dev::test::executeTests("vmSystemOperationsTest", "/VMTests", dev::test::doVMTests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(vmPerformanceTest)
|
||||||
|
{
|
||||||
|
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 == "--performance")
|
||||||
|
{
|
||||||
|
auto start = chrono::steady_clock::now();
|
||||||
|
|
||||||
|
dev::test::executeTests("vmPerformanceTest", "/VMTests", dev::test::doVMTests);
|
||||||
|
|
||||||
|
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(vmInputLimitsTest1)
|
BOOST_AUTO_TEST_CASE(vmInputLimitsTest1)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
|
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];
|
string arg = boost::unit_test::framework::master_test_suite().argv[i];
|
||||||
if (arg == "--inputlimits")
|
if (arg == "--inputlimits")
|
||||||
|
{
|
||||||
|
auto start = chrono::steady_clock::now();
|
||||||
|
|
||||||
dev::test::executeTests("vmInputLimitsTest1", "/VMTests", dev::test::doVMTests);
|
dev::test::executeTests("vmInputLimitsTest1", "/VMTests", dev::test::doVMTests);
|
||||||
|
|
||||||
|
auto end = chrono::steady_clock::now();
|
||||||
|
auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
|
||||||
|
cnote << "test duration: " << duration.count() << " milliseconds.\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
176
vmPerformanceTestFiller.json
Normal file
176
vmPerformanceTestFiller.json
Normal file
File diff suppressed because one or more lines are too long
@ -10,7 +10,7 @@
|
|||||||
class WebThreeStubClient : public jsonrpc::Client
|
class WebThreeStubClient : public jsonrpc::Client
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WebThreeStubClient(jsonrpc::IClientConnector &conn) : jsonrpc::Client(conn) {}
|
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)
|
std::string web3_sha3(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
bool eth_setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
|
bool eth_setListening(bool param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -72,7 +72,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
bool eth_setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
|
bool eth_setMining(bool param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -122,7 +122,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
bool eth_setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
|
bool eth_setDefaultBlock(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -183,6 +183,46 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
|
double eth_transactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||||
|
{
|
||||||
|
Json::Value p;
|
||||||
|
p.append(param1);
|
||||||
|
Json::Value result = this->CallMethod("eth_transactionCountByHash",p);
|
||||||
|
if (result.isDouble())
|
||||||
|
return result.asDouble();
|
||||||
|
else
|
||||||
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
|
}
|
||||||
|
double eth_transactionCountByNumber(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
|
{
|
||||||
|
Json::Value p;
|
||||||
|
p.append(param1);
|
||||||
|
Json::Value result = this->CallMethod("eth_transactionCountByNumber",p);
|
||||||
|
if (result.isDouble())
|
||||||
|
return result.asDouble();
|
||||||
|
else
|
||||||
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
|
}
|
||||||
|
double eth_uncleCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||||
|
{
|
||||||
|
Json::Value p;
|
||||||
|
p.append(param1);
|
||||||
|
Json::Value result = this->CallMethod("eth_uncleCountByHash",p);
|
||||||
|
if (result.isDouble())
|
||||||
|
return result.asDouble();
|
||||||
|
else
|
||||||
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
|
}
|
||||||
|
double eth_uncleCountByNumber(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
|
{
|
||||||
|
Json::Value p;
|
||||||
|
p.append(param1);
|
||||||
|
Json::Value result = this->CallMethod("eth_uncleCountByNumber",p);
|
||||||
|
if (result.isDouble())
|
||||||
|
return result.asDouble();
|
||||||
|
else
|
||||||
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
|
}
|
||||||
std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
@ -233,7 +273,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_blockByNumber(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -243,7 +283,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_transactionByHash(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -254,7 +294,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_transactionByNumber(int param1, int param2) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -265,7 +305,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_uncleByHash(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -276,7 +316,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_uncleByNumber(int param1, int param2) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -347,7 +387,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
bool eth_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
|
bool eth_uninstallFilter(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -357,7 +397,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_changed(const int& param1) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_changed(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -367,7 +407,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value eth_filterLogs(const int& param1) throw (jsonrpc::JsonRpcException)
|
Json::Value eth_filterLogs(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -515,7 +555,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
bool shh_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
|
bool shh_uninstallFilter(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -525,7 +565,7 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
Json::Value shh_changed(const int& param1) throw (jsonrpc::JsonRpcException)
|
Json::Value shh_changed(int param1) throw (jsonrpc::JsonRpcException)
|
||||||
{
|
{
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
p.append(param1);
|
p.append(param1);
|
||||||
@ -535,6 +575,16 @@ class WebThreeStubClient : public jsonrpc::Client
|
|||||||
else
|
else
|
||||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||||
}
|
}
|
||||||
|
Json::Value shh_getMessages(int 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_WEBTHREESTUBCLIENT_H_
|
#endif //JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user