diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-06-13 00:25:20 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-06-13 01:16:18 +0800 |
commit | d39917fd0d80bcb711654cfd82c1dd5f04c4c7be (patch) | |
tree | c13cbfa3e733ee4e882478c396df8148f017f8de /test | |
parent | 9de45383d81c666deba27162ce163fc1c8c852dc (diff) | |
download | dexon-solidity-d39917fd0d80bcb711654cfd82c1dd5f04c4c7be.tar.gz dexon-solidity-d39917fd0d80bcb711654cfd82c1dd5f04c4c7be.tar.zst dexon-solidity-d39917fd0d80bcb711654cfd82c1dd5f04c4c7be.zip |
Update external contract in compilationTests to not use deprecated sha3
Diffstat (limited to 'test')
-rw-r--r-- | test/compilationTests/corion/moduleHandler.sol | 50 | ||||
-rw-r--r-- | test/compilationTests/corion/multiOwner.sol | 6 | ||||
-rw-r--r-- | test/compilationTests/corion/schelling.sol | 2 | ||||
-rw-r--r-- | test/compilationTests/milestonetracker/MilestoneTracker.sol | 4 |
4 files changed, 31 insertions, 31 deletions
diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol index 682f81dd..3aefce30 100644 --- a/test/compilationTests/corion/moduleHandler.sol +++ b/test/compilationTests/corion/moduleHandler.sol @@ -54,11 +54,11 @@ contract moduleHandler is multiOwner, announcementTypes { require( owners[msg.sender] ); require( modules.length == 0 ); foundationAddress = foundation; - addModule( modules_s(Token, sha3('Token'), false, false), ! forReplace); - addModule( modules_s(Premium, sha3('Premium'), false, false), ! forReplace); - addModule( modules_s(Publisher, sha3('Publisher'), false, true), ! forReplace); - addModule( modules_s(Schelling, sha3('Schelling'), false, true), ! forReplace); - addModule( modules_s(Provider, sha3('Provider'), true, true), ! forReplace); + addModule( modules_s(Token, keccak256('Token'), false, false), ! forReplace); + addModule( modules_s(Premium, keccak256('Premium'), false, false), ! forReplace); + addModule( modules_s(Publisher, keccak256('Publisher'), false, true), ! forReplace); + addModule( modules_s(Schelling, keccak256('Schelling'), false, true), ! forReplace); + addModule( modules_s(Provider, keccak256('Provider'), true, true), ! forReplace); } function addModule(modules_s input, bool call) internal { /* @@ -117,7 +117,7 @@ contract moduleHandler is multiOwner, announcementTypes { @id Index of module. @found Was there any result or not. */ - bytes32 _name = sha3(name); + bytes32 _name = keccak256(name); for ( uint256 a=0 ; a<modules.length ; a++ ) { if ( modules[a].name == _name ) { return (true, true, a); @@ -151,9 +151,9 @@ contract moduleHandler is multiOwner, announcementTypes { */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); require( _success ); - if ( ! ( _found && modules[_id].name == sha3('Publisher') )) { + if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) { require( block.number < debugModeUntil ); - if ( ! insertAndCheckDo(calcDoHash("replaceModule", sha3(name, addr, callCallback))) ) { + if ( ! insertAndCheckDo(calcDoHash("replaceModule", keccak256(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", sha3(moduleName, newModule))) ) { + if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(moduleName, newModule))) ) { return true; } var (_success, _found, _id) = getModuleIDByName(moduleName); @@ -190,13 +190,13 @@ contract moduleHandler is multiOwner, announcementTypes { */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); require( _success ); - if ( ! ( _found && modules[_id].name == sha3('Publisher') )) { + if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) { require( block.number < debugModeUntil ); - if ( ! insertAndCheckDo(calcDoHash("newModule", sha3(name, addr, schellingEvent, transferEvent))) ) { + if ( ! insertAndCheckDo(calcDoHash("newModule", keccak256(name, addr, schellingEvent, transferEvent))) ) { return true; } } - addModule( modules_s(addr, sha3(name), schellingEvent, transferEvent), true); + addModule( modules_s(addr, keccak256(name), schellingEvent, transferEvent), true); return true; } function dropModule(string name, bool callCallback) external returns (bool success) { @@ -209,9 +209,9 @@ contract moduleHandler is multiOwner, announcementTypes { */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); require( _success ); - if ( ! ( _found && modules[_id].name == sha3('Publisher') )) { + if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) { require( block.number < debugModeUntil ); - if ( ! insertAndCheckDo(calcDoHash("replaceModule", sha3(name, callCallback))) ) { + if ( ! insertAndCheckDo(calcDoHash("replaceModule", keccak256(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", sha3(moduleName))) ) { + if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(moduleName))) ) { return true; } var (_success, _found, _id) = getModuleIDByName(moduleName); @@ -248,7 +248,7 @@ contract moduleHandler is multiOwner, announcementTypes { @bool Was the function successfull? */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); - require( _success && _found && modules[_id].name == sha3('Token') ); + require( _success && _found && modules[_id].name == keccak256('Token') ); for ( uint256 a=0 ; a<modules.length ; a++ ) { if ( modules[a].transferEvent && abstractModule(modules[a].addr).isActive() ) { require( abstractModule(modules[a].addr).transferEvent(from, to, value) ); @@ -267,7 +267,7 @@ contract moduleHandler is multiOwner, announcementTypes { @bool Was the function successfull? */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); - require( _success && _found && modules[_id].name == sha3('Schelling') ); + require( _success && _found && modules[_id].name == keccak256('Schelling') ); for ( uint256 a=0 ; a<modules.length ; a++ ) { if ( modules[a].schellingEvent && abstractModule(modules[a].addr).isActive() ) { require( abstractModule(modules[a].addr).newSchellingRoundEvent(roundID, reward) ); @@ -287,9 +287,9 @@ contract moduleHandler is multiOwner, announcementTypes { */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); require( _success ); - if ( ! ( _found && modules[_id].name == sha3('Publisher') )) { + if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) { require( block.number < debugModeUntil ); - if ( ! insertAndCheckDo(calcDoHash("replaceModuleHandler", sha3(newHandler))) ) { + if ( ! insertAndCheckDo(calcDoHash("replaceModuleHandler", keccak256(newHandler))) ) { return true; } } @@ -353,7 +353,7 @@ contract moduleHandler is multiOwner, announcementTypes { @success Was the function successfull? */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); - require( _success && _found && modules[_id].name == sha3('Provider') ); + require( _success && _found && modules[_id].name == keccak256('Provider') ); (_success, _found, _id) = getModuleIDByName('Token'); require( _success && _found ); require( token(modules[_id].addr).mint(to, value) ); @@ -385,7 +385,7 @@ contract moduleHandler is multiOwner, announcementTypes { @success Was the function successfull? */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); - require( _success && _found && modules[_id].name == sha3('Provider') ); + require( _success && _found && modules[_id].name == keccak256('Provider') ); (_success, _found, _id) = getModuleIDByName('Token'); require( _success && _found ); require( token(modules[_id].addr).processTransactionFee(from, value) ); @@ -400,7 +400,7 @@ contract moduleHandler is multiOwner, announcementTypes { @success Was the function successfull? */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); - require( _success && _found && modules[_id].name == sha3('Schelling') ); + require( _success && _found && modules[_id].name == keccak256('Schelling') ); (_success, _found, _id) = getModuleIDByName('Token'); require( _success && _found ); require( token(modules[_id].addr).burn(from, value) ); @@ -417,9 +417,9 @@ contract moduleHandler is multiOwner, announcementTypes { */ var (_success, _found, _id) = getModuleIDByAddress(msg.sender); require( _success ); - if ( ! ( _found && modules[_id].name == sha3('Publisher') )) { + if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) { require( block.number < debugModeUntil ); - if ( ! insertAndCheckDo(calcDoHash("configureModule", sha3(moduleName, aType, value))) ) { + if ( ! insertAndCheckDo(calcDoHash("configureModule", keccak256(moduleName, aType, value))) ) { return true; } } @@ -437,7 +437,7 @@ contract moduleHandler is multiOwner, announcementTypes { */ require( owners[msg.sender] ); if ( forever ) { - if ( ! insertAndCheckDo(calcDoHash("freezing", sha3(forever))) ) { + if ( ! insertAndCheckDo(calcDoHash("freezing", keccak256(forever))) ) { return; } } diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol index 9aae0ebd..b8436c8b 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", sha3(addr))) ) { + if ( insertAndCheckDo(calcDoHash("insertOwner", keccak256(addr))) ) { _addOwner(addr); } } function dropOwner(address addr) external { - if ( insertAndCheckDo(calcDoHash("dropOwner", sha3(addr))) ) { + if ( insertAndCheckDo(calcDoHash("dropOwner", keccak256(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 sha3(job, data); + return keccak256(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 8c8e093c..b74cfb46 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 ( sha3(vote) == voter.hash ) { + if ( keccak256(vote) == voter.hash ) { delete voter.hash; if (round.blockHeight+roundBlockDelay/2 >= block.number) { if ( bytes(vote)[0] == aboveChar ) { diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol index 318330df..2f0d58cb 100644 --- a/test/compilationTests/milestonetracker/MilestoneTracker.sol +++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol @@ -196,7 +196,7 @@ contract MilestoneTracker { } /// @notice `onlyDonor` Approves the proposed milestone list - /// @param _hashProposals The sha3() of the proposed milestone list's + /// @param _hashProposals The keccak256() of the proposed milestone list's /// bytecode; this confirms that the `donor` knows the set of milestones /// they are approving function acceptProposedMilestones(bytes32 _hashProposals @@ -205,7 +205,7 @@ contract MilestoneTracker { uint i; if (!changingMilestones) throw; - if (sha3(proposedMilestones) != _hashProposals) throw; + if (keccak256(proposedMilestones) != _hashProposals) throw; // Cancel all the unfinished milestones for (i=0; i<milestones.length; i++) { |