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

QA Report #149

Open
code423n4 opened this issue Aug 6, 2022 · 0 comments
Open

QA Report #149

code423n4 opened this issue Aug 6, 2022 · 0 comments
Labels
bug Something isn't working old-submission-method QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax valid

Comments

@code423n4
Copy link
Contributor

  1. In the contest docs, it is specifically mentioned that: “Note that you cannot submit a project with no total budget. Therefore it requires at least one task with a budget > 0.”

However, it is indeed possible to submit a project with a total budget of 0. Observe the following passing test cases:

projectTests.ts

it('is able to add task with 0 budget', async () => {
    const hashArray = ['0x'];
    const costArray = [0]; // 0 total cost
    taskList.push(0);
    const data = {
      types: ['bytes[]', 'uint256[]', 'uint256', 'address'],
      values: [
        hashArray,
        costArray,
        await project.taskCount(),
        project.address,
      ],
    };
    const [encodedData, signature] = await multisig(data, [signers[0]]);

    const tx = await project.addTasks(encodedData, signature);
    await expect(tx)
      .to.emit(project, 'TasksAdded')
      .withArgs(costArray, hashArray);

    expect(await project.taskCount()).to.equal(1);
    const { cost, subcontractor, state } = await project.getTask(1);
    expect(cost).to.equal(costArray[0]);
    expect(subcontractor).to.equal(ethers.constants.AddressZero);
    expect(state).to.equal(1);
  });

communityTests.ts (edit createTasks in projectHelpers.ts so costArray is [0,0,0])

it('should publish project with 0 budget', async () => {
      apr = 10;
      const communityId = 1;

      expect(await project.projectCost()).to.eq(0); //indeed 0 budget

      const data = {
        types: ['uint256', 'address', 'uint256', 'uint256', 'uint256', 'bytes'],
        values: [
          communityId,
          projectAddress,
          apr,
          publishFeeAmount,
          (await communityContract.communities(communityId)).publishNonce,
          sampleHash,
        ],
      };

      const [encodedData, signature] = await multisig(data, [
        community1Owner,
        signers[0],
      ]);

      const tx = await communityContract.publishProject(encodedData, signature);

      await expect(tx)
        .to.emit(communityContract, 'ProjectPublished')
        .withArgs(
          communityId,
          projectAddress,
          apr,

          publishFeeAmount,
          publishFeeAmount.gt(0) ? false : true,
          sampleHash,
        );

      const [
        projectApr,
        projectLendingNeeded,
        projectTotalLent,
        publishFee,
        publishFeePaid,
      ] = await communityContract.projectDetails(communityId, projectAddress);

      expect(projectApr).to.be.equal(apr);
      expect(projectLendingNeeded).to.be.equal(0);
      expect(projectTotalLent).to.be.equal(0);
      expect(publishFee).to.be.equal(publishFeeAmount);
      expect(publishFeePaid).to.be.equal(false);

      const { publishNonce } = await communityContract.communities(communityId);
      expect(publishNonce).to.equal(1);
    });
  1. It is possible for a builder to maliciously siphon funds for a task using changeOrder to lower the cost of a task after it has been allocated without any sort of consent from the community (only contractors).

Perhaps include the relevant community/community owner as a signer for such a change.

  1. Community.sol::849, The comment indicates that wrapped tokens are burned when they are in fact minted.

  2. Myriad internal/private functions lack a prepended _:

Community.sol

  • checkSignatureValidity
  • claimInterest

Disputes.sol

  • resolveHandler
  • executeTaskAdd
  • executeTaskChange
  • executeTaskPay

HomeFi.sol

  • mintNFT

Project.sol

  • autoWithdraw
  • checkSignature
  • checkSignatureTask
  • checkSignatureValidity
  • checkPrecision
  1. HomeFi.sol::200, there is no corresponding event emitted when updating the trustedForwarder in the setTrustedForwarder function.

  2. Tasks.sol::146,158, These comments do not match what the corresponding functions do. These comments are copies of line 136 “Task the task being set as funded” on function fundTask.

@code423n4 code423n4 added bug Something isn't working old-submission-method QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Aug 6, 2022
code423n4 added a commit that referenced this issue Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working old-submission-method QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax valid
Projects
None yet
Development

No branches or pull requests

2 participants