Skip to content

Commit a1bc443

Browse files
committed
Slightly harder changes following review
1 parent 9dce14d commit a1bc443

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

contracts/colonyNetwork/ColonyNetwork.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,10 @@ contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall,
195195
}
196196

197197
function setColonyReputationDecayRateFromBridge(address _colony, uint256 _numerator, uint256 _denominator) public always
198+
knownBridge(msgSender())
198199
onlyMiningChain
199200
{
200-
uint256 bridgeChainId = bridgeData[msgSender()].chainId;
201-
require(bridgeChainId != 0, "colony-network-not-known-bridge");
202-
203-
setColonyReputationDecayRateInternal(bridgeChainId, _colony, _numerator, _denominator);
201+
setColonyReputationDecayRateInternal(bridgeData[msgSender()].chainId, _colony, _numerator, _denominator);
204202
}
205203

206204
function setColonyReputationDecayRateInternal(uint256 _chainId, address _colony, uint256 _numerator, uint256 _denominator) internal {

contracts/colonyNetwork/ColonyNetworkMining.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,14 @@ contract ColonyNetworkMining is ColonyNetworkStorage, ScaleReputation {
8686

8787
// Well this is a weird hack to need
8888
function newAddressArray() pure internal returns (address[] memory) {}
89-
function setReputationRootHashFromBridge(bytes32 newHash, uint256 newNLeaves) onlyNotMiningChain stoppable public {
90-
require(bridgeData[msgSender()].chainId != 0, "colony-network-not-known-bridge");
89+
function setReputationRootHashFromBridge(bytes32 newHash, uint256 newNLeaves) onlyNotMiningChain stoppable knownBridge(msgSender()) public {
9190
reputationRootHash = newHash;
9291
reputationRootHashNLeaves = newNLeaves;
9392

9493
emit ReputationRootHashSet(newHash, newNLeaves, newAddressArray(), 0);
9594
}
9695

97-
function bridgeCurrentRootHash(address _bridgeAddress) onlyMiningChain stoppable public {
98-
require(bridgeData[_bridgeAddress].chainId != 0, "colony-network-not-known-bridge");
96+
function bridgeCurrentRootHash(address _bridgeAddress) onlyMiningChain stoppable knownBridge(_bridgeAddress) public {
9997
bytes memory payload = abi.encodePacked(
10098
bridgeData[_bridgeAddress].setReputationRootHashBefore,
10199
abi.encodeWithSignature("setReputationRootHashFromBridge(bytes32,uint256)", reputationRootHash, reputationRootHashNLeaves),

contracts/colonyNetwork/ColonyNetworkStorage.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ contract ColonyNetworkStorage is ColonyNetworkDataTypes, DSMath, CommonStorage,
165165
_;
166166
}
167167

168+
modifier knownBridge(address _bridgeAddress) {
169+
require(bridgeData[_bridgeAddress].chainId != 0, "colony-network-not-known-bridge");
170+
_;
171+
}
172+
168173
// Internal functions
169174

170175
function toRootSkillId(uint256 _chainId) internal pure returns (uint256) {

0 commit comments

Comments
 (0)