aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwinsvega <winsvega@mail.ru>2015-02-01 02:00:35 +0800
committerwinsvega <winsvega@mail.ru>2015-02-01 02:00:35 +0800
commitf7f26d0fbd6f8ba1f00a547dd243f4394e3b524c (patch)
tree795c2c06f3174e6b01fb8c8898c66ae18b65adc4
parent7b51526a2ca9670f3a31966bf3d3a47a034f0b37 (diff)
downloaddexon-solidity-f7f26d0fbd6f8ba1f00a547dd243f4394e3b524c.tar.gz
dexon-solidity-f7f26d0fbd6f8ba1f00a547dd243f4394e3b524c.tar.zst
dexon-solidity-f7f26d0fbd6f8ba1f00a547dd243f4394e3b524c.zip
state test conditions to filler files
-rw-r--r--TestHelper.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 5a579702..8cb4e11c 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -108,6 +108,12 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state)
BOOST_REQUIRE(o.count("storage") > 0);
BOOST_REQUIRE(o.count("code") > 0);
+ bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936");
+ if (bigint(o["balance"].get_str()) >= biValue256)
+ BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("State 'balance' is equal or grater than 2**256") );
+ if (bigint(o["nonce"].get_str()) >= biValue256)
+ BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("State 'nonce' is equal or grater than 2**256") );
+
Address address = Address(i.first);
bytes code = importCode(o);
@@ -140,6 +146,16 @@ void ImportTest::importTransaction(json_spirit::mObject& _o)
BOOST_REQUIRE(_o.count("secretKey") > 0);
BOOST_REQUIRE(_o.count("data") > 0);
+ bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936");
+ if (bigint(_o["nonce"].get_str()) >= biValue256)
+ BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'nonce' is equal or grater than 2**256") );
+ if (bigint(_o["gasPrice"].get_str()) >= biValue256)
+ BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'gasPrice' is equal or grater than 2**256") );
+ if (bigint(_o["gasLimit"].get_str()) >= biValue256)
+ BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'gasLimit' is equal or grater than 2**256") );
+ if (bigint(_o["value"].get_str()) >= biValue256)
+ BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'value' is equal or grater than 2**256") );
+
m_transaction = _o["to"].get_str().empty() ?
Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())) :
Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), Address(_o["to"].get_str()), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str()));