Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return isGlobalSkill boolean flag in ColonyNetwork.getSkill #279

Conversation

KevinLiLu
Copy link
Contributor

@KevinLiLu KevinLiLu commented Jul 13, 2018

Closes #249

Ignore the atrocious branch name 😋

  • Add a isGlobalSkill boolean flag as the 3rd return value of ColonyNetwork.getSkill so users do not need to make an additional call to isGlobalSkill

Copy link
Contributor

@elenadimitrova elenadimitrova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to remove isGlobalSkill altogether to make this cleaner

function getSkill(uint256 _skillId) public view returns (uint256, uint256) {
return (skills[_skillId].nParents, skills[_skillId].nChildren);
function getSkill(uint256 _skillId) public view returns (uint256, uint256, bool) {
Skill storage skill = skills[_skillId];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have probably missed my previous comment

I'd be interested if we can start returning structs out of functions. This should be possible with the ABIEncoder2 experimental feature.

Essentially I'm asking if we simply return the entire Skill struct here?

Copy link
Contributor Author

@KevinLiLu KevinLiLu Jul 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elenadimitrova Looks doable. Only thing is we would need to extract the Skill struct definition from ColonyNetworkStorage and place it in a library so iColonyNetwork.sol can access the Skill type for function return declaration. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might warrant a bigger refactoring piece with some upgrades testing. Might log it separately so we don't have to invent the design here. I like the library idea though. Will be the likely winner as to how we implement this but will need to consider upgrade options, e.g. what happens when a new struct member is added, can EtherRouter handle that without reregistering in the Resolver and upgrading the contract implementation, e.g. the ColonyNetwork in the above case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sounds good to me. Moving this back to ready-for-review as I have addressed the other comment regarding moving the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now logged separately in #283

@@ -295,4 +295,22 @@ contract("ColonyNetwork", accounts => {
assert.equal(skillCount.toNumber(), 1);
});
});

describe("when getting a skill", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these tests to meta-colony.js? That's where all skills related functionality is held atm

@KevinLiLu KevinLiLu force-pushed the feature/249-isGlobalSkill-flag-in-ColonyNetwork-getSkill branch from 25e7d95 to fbfd8b9 Compare July 17, 2018 01:20
@elenadimitrova
Copy link
Contributor

I think you missed my comment above #279 (review) ?

@elenadimitrova
Copy link
Contributor

I will push the above change to your branch (hope you don't mind)

@elenadimitrova elenadimitrova force-pushed the feature/249-isGlobalSkill-flag-in-ColonyNetwork-getSkill branch from 15036fb to 39b697e Compare July 17, 2018 14:20
@elenadimitrova elenadimitrova force-pushed the feature/249-isGlobalSkill-flag-in-ColonyNetwork-getSkill branch from 39b697e to fdfc184 Compare July 17, 2018 15:08
@KevinLiLu
Copy link
Contributor Author

@elenadimitrova Oops, good catch!

@elenadimitrova elenadimitrova merged commit c3e6ead into JoinColony:develop Jul 17, 2018
@elenadimitrova elenadimitrova removed the request for review from chmanie July 17, 2018 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants