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

Projects v2 contracts #1002

Closed
wants to merge 25 commits into from
Closed

Projects v2 contracts #1002

wants to merge 25 commits into from

Conversation

topocount
Copy link
Collaborator

@topocount topocount commented Jun 19, 2019

Remaining Support Actions

The initial contract work is done, but supporting files still need some work and the contract likely needs some polish in order to conform to conventions we've set forth in Rewards and Address Book contracts:

  • Get converage working again Testing spans two repo's due to solidity pragma incompatibilities. we need to get Truffle executing in both repos within the context of coverage
  • Obtain 100% Coverage Right now a few cases where require functions fail are missing coverage
  • Update contracts and tests to conform to conventions set forth in Address Book and Rewards

@topocount topocount marked this pull request as ready for review July 8, 2019 14:24
@topocount topocount assigned topocount and ottodevs and unassigned topocount Jul 8, 2019
Copy link
Member

@ottodevs ottodevs left a comment

Choose a reason for hiding this comment

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

Just some questions to value if any of these should be needed to address into the audit cleanup

@@ -8,6 +8,7 @@ import "@tps/test-helpers/contracts/factory/EVMScriptRegistryFactory.sol";
import "@tps/test-helpers/contracts/lib/misc/Migrations.sol";
import "@aragon/apps-shared-minime/contracts/MiniMeToken.sol";
import "@tps/test-helpers/contracts/lib/bounties/StandardBounties.sol";
import "@tps/test-helpers/contracts/lib/bounties/BountiesEvents.sol";
Copy link
Member

Choose a reason for hiding this comment

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

I think we should not actually need to import this if we don't intend to use BountiesEvents in AddressBook tests, do you have an special reason for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. I've reorganized Spoof.sol and TestImports.sol imports to better reflect their purposes in the address book app

@@ -5,6 +5,7 @@ import "@tps/test-helpers/contracts/factory/DAOFactory.sol";
import "@tps/test-helpers/contracts/acl/ACL.sol";
import "@aragon/apps-shared-minime/contracts/MiniMeToken.sol";
import "@tps/test-helpers/contracts/lib/bounties/StandardBounties.sol";
import "@tps/test-helpers/contracts/lib/bounties/BountiesEvents.sol";
Copy link
Member

Choose a reason for hiding this comment

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

I think we should not actually need to import this if we don't intend to use BountiesEvents in Allocations tests, do you have an special reason for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need to import it here or Truffle throws this error (as outlined by Jorge's comments in Spoof.sol): Error: Could not find artifacts for ./lib/bounties/BountiesEvents from any sources

@@ -1,6 +1,7 @@
pragma solidity ^0.4.24;

import "@tps/test-helpers/contracts/lib/bounties/StandardBounties.sol";
import "@tps/test-helpers/contracts/lib/bounties/BountiesEvents.sol";
Copy link
Member

Choose a reason for hiding this comment

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

same here

apps/projects/contracts/Projects.sol Outdated Show resolved Hide resolved
apps/projects/contracts/Projects.sol Show resolved Hide resolved
@@ -293,7 +344,7 @@ contract Projects is IsContract, AragonApp {
///////////////////////
/**
* @notice Add repository to the Projects app
* @param _repoId Github id of the repo to add
* @param _repoId id of the repo to be aadded
Copy link
Member

Choose a reason for hiding this comment

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

Really small miss click typo 😇

@@ -370,7 +426,8 @@ contract Projects is IsContract, AragonApp {
bool _approved
) external auth(REVIEW_APPLICATION_ROLE)
{
GithubIssue storage issue = repos[_repoId].issues[_issueNumber];
Issue storage issue = repos[_repoId].issues[_issueNumber];
require(issue.assignee != 0xffffffffffffffffffffffffffffffffffffffff, "ISSUE_OPEN");
Copy link
Member

Choose a reason for hiding this comment

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

Very opinionated comment, but the address seems ugly to me, maybe address(-1) could work?

emit SubmissionAccepted(_submissionNumber, _repoId, _issueNumber);
} else {
submission.status = SubmissionStatus.Rejected;
bounties.performAction(
Copy link
Member

Choose a reason for hiding this comment

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

I will probably try to clean this duped block, it seems that it could be outside of the condition, I will check carefully anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved the bounties.performAction call outside of the if/else construct and just put it at the end

@@ -136,7 +168,7 @@ contract('Projects App', accounts => {
)

// Deploy test Bounties contract
bounties = await StandardBounties.new(web3.toBigNumber(owner1))
bounties = { address: '0x72D1Ae1D6C8f3dd444b3D95bAd554Be483082e40'.toLowerCase() }
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, what is the motivation of toLowerCase here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the test for changing bounty settings fails:

1) Contract: Projects App
       post-initialization
         settings management
           can change Bounty Settings:

      StandardBounties Contract address incorrect
      + expected - actual

      -0x72d1ae1d6c8f3dd444b3d95bad554be483082e40
      +0x72D1Ae1D6C8f3dd444b3D95bAd554Be483082e40

Copy link
Member

Choose a reason for hiding this comment

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

Ok I think I understand, to prevent different hashes for the same address with different casing, yeah, thinking about it I agree is a good decision, it seems less cumbersome than dealing with checksummed addresses 👍

@@ -7,5 +7,6 @@ module.exports = {
Kernel: artifacts.require('./kernel/Kernel'),
MiniMeToken: artifacts.require('./lib/minime/MiniMeToken'),
StandardBounties: artifacts.require('./lib/bounties/StandardBounties'),
BountiesEvents: artifacts.require('./lib/bounties/BountiesEvents'),
Copy link
Member

Choose a reason for hiding this comment

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

Here is the small change that enforces to import BountiesEvents on each Spoof.sol for every app 🎉

I am sorry you experienced errors locally, it seems this one is so confusing

I blame myself because I created this "artifact-requirer" helper, but it seems is not useful anymore, my recommendation would be to move StandardBounties related code to a projects subfolder or to the integrations one, as I think it is convenient for us to get rid of test-helpers folder, I tried to follow this approach with Rewards when moving the mining functions there

Is not a big deal, but seems it is related to #588 and it actually clears lot of intermediate dead code, I think the change worths be done

I already did the changes so I will commit those, if you don't mind @topocount I just tried to clarify about the previous related comments so we can save some time in the future with these pesky things

@topocount topocount force-pushed the projectsV2-contracts branch 2 times, most recently from faa15c8 to e44aba7 Compare July 12, 2019 23:47
- convert repoIndex to a mapping
- add requires to token approval calls
- add isInitialized to all functions without auth
- convert all functions with small enough parameter sizes to "external" from "public"
- reorder functions to be match visibility order style
- add "_description" to updateBounty to make it more forwarder-friendly
@topocount topocount closed this Jul 19, 2019
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.

None yet

3 participants