mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop
Conflicts: test/SolidityOptimizer.cpp
This commit is contained in:
		
						commit
						b240574cb6
					
				| @ -236,20 +236,6 @@ BOOST_AUTO_TEST_CASE(const_function) | ||||
| 	"}\n"; | ||||
| 
 | ||||
| 	char const* interface = R"([ | ||||
| 	{ | ||||
| 		"name": "boo", | ||||
| 		"constant": true, | ||||
| 		"inputs": [{ | ||||
| 			"name": "a", | ||||
| 			"type": "uint32" | ||||
| 		}], | ||||
| 		"outputs": [ | ||||
| 		{ | ||||
| 			"name": "b", | ||||
| 			"type": "uint256" | ||||
| 		} | ||||
| 		] | ||||
| 	}, | ||||
| 	{ | ||||
| 		"name": "foo", | ||||
| 		"constant": false, | ||||
| @ -269,6 +255,20 @@ BOOST_AUTO_TEST_CASE(const_function) | ||||
| 			"type": "uint256" | ||||
| 		} | ||||
| 		] | ||||
| 	}, | ||||
| 	{ | ||||
| 		"name": "boo", | ||||
| 		"constant": true, | ||||
| 		"inputs": [{ | ||||
| 			"name": "a", | ||||
| 			"type": "uint32" | ||||
| 		}], | ||||
| 		"outputs": [ | ||||
| 		{ | ||||
| 			"name": "b", | ||||
| 			"type": "uint256" | ||||
| 		} | ||||
| 		] | ||||
| 	} | ||||
| 	])"; | ||||
| 
 | ||||
|  | ||||
| @ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) | ||||
| 							 "}\n"; | ||||
| 	bytes code = compileContract(sourceCode); | ||||
| 
 | ||||
| 	unsigned boilerplateSize = 40; | ||||
| 	unsigned boilerplateSize = 73; | ||||
| 	bytes expectation({byte(Instruction::JUMPDEST), | ||||
| 					   byte(Instruction::PUSH1), 0x0, // initialize local variable x
 | ||||
| 					   byte(Instruction::PUSH1), 0x2, | ||||
| @ -115,9 +115,8 @@ BOOST_AUTO_TEST_CASE(different_argument_numbers) | ||||
| 							 "  function g() returns (uint e, uint h) { h = f(1, 2, 3); }\n" | ||||
| 							 "}\n"; | ||||
| 	bytes code = compileContract(sourceCode); | ||||
| 
 | ||||
| 	unsigned shift = 68; | ||||
| 	unsigned boilerplateSize = 81; | ||||
| 	unsigned shift = 103; | ||||
| 	unsigned boilerplateSize = 116; | ||||
| 	bytes expectation({byte(Instruction::JUMPDEST), | ||||
| 					   byte(Instruction::PUSH1), 0x0, // initialize return variable d
 | ||||
| 					   byte(Instruction::DUP3), | ||||
| @ -166,9 +165,8 @@ BOOST_AUTO_TEST_CASE(ifStatement) | ||||
| 							 "  function f() { bool x; if (x) 77; else if (!x) 78; else 79; }" | ||||
| 							 "}\n"; | ||||
| 	bytes code = compileContract(sourceCode); | ||||
| 
 | ||||
| 	unsigned shift = 27; | ||||
| 	unsigned boilerplateSize = 40; | ||||
| 	unsigned shift = 60; | ||||
| 	unsigned boilerplateSize = 73; | ||||
| 	bytes expectation({byte(Instruction::JUMPDEST), | ||||
| 					   byte(Instruction::PUSH1), 0x0, | ||||
| 					   byte(Instruction::DUP1), | ||||
| @ -208,9 +206,8 @@ BOOST_AUTO_TEST_CASE(loops) | ||||
| 							 "  function f() { while(true){1;break;2;continue;3;return;4;} }" | ||||
| 							 "}\n"; | ||||
| 	bytes code = compileContract(sourceCode); | ||||
| 
 | ||||
| 	unsigned shift = 27; | ||||
| 	unsigned boilerplateSize = 40; | ||||
| 	unsigned shift = 60; | ||||
| 	unsigned boilerplateSize = 73; | ||||
| 	bytes expectation({byte(Instruction::JUMPDEST), | ||||
| 					   byte(Instruction::JUMPDEST), | ||||
| 					   byte(Instruction::PUSH1), 0x1, | ||||
|  | ||||
| @ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) | ||||
| 							 "  function f(uint a) returns(uint d) { return a * 7; }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	testSolidityAgainstCppOnRange(0, [](u256 const& a) -> u256 { return a * 7; }, 0, 100); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", [](u256 const& a) -> u256 { return a * 7; }, 0, 100); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(empty_contract) | ||||
| @ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(empty_contract) | ||||
| 	char const* sourceCode = "contract test {\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes()).empty()); | ||||
| 	BOOST_CHECK(callContractFunction("i_am_not_there()", bytes()).empty()); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(recursive_calls) | ||||
| @ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(recursive_calls) | ||||
| 			return n * recursive_calls_cpp(n - 1); | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCppOnRange(0, recursive_calls_cpp, 0, 5); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", recursive_calls_cpp, 0, 5); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(multiple_functions) | ||||
| @ -85,11 +85,11 @@ BOOST_AUTO_TEST_CASE(multiple_functions) | ||||
| 							 "  function f() returns(uint n) { return 3; }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes()) == toBigEndian(u256(0))); | ||||
| 	BOOST_CHECK(callContractFunction(1, bytes()) == toBigEndian(u256(1))); | ||||
| 	BOOST_CHECK(callContractFunction(2, bytes()) == toBigEndian(u256(2))); | ||||
| 	BOOST_CHECK(callContractFunction(3, bytes()) == toBigEndian(u256(3))); | ||||
| 	BOOST_CHECK(callContractFunction(4, bytes()) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("a()", bytes()) == toBigEndian(u256(0))); | ||||
| 	BOOST_CHECK(callContractFunction("b()", bytes()) == toBigEndian(u256(1))); | ||||
| 	BOOST_CHECK(callContractFunction("c()", bytes()) == toBigEndian(u256(2))); | ||||
| 	BOOST_CHECK(callContractFunction("f()", bytes()) == toBigEndian(u256(3))); | ||||
| 	BOOST_CHECK(callContractFunction("i_am_not_there()", bytes()) == bytes()); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(while_loop) | ||||
| @ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(while_loop) | ||||
| 		return nfac; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCppOnRange(0, while_loop_cpp, 0, 5); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", while_loop_cpp, 0, 5); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(break_outside_loop) | ||||
| @ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(break_outside_loop) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	testSolidityAgainstCpp(0, [](u256 const&) -> u256 { return 2; }, u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256)", [](u256 const&) -> u256 { return 2; }, u256(0)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(nested_loops) | ||||
| @ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(nested_loops) | ||||
| 		return n; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCppOnRange(0, nested_loops_cpp, 0, 12); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", nested_loops_cpp, 0, 12); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(for_loop) | ||||
| @ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE(for_loop) | ||||
| 		return nfac; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCppOnRange(0, for_loop_cpp, 0, 5); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", for_loop_cpp, 0, 5); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(for_loop_empty) | ||||
| @ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE(for_loop_empty) | ||||
| 		return ret; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCpp(0, for_loop_empty_cpp); | ||||
| 	testSolidityAgainstCpp("f()", for_loop_empty_cpp); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr) | ||||
| @ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr) | ||||
| 		return nfac; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCppOnRange(0, for_loop_simple_init_expr_cpp, 0, 5); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", for_loop_simple_init_expr_cpp, 0, 5); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(calling_other_functions) | ||||
| @ -293,11 +293,11 @@ BOOST_AUTO_TEST_CASE(calling_other_functions) | ||||
| 		return y; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCpp(2, collatz_cpp, u256(0)); | ||||
| 	testSolidityAgainstCpp(2, collatz_cpp, u256(1)); | ||||
| 	testSolidityAgainstCpp(2, collatz_cpp, u256(2)); | ||||
| 	testSolidityAgainstCpp(2, collatz_cpp, u256(8)); | ||||
| 	testSolidityAgainstCpp(2, collatz_cpp, u256(127)); | ||||
| 	testSolidityAgainstCpp("run(uint256)", collatz_cpp, u256(0)); | ||||
| 	testSolidityAgainstCpp("run(uint256)", collatz_cpp, u256(1)); | ||||
| 	testSolidityAgainstCpp("run(uint256)", collatz_cpp, u256(2)); | ||||
| 	testSolidityAgainstCpp("run(uint256)", collatz_cpp, u256(8)); | ||||
| 	testSolidityAgainstCpp("run(uint256)", collatz_cpp, u256(127)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(many_local_variables) | ||||
| @ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(many_local_variables) | ||||
| 		u256 y = a + b + c + x1 + x2 + x3; | ||||
| 		return y + b + x2; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, f, u256(0x1000), u256(0x10000), u256(0x100000)); | ||||
| 	testSolidityAgainstCpp("run(uint256,uint256,uint256)", f, u256(0x1000), u256(0x10000), u256(0x100000)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(packing_unpacking_types) | ||||
| @ -331,7 +331,7 @@ BOOST_AUTO_TEST_CASE(packing_unpacking_types) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, fromHex("01""0f0f0f0f""f0f0f0f0f0f0f0f0")) | ||||
| 	BOOST_CHECK(callContractFunction("run(bool,uint32,uint64)", fromHex("01""0f0f0f0f""f0f0f0f0f0f0f0f0")) | ||||
| 				== fromHex("00000000000000000000000000000000000000""01""f0f0f0f0""0f0f0f0f0f0f0f0f")); | ||||
| } | ||||
| 
 | ||||
| @ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(multiple_return_values) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 1) + toBigEndian(u256(0xcd))) | ||||
| 	BOOST_CHECK(callContractFunction("run(bool,uint256)", bytes(1, 1) + toBigEndian(u256(0xcd))) | ||||
| 				== toBigEndian(u256(0xcd)) + bytes(1, 1) + toBigEndian(u256(0))); | ||||
| } | ||||
| 
 | ||||
