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

Audit fixes brian #76

Merged
merged 11 commits into from
Oct 4, 2022
Merged

Audit fixes brian #76

merged 11 commits into from
Oct 4, 2022

Conversation

brossetti1
Copy link

wip fixing quantstamp issues

@brossetti1 brossetti1 force-pushed the audit-fixes-brian branch 2 times, most recently from a0939bb to 740ca4a Compare September 28, 2022 22:23
@@ -0,0 +1,6 @@
{
"solidity.defaultCompiler": "localNodeModule",
Copy link
Author

Choose a reason for hiding this comment

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

oops should proably update this?

@dekanbro
Copy link

dekanbro commented Sep 29, 2022

updated docs for some of these issues
QSP-5 Ownership Can Be Renounced
QSP-6 Shamans Can Be an EOA Address
QSP-10 Risk of Killing Upgrades
QSP-12 A DAO's Safety Is Dependent on the Safety of Its Shamans
QSP-13 Upgradability
QSP-14 msg.sender Can Be Overridden.
QSP-15 External Calls to Malicious Contracts

HausDAO/baal-docs@5151a94

contract Baal is Module, EIP712, ReentrancyGuard, BaseRelayRecipient {
using ECDSA for bytes32;
contract Baal is Module, EIP712Upgradeable, ReentrancyGuardUpgradeable, BaseRelayRecipient {
using ECDSAUpgradeable for bytes32;
Copy link
Author

Choose a reason for hiding this comment

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

so this is actually an upgrade on the ECDSA logic - there was some signature validations that openzeppelin removed from the ECDSA checks

OpenZeppelin/openzeppelin-contracts@d693d89

Screen Shot 2022-10-03 at 10 09 24 AM

@@ -268,7 +277,7 @@ contract Baal is Module, EIP712, ReentrancyGuard, BaseRelayRecipient {
_initializationMultisendData,
Enum.Operation.DelegateCall
),
"call failure"
"call failure setup"
Copy link
Author

Choose a reason for hiding this comment

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

adding one more word to better distinguish errors -- there were two call failure errors in this file from different functions.

Comment on lines +330 to +351
proposalCount++; /*increment proposal counter*/
proposals[proposalCount] = Proposal( /*push params into proposal struct - start voting period timer if member submission*/
proposalCount,
selfSponsor ? latestSponsoredProposalId : 0, /* prevProposalId */
selfSponsor ? uint32(block.timestamp) : 0, /* votingStarts */
selfSponsor ? uint32(block.timestamp) + votingPeriod : 0, /* votingEnds */
selfSponsor
? uint32(block.timestamp) + votingPeriod + gracePeriod
: 0, /* graceEnds */
expiration,
baalGas,
0, /* yes votes */
0, /* no votes */
0, /* highestMaxSharesAndLootAtYesVote */
[false, false, false, false], /* [cancelled, processed, passed, actionFailed] */
selfSponsor ? _msgSender() : address(0),
proposalDataHash,
details
);
Copy link
Author

Choose a reason for hiding this comment

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

qsp for removing the unchecked call as the QuantStamp team pointed out that there are some holes with unchecked overflow here so its safer to have it checked

@@ -573,7 +585,7 @@ contract Baal is Module, EIP712, ReentrancyGuard, BaseRelayRecipient {
bytes calldata _data
) external baalOnly {
(bool success, ) = _to.call{value: _value}(_data);
require(success, "call failure");
require(success, "call failure execute");
Copy link
Author

Choose a reason for hiding this comment

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

other error update

} else if(!pauseLoot && lootToken.paused()){
lootToken.unpause();
emit LootPaused(false);
Copy link
Author

Choose a reason for hiding this comment

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

only emitting events if status changed on paused

@brossetti1 brossetti1 marked this pull request as ready for review October 3, 2022 17:12
Comment on lines +2569 to +2581
await baal.submitVoteWithSig(summoner.address, expiry, 0, 1, true, v, r, s);

const signatureTwo = await signVote(
chainId,
baal.address,
summoner,
deploymentConfig.TOKEN_NAME,
expiry,
1,
1,
true
);
const sigTwo = await ethers.utils.splitSignature(signatureTwo);
Copy link
Author

Choose a reason for hiding this comment

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

interesting how this test included a check on nonces inherently as it was using the same signature for both submitVoteWithSig - after adding a second signature with the nonce bumped, the test resolved from the error that triggered from adding the nonce. ie notice how nonce had to go from 0 to 1

Comment on lines +97 to +125
## Coverage

currently, coverage is turned off for test efficiency purposes. In order to switch coverage on, add `yul` to the hardhat config:

```
{
...
compilers: [
{
version: "0.8.7",
settings: {
optimizer: {
enabled: true,
runs: 200,
details: {
yul: true
}
},
},
}
]
}
```

then run the coverage command:

```
npx hardhat coverage
```
Copy link
Author

Choose a reason for hiding this comment

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

coverage docs - should be turned on manually and turned off for faster test runs

@brossetti1 brossetti1 merged commit 26470d2 into feat/baalZodiac Oct 4, 2022
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