aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-06-28 00:29:01 +0800
committerGitHub <noreply@github.com>2018-06-28 00:29:01 +0800
commit4a842ecc823c2d4152cdf2639eb83f2318499f1c (patch)
tree7733ac8095862aa2a9b43b93706ba56df7460a16 /test/compilationTests
parentce4b233f8f58f04d564aedc3061e7ecb1bf9737a (diff)
parent92cb4acd8a748ef2cf6a00a5a9f41975c23127c2 (diff)
downloaddexon-solidity-4a842ecc823c2d4152cdf2639eb83f2318499f1c.tar.gz
dexon-solidity-4a842ecc823c2d4152cdf2639eb83f2318499f1c.tar.zst
dexon-solidity-4a842ecc823c2d4152cdf2639eb83f2318499f1c.zip
Merge pull request #4097 from ethereum/noPackedExceptForPacked
[BREAKING] call only takes a single argument and does not pad
Diffstat (limited to 'test/compilationTests')
-rw-r--r--test/compilationTests/corion/moduleHandler.sol20
-rw-r--r--test/compilationTests/corion/multiOwner.sol6
-rw-r--r--test/compilationTests/corion/schelling.sol2
-rw-r--r--test/compilationTests/gnosis/Events/CategoricalEvent.sol2
-rw-r--r--test/compilationTests/gnosis/Events/EventFactory.sol4
-rw-r--r--test/compilationTests/gnosis/Events/ScalarEvent.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol4
-rw-r--r--test/compilationTests/zeppelin/MultisigWallet.sol2
8 files changed, 21 insertions, 21 deletions
diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol
index 080f599c..e77d9e09 100644
--- a/test/compilationTests/corion/moduleHandler.sol
+++ b/test/compilationTests/corion/moduleHandler.sol
@@ -117,7 +117,7 @@ contract moduleHandler is multiOwner, announcementTypes {
@id Index of module.
@found Was there any result or not.
*/
- bytes32 _name = keccak256(name);
+ bytes32 _name = keccak256(bytes(name));
for ( uint256 a=0 ; a<modules.length ; a++ ) {
if ( modules[a].name == _name ) {
return (true, true, a);
@@ -153,7 +153,7 @@ contract moduleHandler is multiOwner, announcementTypes {
require( _success );
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("replaceModule", keccak256(name, addr, callCallback))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("replaceModule", keccak256(abi.encodePacked(name, addr, callCallback)))) ) {
return true;
}
}
@@ -169,7 +169,7 @@ contract moduleHandler is multiOwner, announcementTypes {
function callReplaceCallback(string moduleName, address newModule) external returns (bool success) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(moduleName, newModule))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(abi.encodePacked(moduleName, newModule)))) ) {
return true;
}
(bool _success, bool _found, uint256 _id) = getModuleIDByName(moduleName);
@@ -192,11 +192,11 @@ contract moduleHandler is multiOwner, announcementTypes {
require( _success );
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("newModule", keccak256(name, addr, schellingEvent, transferEvent))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("newModule", keccak256(abi.encodePacked(name, addr, schellingEvent, transferEvent)))) ) {
return true;
}
}
- addModule( modules_s(addr, keccak256(name), schellingEvent, transferEvent), true);
+ addModule( modules_s(addr, keccak256(bytes(name)), schellingEvent, transferEvent), true);
return true;
}
function dropModule(string name, bool callCallback) external returns (bool success) {
@@ -211,7 +211,7 @@ contract moduleHandler is multiOwner, announcementTypes {
require( _success );
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("replaceModule", keccak256(name, callCallback))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("replaceModule", keccak256(abi.encodePacked(name, callCallback)))) ) {
return true;
}
}
@@ -226,7 +226,7 @@ contract moduleHandler is multiOwner, announcementTypes {
function callDisableCallback(string moduleName) external returns (bool success) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(moduleName))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(bytes(moduleName)))) ) {
return true;
}
(bool _success, bool _found, uint256 _id) = getModuleIDByName(moduleName);
@@ -289,7 +289,7 @@ contract moduleHandler is multiOwner, announcementTypes {
require( _success );
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("replaceModuleHandler", keccak256(newHandler))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("replaceModuleHandler", keccak256(abi.encodePacked(newHandler)))) ) {
return true;
}
}
@@ -419,7 +419,7 @@ contract moduleHandler is multiOwner, announcementTypes {
require( _success );
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
require( block.number < debugModeUntil );
- if ( ! insertAndCheckDo(calcDoHash("configureModule", keccak256(moduleName, aType, value))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("configureModule", keccak256(abi.encodePacked(moduleName, aType, value)))) ) {
return true;
}
}
@@ -437,7 +437,7 @@ contract moduleHandler is multiOwner, announcementTypes {
*/
require( owners[msg.sender] );
if ( forever ) {
- if ( ! insertAndCheckDo(calcDoHash("freezing", keccak256(forever))) ) {
+ if ( ! insertAndCheckDo(calcDoHash("freezing", keccak256(abi.encodePacked(forever)))) ) {
return;
}
}
diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol
index 0a0a44c5..2b8a46b9 100644
--- a/test/compilationTests/corion/multiOwner.sol
+++ b/test/compilationTests/corion/multiOwner.sol
@@ -21,12 +21,12 @@ contract multiOwner is safeMath {
Externals
*/
function insertOwner(address addr) external {
- if ( insertAndCheckDo(calcDoHash("insertOwner", keccak256(addr))) ) {
+ if ( insertAndCheckDo(calcDoHash("insertOwner", keccak256(abi.encodePacked(addr)))) ) {
_addOwner(addr);
}
}
function dropOwner(address addr) external {
- if ( insertAndCheckDo(calcDoHash("dropOwner", keccak256(addr))) ) {
+ if ( insertAndCheckDo(calcDoHash("dropOwner", keccak256(abi.encodePacked(addr)))) ) {
_delOwner(addr);
}
}
@@ -42,7 +42,7 @@ contract multiOwner is safeMath {
return ownerCount * 75 / 100;
}
function calcDoHash(string job, bytes32 data) public constant returns (bytes32 hash) {
- return keccak256(job, data);
+ return keccak256(abi.encodePacked(job, data));
}
function validDoHash(bytes32 doHash) public constant returns (bool valid) {
return doDB[doHash].length > 0;
diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol
index e092e311..f8c36fc5 100644
--- a/test/compilationTests/corion/schelling.sol
+++ b/test/compilationTests/corion/schelling.sol
@@ -335,7 +335,7 @@ contract schelling is module, announcementTypes, schellingVars {
require( voter.status == voterStatus.afterPrepareVote );
require( voter.roundID < currentRound );
- if ( keccak256(vote) == voter.hash ) {
+ if ( keccak256(bytes(vote)) == voter.hash ) {
delete voter.hash;
if (round.blockHeight+roundBlockDelay/2 >= block.number) {
if ( bytes(vote)[0] == aboveChar ) {
diff --git a/test/compilationTests/gnosis/Events/CategoricalEvent.sol b/test/compilationTests/gnosis/Events/CategoricalEvent.sol
index 4433bdfd..0f5196e8 100644
--- a/test/compilationTests/gnosis/Events/CategoricalEvent.sol
+++ b/test/compilationTests/gnosis/Events/CategoricalEvent.sol
@@ -48,6 +48,6 @@ contract CategoricalEvent is Event {
constant
returns (bytes32)
{
- return keccak256(collateralToken, oracle, outcomeTokens.length);
+ return keccak256(abi.encodePacked(collateralToken, oracle, outcomeTokens.length));
}
}
diff --git a/test/compilationTests/gnosis/Events/EventFactory.sol b/test/compilationTests/gnosis/Events/EventFactory.sol
index acef3330..cfe772ec 100644
--- a/test/compilationTests/gnosis/Events/EventFactory.sol
+++ b/test/compilationTests/gnosis/Events/EventFactory.sol
@@ -35,7 +35,7 @@ contract EventFactory {
public
returns (CategoricalEvent eventContract)
{
- bytes32 eventHash = keccak256(collateralToken, oracle, outcomeCount);
+ bytes32 eventHash = keccak256(abi.encodePacked(collateralToken, oracle, outcomeCount));
// Event should not exist yet
require(address(categoricalEvents[eventHash]) == address(0));
// Create event
@@ -63,7 +63,7 @@ contract EventFactory {
public
returns (ScalarEvent eventContract)
{
- bytes32 eventHash = keccak256(collateralToken, oracle, lowerBound, upperBound);
+ bytes32 eventHash = keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound));
// Event should not exist yet
require(address(scalarEvents[eventHash]) == address(0));
// Create event
diff --git a/test/compilationTests/gnosis/Events/ScalarEvent.sol b/test/compilationTests/gnosis/Events/ScalarEvent.sol
index 4f268a38..d5cbef14 100644
--- a/test/compilationTests/gnosis/Events/ScalarEvent.sol
+++ b/test/compilationTests/gnosis/Events/ScalarEvent.sol
@@ -82,6 +82,6 @@ contract ScalarEvent is Event {
constant
returns (bytes32)
{
- return keccak256(collateralToken, oracle, lowerBound, upperBound);
+ return keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound));
}
}
diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol
index 83990b9b..121824ff 100644
--- a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol
@@ -58,7 +58,7 @@ contract SignedMessageOracle is Oracle {
// Result is not set yet and nonce and signer are valid
require( !isSet
&& _nonce > nonce
- && signer == ecrecover(keccak256(descriptionHash, newSigner, _nonce), v, r, s));
+ && signer == ecrecover(keccak256(abi.encodePacked(descriptionHash, newSigner, _nonce)), v, r, s));
nonce = _nonce;
signer = newSigner;
emit SignerReplacement(newSigner);
@@ -74,7 +74,7 @@ contract SignedMessageOracle is Oracle {
{
// Result is not set yet and signer is valid
require( !isSet
- && signer == ecrecover(keccak256(descriptionHash, _outcome), v, r, s));
+ && signer == ecrecover(keccak256(abi.encodePacked(descriptionHash, _outcome)), v, r, s));
isSet = true;
outcome = _outcome;
emit OutcomeAssignment(_outcome);
diff --git a/test/compilationTests/zeppelin/MultisigWallet.sol b/test/compilationTests/zeppelin/MultisigWallet.sol
index 83df125c..ea620fc0 100644
--- a/test/compilationTests/zeppelin/MultisigWallet.sol
+++ b/test/compilationTests/zeppelin/MultisigWallet.sol
@@ -66,7 +66,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
return 0;
}
// determine our operation hash.
- _r = keccak256(msg.data, block.number);
+ _r = keccak256(abi.encodePacked(msg.data, block.number));
if (!confirm(_r) && txs[_r].to == address(0)) {
txs[_r].to = _to;
txs[_r].value = _value;