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

Moloch rage quit #32

Open
wants to merge 28 commits into
base: moloch-rage-quit
Choose a base branch
from

Conversation

KcPele
Copy link
Contributor

@KcPele KcPele commented May 30, 2024

Description

Concise description of proposed changes, We recommend using screenshots and videos for better description

Additional Information

Related Issues

Closes #{issue number}

Note: If your changes are small and straightforward, you may skip the creation of an issue beforehand and remove this section. However, for medium-to-large changes, it is recommended to have an open issue for discussion and approval prior to submitting a pull request.

Your ENS/address:

Copy link
Collaborator

@escottalexander escottalexander left a comment

Choose a reason for hiding this comment

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

Gave it an initial check over. I outlined a few things that need to change but you are headed in the right direction overall.

packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MaliciousContract.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@escottalexander escottalexander left a comment

Choose a reason for hiding this comment

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

I have some bigger thoughts for you that will require larger changes.

packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
@KcPele
Copy link
Contributor Author

KcPele commented Jun 4, 2024 via email

@KcPele KcPele marked this pull request as ready for review July 9, 2024 15:50
@KcPele
Copy link
Contributor Author

KcPele commented Jul 9, 2024

@escottalexander, I want to get your feedback before I completely write out the test

Copy link
Collaborator

@escottalexander escottalexander left a comment

Choose a reason for hiding this comment

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

Nice job on this. This is exactly what I had in mind. I made a few comments to further refine.

packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
@KcPele
Copy link
Contributor Author

KcPele commented Jul 11, 2024

@escottalexander i have effected the changes

Copy link
Collaborator

@escottalexander escottalexander left a comment

Choose a reason for hiding this comment

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

Left a few small comments. Getting really close with this one.

packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Outdated Show resolved Hide resolved
@escottalexander
Copy link
Collaborator

@KcPele Can you resolve the merge conflicts please?

Copy link
Collaborator

@escottalexander escottalexander left a comment

Choose a reason for hiding this comment

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

Gave this a deeper look and found some issues that need to be sorted through.

packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved

if (proposal.votes >= quorum) {
proposal.approved = true;
emit ProposalApproved(proposalId, msg.sender);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think it makes sense for a proposal to be approved before the voting period is over. More nay votes might counteract the current approval. The approval/denial should be decided in the executeProposal function. That is the only place where it being approved/denied matters.

* - if the proposal is approved and the deadline has passed: execute the calldata with the value. Reverts with MolochRageQuit__FailedToExecute if the execution fails.
* - Emit a `ProposalExecuted` event if the proposal is executed.
*/
function executeProposal(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function is overly complicated. It might help the user to instead have a executeApprovedProposal function and a refundDeniedProposal function. Each function could check if Yea > Nay or the opposite before executing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is nothing to keep me from executing a proposal multiple times. Yikes! Make sure you set the new property before calling external contracts because this is a reentrancy risk. Would be great to add tests around this too.

emit Voted(proposalId, msg.sender);

if (proposal.votes >= quorum) {
proposal.approved = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove approved on the proposal and instead track yea votes and nay votes. Approval depends on the proposal deadline being reached, total votes > quorum, and proposal.yeaVotes > proposal.nayVotes

packages/foundry/contracts/MolochRageQuit.sol Show resolved Hide resolved
{
Proposal storage proposal = proposals[proposalId];

if (members[newMember]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check is the only thing keeping someone from executing the proposal multiple times. But what if I get in at a low share price and Rage Quit at a high share price? Then I can become a member again at my low share price by reexecuting my old proposal! I could do this over and over until the contract was drained.

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