mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Style Changes
New exception for values larger than 2**256 Auto format .json files
This commit is contained in:
parent
b8a07a22be
commit
f853f4a937
@ -110,9 +110,9 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state)
|
|||||||
|
|
||||||
bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936");
|
bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936");
|
||||||
if (bigint(o["balance"].get_str()) >= biValue256)
|
if (bigint(o["balance"].get_str()) >= biValue256)
|
||||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("State 'balance' is equal or greater than 2**256") );
|
BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") );
|
||||||
if (bigint(o["nonce"].get_str()) >= biValue256)
|
if (bigint(o["nonce"].get_str()) >= biValue256)
|
||||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("State 'nonce' is equal or greater than 2**256") );
|
BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") );
|
||||||
|
|
||||||
Address address = Address(i.first);
|
Address address = Address(i.first);
|
||||||
|
|
||||||
@ -148,14 +148,13 @@ void ImportTest::importTransaction(json_spirit::mObject& _o)
|
|||||||
|
|
||||||
bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936");
|
bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936");
|
||||||
if (bigint(_o["nonce"].get_str()) >= biValue256)
|
if (bigint(_o["nonce"].get_str()) >= biValue256)
|
||||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") );
|
BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") );
|
||||||
if (bigint(_o["gasPrice"].get_str()) >= biValue256)
|
if (bigint(_o["gasPrice"].get_str()) >= biValue256)
|
||||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") );
|
BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") );
|
||||||
if (bigint(_o["gasLimit"].get_str()) >= biValue256)
|
if (bigint(_o["gasLimit"].get_str()) >= biValue256)
|
||||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") );
|
BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") );
|
||||||
if (bigint(_o["value"].get_str()) >= biValue256)
|
if (bigint(_o["value"].get_str()) >= biValue256)
|
||||||
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") );
|
BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") );
|
||||||
|
|
||||||
|
|
||||||
m_transaction = _o["to"].get_str().empty() ?
|
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"]), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())) :
|
||||||
|
@ -100,7 +100,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
|
|||||||
BOOST_REQUIRE(o.count("transaction") > 0);
|
BOOST_REQUIRE(o.count("transaction") > 0);
|
||||||
|
|
||||||
mObject tObj = o["transaction"].get_obj();
|
mObject tObj = o["transaction"].get_obj();
|
||||||
Transaction txFromFields(createRLPStreamFromTransactionFields(tObj).out(),CheckSignature::Sender);
|
Transaction txFromFields(createRLPStreamFromTransactionFields(tObj).out(), CheckSignature::Sender);
|
||||||
|
|
||||||
//Check the fields restored from RLP to original fields
|
//Check the fields restored from RLP to original fields
|
||||||
BOOST_CHECK_MESSAGE(txFromFields.data() == txFromRlp.data(), "Data in given RLP not matching the Transaction data!");
|
BOOST_CHECK_MESSAGE(txFromFields.data() == txFromRlp.data(), "Data in given RLP not matching the Transaction data!");
|
||||||
|
@ -166,7 +166,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"TransactionWithGasPriceOverflow" : {
|
"TransactionWithGasPriceOverflow" : {
|
||||||
"transaction" :
|
"transaction" :
|
||||||
{
|
{
|
||||||
"data" : "",
|
"data" : "",
|
||||||
|
Loading…
Reference in New Issue
Block a user