mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update tests for strict address literals
This commit is contained in:
parent
48b003d4d4
commit
98c9ca2575
@ -123,7 +123,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
record.renewalDate = now + c_renewalInterval;
|
||||
record.owner = auction.highestBidder;
|
||||
Changed(_name);
|
||||
if (previousOwner != 0) {
|
||||
if (previousOwner != 0x0000000000000000000000000000000000000000) {
|
||||
if (!record.owner.send(auction.sumOfBids - auction.highestBid / 100))
|
||||
throw;
|
||||
} else {
|
||||
@ -143,7 +143,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
bid(_name, msg.sender, msg.value);
|
||||
} else {
|
||||
Record record = m_toRecord[_name];
|
||||
if (record.owner != 0)
|
||||
if (record.owner != 0x0000000000000000000000000000000000000000)
|
||||
throw;
|
||||
m_toRecord[_name].owner = msg.sender;
|
||||
Changed(_name);
|
||||
|
@ -76,7 +76,7 @@ contract FixedFeeRegistrar is Registrar {
|
||||
|
||||
function reserve(string _name) payable {
|
||||
Record rec = m_record(_name);
|
||||
if (rec.owner == 0 && msg.value >= c_fee) {
|
||||
if (rec.owner == 0x0000000000000000000000000000000000000000 && msg.value >= c_fee) {
|
||||
rec.owner = msg.sender;
|
||||
Changed(_name);
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ contract Wallet is multisig, multiowned, daylimit {
|
||||
}
|
||||
// determine our operation hash.
|
||||
_r = keccak256(msg.data, block.number);
|
||||
if (!confirm(_r) && m_txs[_r].to == 0) {
|
||||
if (!confirm(_r) && m_txs[_r].to == 0x0000000000000000000000000000000000000000) {
|
||||
m_txs[_r].to = _to;
|
||||
m_txs[_r].value = _value;
|
||||
m_txs[_r].data = _data;
|
||||
@ -410,7 +410,7 @@ contract Wallet is multisig, multiowned, daylimit {
|
||||
// confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order
|
||||
// to determine the body of the transaction from the hash provided.
|
||||
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
|
||||
if (m_txs[_h].to != 0) {
|
||||
if (m_txs[_h].to != 0x0000000000000000000000000000000000000000) {
|
||||
m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data);
|
||||
MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data);
|
||||
delete m_txs[_h];
|
||||
|
@ -279,9 +279,9 @@ BOOST_AUTO_TEST_CASE(storage_array_dyn)
|
||||
address[] addr;
|
||||
event E(address[] a);
|
||||
function f() public {
|
||||
addr.push(1);
|
||||
addr.push(2);
|
||||
addr.push(3);
|
||||
addr.push(0x0000000000000000000000000000000000000001);
|
||||
addr.push(0x0000000000000000000000000000000000000002);
|
||||
addr.push(0x0000000000000000000000000000000000000003);
|
||||
E(addr);
|
||||
}
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ BOOST_AUTO_TEST_CASE(storage_value_vars)
|
||||
string text = R"(
|
||||
contract C
|
||||
{
|
||||
address a;
|
||||
uint a;
|
||||
bool b;
|
||||
uint c;
|
||||
function f(uint x) public {
|
||||
@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE(storage_value_vars)
|
||||
text = R"(
|
||||
contract C
|
||||
{
|
||||
address a;
|
||||
uint a;
|
||||
bool b;
|
||||
uint c;
|
||||
function f() public view {
|
||||
@ -479,7 +479,7 @@ BOOST_AUTO_TEST_CASE(storage_value_vars)
|
||||
require(a < 100);
|
||||
assert(c >= 0);
|
||||
}
|
||||
address a;
|
||||
uint a;
|
||||
bool b;
|
||||
uint c;
|
||||
}
|
||||
|
@ -9460,8 +9460,8 @@ BOOST_AUTO_TEST_CASE(failing_ecrecover_invalid_input_proper)
|
||||
0, // invalid v value
|
||||
0x6944c77849b18048f6abe0db8084b0d0d0689cdddb53d2671c36967b58691ad4,
|
||||
0xef4f06ba4f78319baafd0424365777241af4dfd3da840471b4b4b087b7750d0d,
|
||||
0xca35b7d915458ef540ade6068dfe2f44e8fa733c,
|
||||
0xca35b7d915458ef540ade6068dfe2f44e8fa733c
|
||||
0x00ca35b7d915458ef540ade6068dfe2f44e8fa733c,
|
||||
0x00ca35b7d915458ef540ade6068dfe2f44e8fa733c
|
||||
);
|
||||
}
|
||||
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s, uint blockExpired, bytes32 salt)
|
||||
|
@ -490,7 +490,7 @@ BOOST_AUTO_TEST_CASE(intermediately_overflowing_literals)
|
||||
// have been applied
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f() { var x = (0xffffffffffffffffffffffffffffffffffffffff * 0xffffffffffffffffffffffffff01) & 0xbf; }
|
||||
function f() { var x = (0x00ffffffffffffffffffffffffffffffffffffffff * 0xffffffffffffffffffffffffff01) & 0xbf; }
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode);
|
||||
|
@ -4,9 +4,9 @@ contract test {
|
||||
x;
|
||||
}
|
||||
function g() public {
|
||||
suicide(1);
|
||||
suicide(0x0000000000000000000000000000000000000001);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (58-64): "sha3" has been deprecated in favour of "keccak256"
|
||||
// TypeError: (99-109): "suicide" has been deprecated in favour of "selfdestruct"
|
||||
// TypeError: (99-150): "suicide" has been deprecated in favour of "selfdestruct"
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (64-106): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
|
||||
// SyntaxError: (64-106): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (64-106): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
|
||||
// SyntaxError: (64-106): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (64-105): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0x0A0BfC97E48458494ccD857e1A85Dc91f7f0046e'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
|
||||
// SyntaxError: (64-105): This looks like an address but is not exactly 40 hex digits. It is 39 hex digits.
|
||||
|
@ -5,5 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (64-107): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
|
||||
// TypeError: (52-107): Type int_const 2284...(42 digits omitted)...9360 is not implicitly convertible to expected type address.
|
||||
// SyntaxError: (64-107): This looks like an address but is not exactly 40 hex digits. It is 41 hex digits.
|
||||
|
@ -1,8 +1,8 @@
|
||||
contract test {
|
||||
function fun(uint256 a) returns (address b) {
|
||||
function fun(uint256 a) returns (uint8 b) {
|
||||
if (a < 0) b = 0x67; else if (a == 0) b = 0x12; else b = 0x78;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (20-142): No visibility specified. Defaulting to "public".
|
||||
// Warning: (20-142): Function state mutability can be restricted to pure
|
||||
// Warning: (20-140): No visibility specified. Defaulting to "public".
|
||||
// Warning: (20-140): Function state mutability can be restricted to pure
|
||||
|
@ -1,3 +1,3 @@
|
||||
contract c {
|
||||
modifier mod { if (msg.sender == 0) _; }
|
||||
modifier mod { if (msg.sender == 0x0000000000000000000000000000000000000000) _; }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user