{ "SolidityTest" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", "currentGasLimit" : "1000000000000000000000", "currentNumber" : "120", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000000", "code" : "", "nonce" : "0", "storage" : { } }, "d94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000", "//" : " ", "//" : "contract TestContract ", "//" : "{ ", "//" : " function testMethod() returns (int res) ", "//" : " { ", "//" : " return 225; ", "//" : " } ", "//" : " ", "//" : " function destroy(address sendFoundsTo) ", "//" : " { ", "//" : " suicide(sendFoundsTo); ", "//" : " } ", "//" : "} ", "//" : " ", "//" : "contract TestSolidityContracts ", "//" : "{ ", "//" : "struct StructTest ", "//" : " { ", "//" : " address addr; ", "//" : " int amount; ", "//" : " string32 str; ", "//" : " mapping (uint => address) funders; ", "//" : " } ", "//" : " ", "//" : " int globalValue; ", "//" : " StructTest globalData; ", "//" : " function runSolidityTests() returns (hash res) ", "//" : " { ", "//" : " //res is a mask of failing tests given the first byte is first test ", "//" : " res = 0x0000000000000000000000000000000000000000000000000000000000000000; ", "//" : " ", "//" : " createContractFromMethod(); ", "//" : " ", "//" : " if (!testKeywords()) ", "//" : " res = hash(int(res) + int(0xf000000000000000000000000000000000000000000000000000000000000000)); ", "//" : " ", "//" : " if (!testContractInteraction()) ", "//" : " res = hash(int(res) + int(0x0f00000000000000000000000000000000000000000000000000000000000000)); ", "//" : " ", "//" : " if (!testContractSuicide()) ", "//" : " res = hash(int(res) + int(0x00f0000000000000000000000000000000000000000000000000000000000000)); ", "//" : " ", "//" : " if (!testBlockAndTransactionProperties()) ", "//" : " res = hash(int(res) + int(0x000f000000000000000000000000000000000000000000000000000000000000)); ", "//" : " ", "//" : " globalValue = 255; ", "//" : " globalData.addr = 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b; ", "//" : " globalData.amount = 255; ", "//" : " globalData.str = 'global data 32 length string'; ", "//" : " globalData.funders[0] = 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b; ", "//" : " if (!testStructuresAndVariabless()) ", "//" : " res = hash(int(res) + int(0x0000f00000000000000000000000000000000000000000000000000000000000)); ", "//" : " ", "//" : " //Tested 27.01.2015 ", "//" : " //should run out of gas ", "//" : " //if (!testInfiniteLoop()) ", "//" : " // res = hash(int(res) + int(0x000f000000000000000000000000000000000000000000000000000000000000)); ", "//" : " // ", "//" : " //should run out of gas ", "//" : " //if (!testRecursiveMethods()) ", "//" : " // res = hash(int(res) + int(0x0000000000000000000000000000000000000000000000000000000000000000)); ", "//" : " } ", "//" : " ", "//" : " function testStructuresAndVariabless() returns (bool res) ", "//" : " { ", "//" : " res = true; ", "//" : " if (globalValue != 255) ", "//" : " return false; ", "//" : " ", "//" : " if (globalValue != globalData.amount) ", "//" : " return false; ", "//" : " ", "//" : " if (globalData.addr != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ", "//" : " return false; ", "//" : " ", "//" : " if (globalData.str != 'global data 32 length string') ", "//" : " return false; ", "//" : " ", "//" : " if (globalData.funders[0] != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ", "//" : " return false; ", "//" : " } ", "//" : " ", "//" : " function testBlockAndTransactionProperties() returns (bool res) ", "//" : " { ", "//" : " res = true; ", "//" : " if (block.coinbase != 0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba) ", "//" : " return false; ", "//" : " ", "//" : " if (block.difficulty != 45678256) ", "//" : " return false; ", "//" : " ", "//" : " //for some reason does not work 27.01.2015 ", "//" : " //if (block.gaslimit != 1000000000000000000000) ", "//" : " // return false; ", "//" : " ", "//" : " if (block.number != 120) ", "//" : " return false; ", "//" : " ", "//" : " //try to call this ", "//" : " block.blockhash(120); ", "//" : " block.timestamp; ", "//" : " msg.gas; ", "//" : " ", "//" : " if (msg.sender != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ", "//" : " return false; ", "//" : " ", "//" : " if (msg.value != 100) ", "//" : " return false; ", "//" : " ", "//" : " if (tx.gasprice != 1) ", "//" : " return false; ", "//" : " ", "//" : " if (tx.origin != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ", "//" : " return false; ", "//" : " ", "//" : " } ", "//" : " ", "//" : " function testInfiniteLoop() returns (bool res) ", "//" : " { ", "//" : " res = false; ", "//" : " while(true){} ", "//" : " return true; ", "//" : " } ", "//" : " ", "//" : " function testRecursiveMethods() returns (bool res) ", "//" : " { ", "//" : " res = false; ", "//" : " testRecursiveMethods2(); ", "//" : " return true; ", "//" : " } ", "//" : " function testRecursiveMethods2() ", "//" : " { ", "//" : " testRecursiveMethods(); ", "//" : "} ", "//" : " ", "//" : " ", "//" : " function testContractSuicide() returns (bool res) ", "//" : " { ", "//" : " TestContract a = new TestContract(); ", "//" : " a.destroy(block.coinbase); ", "//" : " if (a.testMethod() == 225) //we should be able to call a contract ", "//" : " return true; ", "//" : " return false; ", "//" : " } ", "//" : " ", "//" : " function testContractInteraction() returns (bool res) ", "//" : " { ", "//" : " TestContract a = new TestContract(); ", "//" : " if (a.testMethod() == 225) ", "//" : " return true; ", "//" : " return false; ", "//" : " } ", "//" : " ", "//" : " function testKeywords() returns (bool res) ", "//" : " { ", "//" : " //some simple checks for the if statemnt ", "//" : " //if, else, while, for, break, continue, return ", "//" : " int i = 0; ", "//" : " res = false; ", "//" : " ", "//" : " if (i == 0) ", "//" : " { ", "//" : " if( i <= -25) ", "//" : " { ", "//" : " return false; ", "//" : " } ", "//" : " else ", "//" : " { ", "//" : " while(i < 10) ", "//" : " i++; ", "//" : " ", "//" : " if (i == 10) ", "//" : " { ", "//" : " for(var j=10; j>0; j--) ", "//" : " { ", "//" : " i--; ", "//" : " } ", "//" : " } ", "//" : " } ", "//" : " } ", "//" : " ", "//" : " ", "//" : " if (i == 0) ", "//" : " return true; ", "//" : " ", "//" : " return false; ", "//" : " } ", "//" : " ", "//" : " function createContractFromMethod() returns (TestContract a) ", "//" : " { ", "//" : " a = new TestContract(); ", "//" : " } ", "//" : "} ", "code" : "0x60e060020a6000350480630c4c9a8014610078578063296df0df1461008a5780632a9afb831461009c578063380e4396146100ae5780634893d88a146100c05780637ee17e12146100ce578063981a3165146100dc578063a60eedda146100ee578063e97384dc14610100578063ed973fe91461011257005b610080610431565b8060005260206000f35b6100926103f7565b8060005260206000f35b6100a46105d1565b8060005260206000f35b6100b6610220565b8060005260206000f35b6100c8610426565b60006000f35b6100d66102df565b60006000f35b6100e4610411565b8060005260206000f35b6100f6610124565b8060005260206000f35b6101086102f5565b8060005260206000f35b61011a6101be565b8060005260206000f35b60006000605f6106be600039605f60006000f0905080600160a060020a031662f55d9d8060e060020a0260005241600160a060020a0316600452600060006024600060008660155a03f150505080600160a060020a031663b9c3d0a58060e060020a02600052602060006004600060008660155a03f150505060005160e1146101ac576101b5565b600191506101ba565b600091505b5090565b60006000605f6106be600039605f60006000f0905080600160a060020a031663b9c3d0a58060e060020a02600052602060006004600060008660155a03f150505060005160e11461020e57610217565b6001915061021c565b600091505b5090565b60006000600060009150600092508160001461023b576102bf565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe78213156102b5575b600a82121561027a578180600101925050610264565b81600a14610287576102b0565b600a90505b60008160ff1611156102af5781806001900392505080806001900391505061028c565b5b6102be565b600092506102da565b5b816000146102cc576102d5565b600192506102da565b600092505b505090565b6000605f6106be600039605f60006000f0905090565b60006001905041600160a060020a0316732adc25665018aa1fe0e6bc666dac8fc2697ff9ba14156103255761032e565b600090506103f4565b446302b8feb0141561033f57610348565b600090506103f4565b43607814156103565761035f565b600090506103f4565b33600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b141561038957610392565b600090506103f4565b34606414156103a0576103a9565b600090506103f4565b3a600114156103b7576103c0565b600090506103f4565b32600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b14156103ea576103f3565b600090506103f4565b5b90565b6000600090505b60011561040a576103fe565b6001905090565b60006000905061041f610426565b6001905090565b61042e610411565b50565b60006000905061043f6102df565b50610448610220565b1561045257610478565b7ff000000000000000000000000000000000000000000000000000000000000000810190505b6104806101be565b1561048a576104b0565b7f0f00000000000000000000000000000000000000000000000000000000000000810190505b6104b8610124565b156104c2576104e7565b7ef0000000000000000000000000000000000000000000000000000000000000810190505b6104ef6102f5565b156104f95761051e565b7e0f000000000000000000000000000000000000000000000000000000000000810190505b60ff60008190555073a94f5374fce5edbc8e2a8697c15331677e6ebf0b60018190555060ff6002819055507f676c6f62616c2064617461203332206c656e67746820737472696e670000000060038190555073a94f5374fce5edbc8e2a8697c15331677e6ebf0b600460006000526020526040600020819055506105a06105d1565b156105aa576105ce565b7df00000000000000000000000000000000000000000000000000000000000810190505b90565b60006001905060005460ff14156105e7576105f0565b600090506106ba565b60025460005414156106015761060a565b600090506106ba565b600154600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b14156106365761063f565b600090506106ba565b6003547f676c6f62616c2064617461203332206c656e67746820737472696e6700000000141561066e57610677565b600090506106ba565b60046000600052602052604060002054600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b14156106b0576106b9565b600090506106ba565b5b905600605380600c6000396000f30060e060020a600035048062f55d9d14601d578063b9c3d0a514602c57005b60266004356045565b60006000f35b6032603c565b8060005260206000f35b600060e1905090565b80600160a060020a0316ff5056", "nonce" : "0", "storage" : { } } }, "transaction" : { "//" : "createContractFromMethod()", "data" : "0x7ee17e12", "//" : "runSolidityTests()", "data" : "0x0c4c9a80", "gasLimit" : "465224", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "d94f5374fce5edbc8e2a8697c15331677e6ebf0b", "value" : "100" } } }