Skip to content

Commit

Permalink
Report for issue #59 updated by RaymondFam
Browse files Browse the repository at this point in the history
  • Loading branch information
code423n4 committed Sep 19, 2022
1 parent fab829e commit 98cff5a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions data/RaymondFam-Q.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ Zero address and zero value checks should be implemented when initializer is del
https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/crowdfund/BuyCrowdfund.sol#L64-L88
https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/party/Party.sol#L33-L45

## Assert Costs More Gas Than Require
The `assert()` function when false, uses up all the remaining gas and reverts all the changes made. On the other hand, a `require()` function when false, also reverts back all the changes made to the contract but does refund all the remaining gas fees we offered to pay.
## Use call instead of transferEth
`call`, which returns a boolean value indicating success or failure, in combination with re-entrancy guard is the recommended method to use after December 2019. And, guard against re-entrancy by making all state changes before calling other contracts using re-entrancy guard modifier. Here's one instance entailed:

https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/proposals/ListOnOpenseaProposal.sol#L221

On a side note, the assert function should only be used to examine invariants and test for internal problems. When used correctly, it can assess your contract and discover the conditions and function calls that will result in a failed assert. A properly running program should never reach a failing assert statement; if this occurs, there is a flaw in your contract that has to be addressed.
https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/crowdfund/Crowdfund.sol#L487

0 comments on commit 98cff5a

Please sign in to comment.