| @ -363,7 +363,7 @@ BOOST_AUTO_TEST_CASE(short_circuiting) | ||||
| 		return n; | ||||
| 	}; | ||||
| 
 | ||||
| 	testSolidityAgainstCppOnRange(0, short_circuiting_cpp, 0, 2); | ||||
| 	testSolidityAgainstCppOnRange("run(uint256)", short_circuiting_cpp, 0, 2); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(high_bits_cleaning) | ||||
| @ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE(high_bits_cleaning) | ||||
| 			return 0; | ||||
| 		return x; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, high_bits_cleaning_cpp); | ||||
| 	testSolidityAgainstCpp("run()", high_bits_cleaning_cpp); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(sign_extension) | ||||
| @ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE(sign_extension) | ||||
| 			return 0; | ||||
| 		return u256(x) * -1; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, sign_extension_cpp); | ||||
| 	testSolidityAgainstCpp("run()", sign_extension_cpp); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(small_unsigned_types) | ||||
| @ -420,7 +420,7 @@ BOOST_AUTO_TEST_CASE(small_unsigned_types) | ||||
| 		uint32_t x = uint32_t(0xffffff) * 0xffffff; | ||||
| 		return x / 0x100; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, small_unsigned_types_cpp); | ||||
| 	testSolidityAgainstCpp("run()", small_unsigned_types_cpp); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(small_signed_types) | ||||
| @ -435,7 +435,7 @@ BOOST_AUTO_TEST_CASE(small_signed_types) | ||||
| 	{ | ||||
| 		return -int32_t(10) * -int64_t(20); | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, small_signed_types_cpp); | ||||
| 	testSolidityAgainstCpp("run()", small_signed_types_cpp); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(strings) | ||||
| @ -458,12 +458,12 @@ BOOST_AUTO_TEST_CASE(strings) | ||||
| 	expectation[4] = byte(0xff); | ||||
| 	expectation[5] = byte('_'); | ||||
| 	expectation[6] = byte('_'); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes()) == expectation); | ||||
| 	BOOST_CHECK(callContractFunction("fixed()", bytes()) == expectation); | ||||
| 	expectation = bytes(17, 0); | ||||
| 	expectation[0] = 0; | ||||
| 	expectation[1] = 2; | ||||
| 	expectation[16] = 1; | ||||
| 	BOOST_CHECK(callContractFunction(1, bytes({0x00, 0x02, 0x01})) == expectation); | ||||
| 	BOOST_CHECK(callContractFunction("pipeThrough(string2,bool)", bytes({0x00, 0x02, 0x01})) == expectation); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(empty_string_on_stack) | ||||
| @ -477,7 +477,7 @@ BOOST_AUTO_TEST_CASE(empty_string_on_stack) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x02)) == bytes({0x00, 0x02, 0x61/*'a'*/, 0x62/*'b'*/, 0x63/*'c'*/, 0x00})); | ||||
| 	BOOST_CHECK(callContractFunction("run(string0,uint8)", bytes(1, 0x02)) == bytes({0x00, 0x02, 0x61/*'a'*/, 0x62/*'b'*/, 0x63/*'c'*/, 0x00})); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(state_smoke_test) | ||||
| @ -495,14 +495,14 @@ BOOST_AUTO_TEST_CASE(state_smoke_test) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0))); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == toBigEndian(u256(0))); | ||||
| 	BOOST_CHECK(callContractFunction(1, bytes(1, 0x00) + toBigEndian(u256(0x1234))) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction(1, bytes(1, 0x01) + toBigEndian(u256(0x8765))) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0x1234))); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == toBigEndian(u256(0x8765))); | ||||
| 	BOOST_CHECK(callContractFunction(1, bytes(1, 0x00) + toBigEndian(u256(0x3))) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0x3))); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == toBigEndian(u256(0))); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x01)) == toBigEndian(u256(0))); | ||||
| 	BOOST_CHECK(callContractFunction("set(uint8,uint256)", bytes(1, 0x00) + toBigEndian(u256(0x1234))) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("set(uint8,uint256)", bytes(1, 0x01) + toBigEndian(u256(0x8765))) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == toBigEndian(u256(0x1234))); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x01)) == toBigEndian(u256(0x8765))); | ||||
| 	BOOST_CHECK(callContractFunction("set(uint8,uint256)", bytes(1, 0x00) + toBigEndian(u256(0x3))) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == toBigEndian(u256(0x3))); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(compound_assign) | ||||
| @ -530,14 +530,14 @@ BOOST_AUTO_TEST_CASE(compound_assign) | ||||
| 		value2 *= value3 + value1; | ||||
| 		return value2 += 7; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, f, u256(0), u256(6)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(1), u256(3)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(2), u256(25)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(3), u256(69)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(4), u256(84)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5), u256(2)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(6), u256(51)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(7), u256(48)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(0), u256(6)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(1), u256(3)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(2), u256(25)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(3), u256(69)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(4), u256(84)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(5), u256(2)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(6), u256(51)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256)", f, u256(7), u256(48)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(simple_mapping) | ||||
| @ -554,21 +554,21 @@ BOOST_AUTO_TEST_CASE(simple_mapping) | ||||
| 	compileAndRun(sourceCode); | ||||
| 	 | ||||
| 	// msvc seems to have problems with initializer-list, when there is only 1 param in the list
 | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	callContractFunction(1, bytes({0x01, 0xa1})); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0xa1)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	callContractFunction(1, bytes({0x00, 0xef})); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0xef)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0xa1)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	callContractFunction(1, bytes({0x01, 0x05})); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0xef)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0x05)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x01)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	callContractFunction("set(uint8,uint8)", bytes({0x01, 0xa1})); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x01)) == bytes(1, 0xa1)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	callContractFunction("set(uint8,uint8)", bytes({0x00, 0xef})); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == bytes(1, 0xef)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x01)) == bytes(1, 0xa1)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| 	callContractFunction("set(uint8,uint8)", bytes({0x01, 0x05})); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x00)) == bytes(1, 0xef)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0x01)) == bytes(1, 0x05)); | ||||
