@@ -156,7 +156,6 @@ contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall
156156
157157 bridgeSkillIfNotMiningChain (skillCount);
158158
159- emit SkillAdded (skillCount, _parentSkillId);
160159 return skillCount;
161160 }
162161
@@ -175,11 +174,17 @@ contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall
175174 bridgeData[miningBridgeAddress].skillCreationAfter
176175 );
177176
177+ // This succeeds if not set, but we don't want to block e.g. domain creation if that's the situation we're in,
178+ // and we can re-call this function to bridge later if necessary.
178179 (bool success , bytes memory returnData ) = miningBridgeAddress.call (payload);
179180 require (success, "colony-network-unable-to-bridge-skill-creation " );
180181 }
181182
182183 function addSkillToChainTree (uint256 _parentSkillId , uint256 _skillId ) private {
184+ // This indicates a new root local skill bridged from another chain. We don't do anything to the tree
185+ // in this scenario, other than incrementing
186+ // (this mirrors the behaviour of not calling addSkill() in initialiseRootLocalSkill)
187+ if (_parentSkillId != 0 && _parentSkillId << 128 == 0 ) { return ; }
183188
184189 Skill storage parentSkill = skills[_parentSkillId];
185190 // Global and local skill trees are kept separate
@@ -222,11 +227,13 @@ contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall
222227 treeWalkingCounter += 1 ;
223228 }
224229 } else {
225- // Add a global skill
230+ // Add a global skill. Should not be possible on a non-mining chain
226231 require (isMiningChain (), "colony-network-not-mining-chain " );
227232 s.globalSkill = true ;
228233 skills[_skillId] = s;
229234 }
235+
236+ emit SkillAdded (_skillId, _parentSkillId);
230237 }
231238
232239 function addSkillFromBridge (uint256 _parentSkillId , uint256 _skillId ) public always onlyMiningChain () {
@@ -238,7 +245,6 @@ contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall
238245 if (networkSkillCounts[bridge.chainId] + 1 == _skillId){
239246 addSkillToChainTree (_parentSkillId, _skillId);
240247 networkSkillCounts[bridge.chainId] += 1 ;
241- emit SkillAdded (_skillId, _parentSkillId);
242248 } else if (networkSkillCounts[bridge.chainId] < _skillId){
243249 pendingSkillAdditions[bridge.chainId][_skillId] = _parentSkillId;
244250 // TODO: Event?
@@ -263,14 +269,11 @@ contract ColonyNetwork is BasicMetaTransaction, ColonyNetworkStorage, Multicall
263269
264270 uint256 parentSkillId = pendingSkillAdditions[bridge.chainId][_skillId];
265271 require (parentSkillId != 0 , "colony-network-no-such-bridged-skill " );
266- if (parentSkillId > bridge.chainId << 128 ){
267- addSkillToChainTree (parentSkillId, _skillId);
268- }
272+ addSkillToChainTree (parentSkillId, _skillId);
269273 networkSkillCounts[bridge.chainId] += 1 ;
270274
271275 // Delete the pending addition
272276 delete pendingSkillAdditions[bridge.chainId][_skillId];
273- emit SkillAdded (_skillId, parentSkillId);
274277 }
275278
276279 function getParentSkillId (uint _skillId , uint _parentSkillIndex ) public view returns (uint256 ) {
0 commit comments