diff options
author | Gav Wood <g@ethdev.com> | 2015-02-11 03:15:17 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-02-11 03:15:17 +0800 |
commit | 92fd2b191d46c0032399c0311000eda5836adfa3 (patch) | |
tree | 14aca4aae1fdb6db43734d39663e97f66bfe3b21 /TestHelper.cpp | |
parent | 466f0e01001bae0782d7f41ef944301f1a2e1e7f (diff) | |
parent | c09b7885e88b842a024e6b8a2e6cf5fd5d845ab3 (diff) | |
download | dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.tar dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.tar.gz dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.tar.bz2 dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.tar.lz dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.tar.xz dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.tar.zst dexon-solidity-92fd2b191d46c0032399c0311000eda5836adfa3.zip |
Merge pull request #916 from winsvega/develop
transaction address length test fix
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 5a579702..8e4c493e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -108,6 +108,11 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state) BOOST_REQUIRE(o.count("storage") > 0); BOOST_REQUIRE(o.count("code") > 0); + if (bigint(o["balance"].get_str()) >= c_max256plus1) + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); + if (bigint(o["nonce"].get_str()) >= c_max256plus1) + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); + Address address = Address(i.first); bytes code = importCode(o); @@ -140,6 +145,15 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) BOOST_REQUIRE(_o.count("secretKey") > 0); BOOST_REQUIRE(_o.count("data") > 0); + if (bigint(_o["nonce"].get_str()) >= c_max256plus1) + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); + if (bigint(_o["gasPrice"].get_str()) >= c_max256plus1) + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); + if (bigint(_o["gasLimit"].get_str()) >= c_max256plus1) + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); + if (bigint(_o["value"].get_str()) >= c_max256plus1) + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater 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())); |