| 	BOOST_CHECK(callContractFunction("get(uint8)", bytes(1, 0xa7)) == bytes(1, 0x00)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(mapping_state) | ||||
| @ -612,38 +612,38 @@ BOOST_AUTO_TEST_CASE(mapping_state) | ||||
| 	auto getVoteCount = bind(&Ballot::getVoteCount, &ballot, _1); | ||||
| 	auto grantVoteRight = bind(&Ballot::grantVoteRight, &ballot, _1); | ||||
| 	auto vote = bind(&Ballot::vote, &ballot, _1, _2); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(2)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(2)); | ||||
| 	// voting without vote right shourd be rejected
 | ||||
| 	testSolidityAgainstCpp(2, vote, u160(0), u160(2)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(2)); | ||||
| 	testSolidityAgainstCpp("vote(address,address)", vote, u160(0), u160(2)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(2)); | ||||
| 	// grant vote rights
 | ||||
| 	testSolidityAgainstCpp(1, grantVoteRight, u160(0)); | ||||
| 	testSolidityAgainstCpp(1, grantVoteRight, u160(1)); | ||||
| 	testSolidityAgainstCpp("grantVoteRight(address)", grantVoteRight, u160(0)); | ||||
| 	testSolidityAgainstCpp("grantVoteRight(address)", grantVoteRight, u160(1)); | ||||
| 	// vote, should increase 2's vote count
 | ||||
| 	testSolidityAgainstCpp(2, vote, u160(0), u160(2)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(2)); | ||||
| 	testSolidityAgainstCpp("vote(address,address)", vote, u160(0), u160(2)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(2)); | ||||
| 	// vote again, should be rejected
 | ||||
| 	testSolidityAgainstCpp(2, vote, u160(0), u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(2)); | ||||
| 	testSolidityAgainstCpp("vote(address,address)", vote, u160(0), u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(2)); | ||||
| 	// vote without right to vote
 | ||||
| 	testSolidityAgainstCpp(2, vote, u160(2), u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(2)); | ||||
| 	testSolidityAgainstCpp("vote(address,address)", vote, u160(2), u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(2)); | ||||
| 	// grant vote right and now vote again
 | ||||
| 	testSolidityAgainstCpp(1, grantVoteRight, u160(2)); | ||||
| 	testSolidityAgainstCpp(2, vote, u160(2), u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp(0, getVoteCount, u160(2)); | ||||
| 	testSolidityAgainstCpp("grantVoteRight(address)", grantVoteRight, u160(2)); | ||||
| 	testSolidityAgainstCpp("vote(address,address)", vote, u160(2), u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(0)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(1)); | ||||
| 	testSolidityAgainstCpp("getVoteCount(address)", getVoteCount, u160(2)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(mapping_state_inc_dec) | ||||
| @ -674,7 +674,7 @@ BOOST_AUTO_TEST_CASE(mapping_state_inc_dec) | ||||
| 			table[value]++; | ||||
| 		return --table[value++]; | ||||
| 	}; | ||||
| 	testSolidityAgainstCppOnRange(0, f, 0, 5); | ||||
| 	testSolidityAgainstCppOnRange("f(uint256)", f, 0, 5); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(multi_level_mapping) | ||||
| @ -694,14 +694,14 @@ BOOST_AUTO_TEST_CASE(multi_level_mapping) | ||||
| 		if (_z == 0) return table[_x][_y]; | ||||
| 		else return table[_x][_y] = _z; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(0)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(0)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(9)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(0)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(0)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(7)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(0)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(4), u256(5), u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(5), u256(4), u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(4), u256(5), u256(9)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(4), u256(5), u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(5), u256(4), u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(5), u256(4), u256(7)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(4), u256(5), u256(0)); | ||||
| 	testSolidityAgainstCpp("f(uint256,uint256,uint256)", f, u256(5), u256(4), u256(0)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(structs) | ||||
| @ -736,9 +736,9 @@ BOOST_AUTO_TEST_CASE(structs) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction(1) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction(0) == bytes(1, 0x01)); | ||||
| 	BOOST_CHECK(callContractFunction("check()") == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction("set()") == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("check()") == bytes(1, 0x01)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(struct_reference) | ||||
| @ -764,9 +764,9 @@ BOOST_AUTO_TEST_CASE(struct_reference) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0) == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction(1) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction(0) == bytes(1, 0x01)); | ||||
| 	BOOST_CHECK(callContractFunction("check()") == bytes(1, 0x00)); | ||||
| 	BOOST_CHECK(callContractFunction("set()") == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("check()") == bytes(1, 0x01)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(constructor) | ||||
| @ -787,8 +787,8 @@ BOOST_AUTO_TEST_CASE(constructor) | ||||
| 	{ | ||||
| 		return data[_x]; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, get, u256(6)); | ||||
| 	testSolidityAgainstCpp(0, get, u256(7)); | ||||
| 	testSolidityAgainstCpp("get(uint256)", get, u256(6)); | ||||
| 	testSolidityAgainstCpp("get(uint256)", get, u256(7)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(balance) | ||||
| @ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE(balance) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode, 23); | ||||
| 	BOOST_CHECK(callContractFunction(0) == toBigEndian(u256(23))); | ||||
| 	BOOST_CHECK(callContractFunction("getBalance()") == toBigEndian(u256(23))); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(blockchain) | ||||
| @ -812,7 +812,7 @@ BOOST_AUTO_TEST_CASE(blockchain) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode, 27); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes{0}, u256(28)) == toBigEndian(u256(28)) + bytes(20, 0) + toBigEndian(u256(1))); | ||||
| 	BOOST_CHECK(callContractFunction("someInfo()", bytes{0}, u256(28)) == toBigEndian(u256(28)) + bytes(20, 0) + toBigEndian(u256(1))); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(function_types) | ||||
| @ -831,8 +831,8 @@ BOOST_AUTO_TEST_CASE(function_types) | ||||
| 							 "  }\n" | ||||
| 							 "}\n"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes{0}) == toBigEndian(u256(11))); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes{1}) == toBigEndian(u256(12))); | ||||
| 	BOOST_CHECK(callContractFunction("a(bool)", bytes{0}) == toBigEndian(u256(11))); | ||||
| 	BOOST_CHECK(callContractFunction("a(bool)", bytes{1}) == toBigEndian(u256(12))); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(send_ether) | ||||
| @ -846,7 +846,7 @@ BOOST_AUTO_TEST_CASE(send_ether) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount + 1); | ||||
| 	u160 address(23); | ||||
| 	BOOST_CHECK(callContractFunction(0, address, amount) == toBigEndian(u256(1))); | ||||
| 	BOOST_CHECK(callContractFunction("a(address,uint256)", address, amount) == toBigEndian(u256(1))); | ||||
| 	BOOST_CHECK_EQUAL(m_state.balance(address), amount); | ||||
| } | ||||
| 
 | ||||
| @ -860,7 +860,7 @@ BOOST_AUTO_TEST_CASE(log0) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount + 1); | ||||
| 	u160 address(23); | ||||
| 	callContractFunction(0, address, amount); | ||||
| 	callContractFunction("a()", address, amount); | ||||
| 	BOOST_CHECK_EQUAL(m_logs.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); | ||||
| 	BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); | ||||
| @ -877,7 +877,7 @@ BOOST_AUTO_TEST_CASE(log1) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount + 1); | ||||
| 	u160 address(23); | ||||
| 	callContractFunction(0, address, amount); | ||||
| 	callContractFunction("a()", address, amount); | ||||
| 	BOOST_CHECK_EQUAL(m_logs.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); | ||||
| 	BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); | ||||
| @ -895,7 +895,7 @@ BOOST_AUTO_TEST_CASE(log2) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount + 1); | ||||
| 	u160 address(23); | ||||
| 	callContractFunction(0, address, amount); | ||||
| 	callContractFunction("a()", address, amount); | ||||
| 	BOOST_CHECK_EQUAL(m_logs.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); | ||||
| 	BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); | ||||
| @ -914,7 +914,7 @@ BOOST_AUTO_TEST_CASE(log3) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount + 1); | ||||
| 	u160 address(23); | ||||
| 	callContractFunction(0, address, amount); | ||||
| 	callContractFunction("a()", address, amount); | ||||
| 	BOOST_CHECK_EQUAL(m_logs.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); | ||||
| 	BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); | ||||
| @ -933,7 +933,7 @@ BOOST_AUTO_TEST_CASE(log4) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount + 1); | ||||
| 	u160 address(23); | ||||
| 	callContractFunction(0, address, amount); | ||||
| 	callContractFunction("a()", address, amount); | ||||
| 	BOOST_CHECK_EQUAL(m_logs.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); | ||||
| 	BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); | ||||
| @ -953,7 +953,7 @@ BOOST_AUTO_TEST_CASE(suicide) | ||||
| 	u256 amount(130); | ||||
| 	compileAndRun(sourceCode, amount); | ||||
| 	u160 address(23); | ||||
| 	BOOST_CHECK(callContractFunction(0, address) == bytes()); | ||||
| 	BOOST_CHECK(callContractFunction("a(address)", address) == bytes()); | ||||
| 	BOOST_CHECK(!m_state.addressHasCode(m_contractAddress)); | ||||
| 	BOOST_CHECK_EQUAL(m_state.balance(address), amount); | ||||
| } | ||||
| @ -970,9 +970,9 @@ BOOST_AUTO_TEST_CASE(sha3) | ||||
| 	{ | ||||
| 		return dev::sha3(toBigEndian(_x)); | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, f, u256(4)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(-1)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(4)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(5)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(-1)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(sha256) | ||||
| @ -989,9 +989,9 @@ BOOST_AUTO_TEST_CASE(sha256) | ||||
| 		dev::sha256(dev::ref(toBigEndian(_input)), bytesRef(&ret[0], 32)); | ||||
| 		return ret; | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, f, u256(4)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(-1)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(4)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(5)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(-1)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(ripemd) | ||||
| @ -1008,9 +1008,9 @@ BOOST_AUTO_TEST_CASE(ripemd) | ||||
| 		dev::ripemd160(dev::ref(toBigEndian(_input)), bytesRef(&ret[0], 32)); | ||||
| 		return u256(ret) >> (256 - 160); | ||||
| 	}; | ||||
| 	testSolidityAgainstCpp(0, f, u256(4)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(5)); | ||||
| 	testSolidityAgainstCpp(0, f, u256(-1)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(4)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(5)); | ||||
| 	testSolidityAgainstCpp("a(hash256)", f, u256(-1)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(ecrecover) | ||||
| @ -1026,7 +1026,7 @@ BOOST_AUTO_TEST_CASE(ecrecover) | ||||
| 	u256 r("0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f"); | ||||
| 	u256 s("0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549"); | ||||
| 	u160 addr("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"); | ||||
| 	BOOST_CHECK(callContractFunction(0, h, v, r, s) == toBigEndian(addr)); | ||||
| 	BOOST_CHECK(callContractFunction("a(hash256,uint8,hash256,hash256)", h, v, r, s) == toBigEndian(addr)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(inter_contract_calls) | ||||
| @ -1052,11 +1052,11 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls) | ||||
| 	compileAndRun(sourceCode, 0, "Helper"); | ||||
| 	u160 const helperAddress = m_contractAddress; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(2, helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction(1, helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction("setHelper(address)", helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction("getHelper()", helperAddress) == toBigEndian(helperAddress)); | ||||
| 	u256 a(3456789); | ||||
| 	u256 b("0x282837623374623234aa74"); | ||||
| 	BOOST_REQUIRE(callContractFunction(0, a, b) == toBigEndian(a * b)); | ||||
| 	BOOST_REQUIRE(callContractFunction("callHelper(uint256,uint256)", a, b) == toBigEndian(a * b)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(inter_contract_calls_with_complex_parameters) | ||||
| @ -1082,12 +1082,12 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_with_complex_parameters) | ||||
| 	compileAndRun(sourceCode, 0, "Helper"); | ||||
| 	u160 const helperAddress = m_contractAddress; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(2, helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction(1, helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction("setHelper(address)", helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction("getHelper()", helperAddress) == toBigEndian(helperAddress)); | ||||
| 	u256 a(3456789); | ||||
| 	u256 b("0x282837623374623234aa74"); | ||||
| 	BOOST_REQUIRE(callContractFunction(0, a, true, b) == toBigEndian(a * 3)); | ||||
| 	BOOST_REQUIRE(callContractFunction(0, a, false, b) == toBigEndian(b * 3)); | ||||
| 	BOOST_REQUIRE(callContractFunction("callHelper(uint256,bool,uint256)", a, true, b) == toBigEndian(a * 3)); | ||||
| 	BOOST_REQUIRE(callContractFunction("callHelper(uint256,bool,uint256)", a, false, b) == toBigEndian(b * 3)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(inter_contract_calls_accessing_this) | ||||
| @ -1113,9 +1113,9 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_accessing_this) | ||||
| 	compileAndRun(sourceCode, 0, "Helper"); | ||||
| 	u160 const helperAddress = m_contractAddress; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(2, helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction(1, helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction(0) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction("setHelper(address)", helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction("getHelper()", helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction("callHelper()") == toBigEndian(helperAddress)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(calls_to_this) | ||||
| @ -1144,11 +1144,11 @@ BOOST_AUTO_TEST_CASE(calls_to_this) | ||||
| 	compileAndRun(sourceCode, 0, "Helper"); | ||||
| 	u160 const helperAddress = m_contractAddress; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(2, helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction(1, helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction("setHelper(address)", helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction("getHelper()", helperAddress) == toBigEndian(helperAddress)); | ||||
| 	u256 a(3456789); | ||||
| 	u256 b("0x282837623374623234aa74"); | ||||
| 	BOOST_REQUIRE(callContractFunction(0, a, b) == toBigEndian(a * b + 10)); | ||||
| 	BOOST_REQUIRE(callContractFunction("callHelper(uint256,uint256)", a, b) == toBigEndian(a * b + 10)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(inter_contract_calls_with_local_vars) | ||||
| @ -1179,11 +1179,11 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_with_local_vars) | ||||
| 	compileAndRun(sourceCode, 0, "Helper"); | ||||
| 	u160 const helperAddress = m_contractAddress; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(2, helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction(1, helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_REQUIRE(callContractFunction("setHelper(address)", helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction("getHelper()", helperAddress) == toBigEndian(helperAddress)); | ||||
| 	u256 a(3456789); | ||||
| 	u256 b("0x282837623374623234aa74"); | ||||
| 	BOOST_REQUIRE(callContractFunction(0, a, b) == toBigEndian(a * b + 9)); | ||||
| 	BOOST_REQUIRE(callContractFunction("callHelper(uint256,uint256)", a, b) == toBigEndian(a * b + 9)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(strings_in_calls) | ||||
| @ -1209,9 +1209,9 @@ BOOST_AUTO_TEST_CASE(strings_in_calls) | ||||
| 	compileAndRun(sourceCode, 0, "Helper"); | ||||
| 	u160 const helperAddress = m_contractAddress; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(2, helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction(1, helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_CHECK(callContractFunction(0, bytes({0, 'a', 1})) == bytes({0, 'a', 0, 0, 0})); | ||||
| 	BOOST_REQUIRE(callContractFunction("setHelper(address)", helperAddress) == bytes()); | ||||
| 	BOOST_REQUIRE(callContractFunction("getHelper()", helperAddress) == toBigEndian(helperAddress)); | ||||
| 	BOOST_CHECK(callContractFunction("callHelper(string2,bool)", bytes({0, 'a', 1})) == bytes({0, 'a', 0, 0, 0})); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(constructor_arguments) | ||||
| @ -1236,8 +1236,8 @@ BOOST_AUTO_TEST_CASE(constructor_arguments) | ||||
| 			function getName() returns (string3 ret) { return h.getName(); } | ||||
| 		})"; | ||||
| 	compileAndRun(sourceCode, 0, "Main"); | ||||
| 	BOOST_REQUIRE(callContractFunction(0) == bytes({byte(0x01)})); | ||||
| 	BOOST_REQUIRE(callContractFunction(1) == bytes({'a', 'b', 'c'})); | ||||
| 	BOOST_REQUIRE(callContractFunction("getFlag()") == bytes({byte(0x01)})); | ||||
| 	BOOST_REQUIRE(callContractFunction("getName()") == bytes({'a', 'b', 'c'})); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(functions_called_by_constructor) | ||||
| @ -1254,7 +1254,7 @@ BOOST_AUTO_TEST_CASE(functions_called_by_constructor) | ||||
| 			function setName(string3 _name) { name = _name; } | ||||
| 		})"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_REQUIRE(callContractFunction(0) == bytes({'a', 'b', 'c'})); | ||||
| 	BOOST_REQUIRE(callContractFunction("getName()") == bytes({'a', 'b', 'c'})); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_SUITE_END() | ||||
|  | ||||
| @ -55,12 +55,12 @@ public: | ||||
| 	} | ||||
| 
 | ||||
| 	template <class... Args> | ||||
| 	void compareVersions(byte _index, Args const&... _arguments) | ||||
| 	void compareVersions(std::string _sig, Args const&... _arguments) | ||||
| 	{ | ||||
| 		m_contractAddress = m_nonOptimizedContract; | ||||
| 		bytes nonOptimizedOutput = callContractFunction(_index, _arguments...); | ||||
| 		bytes nonOptimizedOutput = callContractFunction(_sig, _arguments...); | ||||
| 		m_contractAddress = m_optimizedContract; | ||||
| 		bytes optimizedOutput = callContractFunction(_index, _arguments...); | ||||
| 		bytes optimizedOutput = callContractFunction(_sig, _arguments...); | ||||
| 		BOOST_CHECK_MESSAGE(nonOptimizedOutput == optimizedOutput, "Computed values do not match." | ||||
| 							"\nNon-Optimized: " + toHex(nonOptimizedOutput) + | ||||
| 							"\nOptimized:     " + toHex(optimizedOutput)); | ||||
| @ -81,8 +81,8 @@ BOOST_AUTO_TEST_CASE(smoke_test) | ||||
| 				return a; | ||||
| 			} | ||||
| 		})"; | ||||
| 	compileBothVersions(4, sourceCode); | ||||
| 	compareVersions(0, u256(7)); | ||||
| 	compileBothVersions(29, sourceCode); | ||||
| 	compareVersions("f(uint256)", u256(7)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(large_integers) | ||||
| @ -94,8 +94,8 @@ BOOST_AUTO_TEST_CASE(large_integers) | ||||
| 				b = 0x10000000000000000000000002; | ||||
| 			} | ||||
| 		})"; | ||||
| 	compileBothVersions(11, sourceCode); | ||||
| 	compareVersions(0); | ||||
| 	compileBothVersions(36, sourceCode); | ||||
| 	compareVersions("f()"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(invariants) | ||||
| @ -106,8 +106,8 @@ BOOST_AUTO_TEST_CASE(invariants) | ||||
| 				return int(0) | (int(1) * (int(0) ^ (0 + a))); | ||||
| 			} | ||||
| 		})"; | ||||
| 	compileBothVersions(16, sourceCode); | ||||
| 	compareVersions(0, u256(0x12334664)); | ||||
| 	compileBothVersions(41, sourceCode); | ||||
| 	compareVersions("f(uint256)", u256(0x12334664)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(unused_expressions) | ||||
| @ -120,8 +120,8 @@ BOOST_AUTO_TEST_CASE(unused_expressions) | ||||
| 				data; | ||||
| 			} | ||||
| 		})"; | ||||
| 	compileBothVersions(8, sourceCode); | ||||
| 	compareVersions(0); | ||||
| 	compileBothVersions(33, sourceCode); | ||||
| 	compareVersions("f()"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(constant_folding_both_sides) | ||||
| @ -135,8 +135,8 @@ BOOST_AUTO_TEST_CASE(constant_folding_both_sides) | ||||
| 				return 98 ^ (7 * ((1 | (x | 1000)) * 40) ^ 102); | ||||
| 			} | ||||
| 		})"; | ||||
| 	compileBothVersions(12, sourceCode); | ||||
| 	compareVersions(0); | ||||
| 	compileBothVersions(37, sourceCode); | ||||
| 	compareVersions("f(uint256)"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_SUITE_END() | ||||
|  | ||||
| @ -489,4 +489,12 @@ void processCommandLineOptions() | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| LastHashes lastHashes(u256 _currentBlockNumber) | ||||
| { | ||||
| 	LastHashes ret; | ||||
| 	for (u256 i = 1; i <= 256 && i <= _currentBlockNumber; ++i) | ||||
| 		ret.push_back(sha3(toString(_currentBlockNumber - i))); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| } } // namespaces
 | ||||
|  | ||||
| @ -77,6 +77,7 @@ void executeTests(const std::string& _name, const std::string& _testPathAppendix | ||||
| std::string getTestPath(); | ||||
| void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests); | ||||
| void processCommandLineOptions(); | ||||
| eth::LastHashes lastHashes(u256 _currentBlockNumber); | ||||
| 
 | ||||
| template<typename mapType> | ||||
| void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) | ||||
|  | ||||
| @ -56,34 +56,36 @@ public: | ||||
| 		return m_output; | ||||
| 	} | ||||
| 
 | ||||
| 	bytes const& callContractFunction(byte _index, bytes const& _data = bytes(), u256 const& _value = 0) | ||||
| 	bytes const& callContractFunction(std::string _sig, bytes const& _data = bytes(), | ||||
| 									  u256 const& _value = 0) | ||||
| 	{ | ||||
| 		sendMessage(bytes(1, _index) + _data, false, _value); | ||||
| 		FixedHash<4> hash(dev::sha3(_sig)); | ||||
| 		sendMessage(hash.asBytes() + _data, false, _value); | ||||
| 		return m_output; | ||||
| 	} | ||||
| 
 | ||||
| 	template <class... Args> | ||||
| 	bytes const& callContractFunction(byte _index, Args const&... _arguments) | ||||
| 	bytes const& callContractFunction(std::string _sig, Args const&... _arguments) | ||||
| 	{ | ||||
| 		return callContractFunction(_index, argsToBigEndian(_arguments...)); | ||||
| 		return callContractFunction(_sig, argsToBigEndian(_arguments...)); | ||||
| 	} | ||||
| 
 | ||||
| 	template <class CppFunction, class... Args> | ||||
| 	void testSolidityAgainstCpp(byte _index, CppFunction const& _cppFunction, Args const&... _arguments) | ||||
| 	void testSolidityAgainstCpp(std::string _sig, CppFunction const& _cppFunction, Args const&... _arguments) | ||||
| 	{ | ||||
| 		bytes solidityResult = callContractFunction(_index, _arguments...); | ||||
| 		bytes solidityResult = callContractFunction(_sig, _arguments...); | ||||
| 		bytes cppResult = callCppAndEncodeResult(_cppFunction, _arguments...); | ||||
| 		BOOST_CHECK_MESSAGE(solidityResult == cppResult, "Computed values do not match." | ||||
| 							"\nSolidity: " + toHex(solidityResult) + "\nC++:      " + toHex(cppResult)); | ||||
| 	} | ||||
| 
 | ||||
| 	template <class CppFunction, class... Args> | ||||
| 	void testSolidityAgainstCppOnRange(byte _index, CppFunction const& _cppFunction, | ||||
| 	void testSolidityAgainstCppOnRange(std::string _sig, CppFunction const& _cppFunction, | ||||
| 									   u256 const& _rangeStart, u256 const& _rangeEnd) | ||||
| 	{ | ||||
| 		for (u256 argument = _rangeStart; argument < _rangeEnd; ++argument) | ||||
| 		{ | ||||
| 			bytes solidityResult = callContractFunction(_index, argument); | ||||
| 			bytes solidityResult = callContractFunction(_sig, argument); | ||||
| 			bytes cppResult = callCppAndEncodeResult(_cppFunction, argument); | ||||
| 			BOOST_CHECK_MESSAGE(solidityResult == cppResult, "Computed values do not match." | ||||
| 								"\nSolidity: " + toHex(solidityResult) + "\nC++:      " + toHex(cppResult) + | ||||
|  | ||||
| @ -529,12 +529,12 @@ | ||||
|             "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { | ||||
|                 "balance" : "1000000000000000000", | ||||
|                 "nonce" : 0, | ||||
|                 "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2) }", | ||||
|                 "code" : "{ [[ 0 ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 0 31 1) [[ 1 ]] @0 }", | ||||
|                 "storage": {} | ||||
|             }, | ||||
|             "945304eb96065b2a98b57a48a06ae28d285a71b5" : { | ||||
|                 "balance" : "23", | ||||
|                 "code" : "0x6001600155603760005360026000f3", | ||||
|                 "code" : "0x6001600155602a601f536001601ff3", | ||||
|                 "nonce" : "0", | ||||
|                 "storage" : { | ||||
|                 } | ||||
| @ -545,7 +545,88 @@ | ||||
|                 "code" : "", | ||||
|                 "storage": {} | ||||
|             } | ||||
|         }, | ||||
|         "transaction" : { | ||||
|             "nonce" : "0", | ||||
|             "gasPrice" : "1", | ||||
|             "gasLimit" : "10000", | ||||
|             "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", | ||||
|             "value" : "100000", | ||||
|             "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", | ||||
|             "data" : "" | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "CallToReturn1ForDynamicJump0": { | ||||
|         "env" : { | ||||
|             "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|             "currentNumber" : "0", | ||||
|             "currentGasLimit" : "10000000", | ||||
|             "currentDifficulty" : "256", | ||||
|             "currentTimestamp" : 1, | ||||
|             "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" | ||||
|         }, | ||||
|         "pre" : { | ||||
|             "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { | ||||
|                 "balance" : "1000000000000000000", | ||||
|                 "nonce" : 0, | ||||
|                 "code" : "0x6001601f60006000601773945304eb96065b2a98b57a48a06ae28d285a71b56103e8f1600055600051565b6023602355", | ||||
|                 "storage": {} | ||||
|             }, | ||||
|             "945304eb96065b2a98b57a48a06ae28d285a71b5" : { | ||||
|                 "balance" : "23", | ||||
|                 "code" : "0x6001600155602a601f536001601ff3", | ||||
|                 "nonce" : "0", | ||||
|                 "storage" : { | ||||
|                 } | ||||
|             }, | ||||
|             "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { | ||||
|                 "balance" : "1000000000000000000", | ||||
|                 "nonce" : 0, | ||||
|                 "code" : "", | ||||
|                 "storage": {} | ||||
|             } | ||||
|         }, | ||||
|         "transaction" : { | ||||
|             "nonce" : "0", | ||||
|             "gasPrice" : "1", | ||||
|             "gasLimit" : "10000", | ||||
|             "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", | ||||
|             "value" : "100000", | ||||
|             "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", | ||||
|             "data" : "" | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "CallToReturn1ForDynamicJump1": { | ||||
|         "env" : { | ||||
|             "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|             "currentNumber" : "0", | ||||
|             "currentGasLimit" : "10000000", | ||||
|             "currentDifficulty" : "256", | ||||
|             "currentTimestamp" : 1, | ||||
|             "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" | ||||
|         }, | ||||
|         "pre" : { | ||||
|             "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { | ||||
|                 "balance" : "1000000000000000000", | ||||
|                 "nonce" : 0, | ||||
|                 "code" : "0x6001601f60006000601773945304eb96065b2a98b57a48a06ae28d285a71b56103e8f160005560005156605b6023602355", | ||||
|                 "storage": {} | ||||
|             }, | ||||
|             "945304eb96065b2a98b57a48a06ae28d285a71b5" : { | ||||
|                 "balance" : "23", | ||||
|                 "code" : "0x6001600155602b601f536001601ff3", | ||||
|                 "nonce" : "0", | ||||
|                 "storage" : { | ||||
|                 } | ||||
|             }, | ||||
|             "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { | ||||
|                 "balance" : "1000000000000000000", | ||||
|                 "nonce" : 0, | ||||
|                 "code" : "", | ||||
|                 "storage": {} | ||||
|             } | ||||
|         }, | ||||
|         "transaction" : { | ||||
|             "nonce" : "0", | ||||
|  | ||||
							
								
								
									
										10
									
								
								state.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								state.cpp
									
									
									
									
									
								
							| @ -39,16 +39,6 @@ using namespace dev::eth; | ||||
| 
 | ||||
| namespace dev {  namespace test { | ||||
| 
 | ||||
| LastHashes lastHashes(u256 _currentBlockNumber) | ||||
| { | ||||
| 	LastHashes ret; | ||||
| 	for (u256 i = 1; i <= 256 && i <= _currentBlockNumber; ++i) | ||||
| 		ret.push_back(sha3(toString(_currentBlockNumber - i))); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| void doStateTests(json_spirit::mValue& v, bool _fillin) | ||||
| { | ||||
| 	processCommandLineOptions(); | ||||
|  | ||||
							
								
								
									
										3
									
								
								vm.cpp
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								vm.cpp
									
									
									
									
									
								
							| @ -33,7 +33,7 @@ using namespace dev::eth; | ||||
| using namespace dev::test; | ||||
| 
 | ||||
| FakeExtVM::FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth):			/// TODO: XXX: remove the default argument & fix.
 | ||||
| 	ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytes(), _previousBlock, _currentBlock, LastHashes(), _depth) {} | ||||
| 	ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytes(), _previousBlock, _currentBlock, test::lastHashes(_currentBlock.number), _depth) {} | ||||
| 
 | ||||
| h160 FakeExtVM::create(u256 _endowment, u256& io_gas, bytesConstRef _init, OnOpFunc const&) | ||||
| { | ||||
| @ -117,6 +117,7 @@ void FakeExtVM::importEnv(mObject& _o) | ||||
| 
 | ||||
| 	previousBlock.hash = h256(_o["previousHash"].get_str()); | ||||
| 	currentBlock.number = toInt(_o["currentNumber"]); | ||||
| 	lastHashes = test::lastHashes(currentBlock.number); | ||||
| 	currentBlock.gasLimit = toInt(_o["currentGasLimit"]); | ||||
| 	currentBlock.difficulty = toInt(_o["currentDifficulty"]); | ||||
| 	currentBlock.timestamp = toInt(_o["currentTimestamp"]); | ||||
|  | ||||
| @ -814,6 +814,62 @@ | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "sdiv4": { | ||||
|         "env" : { | ||||
|         "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|         "currentNumber" : "0", | ||||
|         "currentGasLimit" : "1000000", | ||||
|         "currentDifficulty" : "256", | ||||
|         "currentTimestamp" : 1, | ||||
|         "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" | ||||
|         }, | ||||
|         "pre" : { | ||||
|         "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { | ||||
|             "balance" : "1000000000000000000", | ||||
|             "nonce" : 0, | ||||
|             "code" : "{ [[ 0 ]] (SDIV 5 (- 0 4) )  }", | ||||
|             "storage": {} | ||||
|         } | ||||
|         }, | ||||
|         "exec" : { | ||||
|             "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", | ||||
|             "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", | ||||
|             "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", | ||||
|             "value" : "1000000000000000000", | ||||
|             "data" : "", | ||||
|             "gasPrice" : "100000000000000", | ||||
|             "gas" : "10000" | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "sdiv5": { | ||||
|         "env" : { | ||||
|         "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|         "currentNumber" : "0", | ||||
|         "currentGasLimit" : "1000000", | ||||
|         "currentDifficulty" : "256", | ||||
|         "currentTimestamp" : 1, | ||||
|         "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" | ||||
|         }, | ||||
|         "pre" : { | ||||
|         "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { | ||||
|             "balance" : "1000000000000000000", | ||||
|             "nonce" : 0, | ||||
|             "code" : "{ [[ 0 ]] (SDIV (- 0 57896044618658097711785492504343953926634992332820282019728792003956564819967) (- 0 1) )  }", | ||||
|             "storage": {} | ||||
|         } | ||||
|         }, | ||||
|         "exec" : { | ||||
|             "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", | ||||
|             "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", | ||||
|             "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", | ||||
|             "value" : "1000000000000000000", | ||||
|             "data" : "", | ||||
|             "gasPrice" : "100000000000000", | ||||
|             "gas" : "10000" | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "mod0": { | ||||
|         "env" : { | ||||
|         "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|  | ||||
| @ -111,6 +111,62 @@ | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "blockhashInRange": { | ||||
|         "env" : { | ||||
|         "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|         "currentNumber" : "257", | ||||
|         "currentGasLimit" : "1000000", | ||||
|         "currentDifficulty" : "256", | ||||
|         "currentTimestamp" : 1, | ||||
|         "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" | ||||
|         }, | ||||
|         "pre" : { | ||||
|         "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { | ||||
|             "balance" : "1000000000000000000", | ||||
|             "nonce" : 0, | ||||
|             "code" : "{ [[ 0 ]] (BLOCKHASH 1) [[ 1 ]] (BLOCKHASH 2) [[ 2 ]] (BLOCKHASH 256) }", | ||||
|             "storage": {} | ||||
|         } | ||||
|         }, | ||||
|         "exec" : { | ||||
|             "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", | ||||
|             "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", | ||||
|             "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", | ||||
|             "value" : "1000000000000000000", | ||||
|             "data" : "", | ||||
|             "gasPrice" : "100000000000000", | ||||
|             "gas" : "10000" | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "blockhashOutOfRange": { | ||||
|         "env" : { | ||||
|         "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|         "currentNumber" : "257", | ||||
|         "currentGasLimit" : "1000000", | ||||
|         "currentDifficulty" : "256", | ||||
|         "currentTimestamp" : 1, | ||||
|         "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" | ||||
|         }, | ||||
|         "pre" : { | ||||
|         "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { | ||||
|             "balance" : "1000000000000000000", | ||||
|             "nonce" : 0, | ||||
|             "code" : "{ [[ 0 ]] (BLOCKHASH 0) [[ 1 ]] (BLOCKHASH 257) [[ 2 ]] (BLOCKHASH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", | ||||
|             "storage": {} | ||||
|         } | ||||
|         }, | ||||
|         "exec" : { | ||||
|             "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", | ||||
|             "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", | ||||
|             "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", | ||||
|             "value" : "1000000000000000000", | ||||
|             "data" : "", | ||||
|             "gasPrice" : "100000000000000", | ||||
|             "gas" : "10000" | ||||
|         } | ||||
|     }, | ||||
| 
 | ||||
|     "coinbase": { | ||||
|         "env" : { | ||||
|         "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user