-
Notifications
You must be signed in to change notification settings - Fork 4
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
The delegate of a contributor may be inconsist between crowdfund phase and party phase, causing unexpected delegate voting. #311
Comments
QA: NC |
ydspa marked the issue as insufficient quality report |
Seems to be valid @0xble |
gzeon-c4 marked the issue as satisfactory |
gzeon-c4 marked the issue as selected for report |
I view this as a dupe of #433 although it is slightly different. |
arr00 (sponsor) confirmed |
We plan on changing documentation to make it clear that the delegates are only for initial mints. We won't be changing the mint function as of now due to cascading issues with that. |
gzeon-c4 marked the issue as primary issue |
gzeon-c4 marked the issue as duplicate of #418 |
gzeon-c4 marked the issue as not selected for report |
Lines of code
https://github.com/code-423n4/2023-10-party/blob/main/contracts/crowdfund/ETHCrowdfundBase.sol#L201-L208
https://github.com/code-423n4/2023-10-party/blob/main/contracts/crowdfund/InitialETHCrowdfund.sol#L295-L310
https://github.com/code-423n4/2023-10-party/blob/main/contracts/party/PartyGovernanceNFT.sol#L194-L198
Vulnerability details
Impact
A contributor can change his existing delegate during crowdfund phase, expecting that the change will be propagated to the party phase automaticlly. But it's not true. One must issue another call to change his existing delegate during party phase. Before doing that, his delegate remains the old one, and his voting power may be used by the old delegate to vote for some proposals, which is not what he expects.
Proof of Concept
Let's assume Alice is a contributor and she delegates her voting power to Bob initially. After some time, before party phase, Alice wants to change her delegate to Charlie, so she makes another contribution with Charlie as the new delegate. What happens next is:
Alice's contribution is converted to voting power and delegate is updated to Charlie in
_processContribution
.https://github.com/code-423n4/2023-10-party/blob/main/contracts/crowdfund/ETHCrowdfundBase.sol#L201-L208
Then Alice's voting power and her new delegate Charlie are expected to be propagated to party contract.
_contribute
returns and new delegate is NOT propagated to party contract (InitialETHCrowdfund.sol#L298).increaseVotingPower
, but new delegate is NOT propagated to party contract (InitialETHCrowdfund.sol#L307)._mint
, and new delegate is propagated to party contract (InitialETHCrowdfund.sol#L302). But party contract override the new delegate with existing delegate (PartyGovernanceNFT.sol#L194-L198).https://github.com/code-423n4/2023-10-party/blob/main/contracts/crowdfund/InitialETHCrowdfund.sol#L295-L310
https://github.com/code-423n4/2023-10-party/blob/main/contracts/party/PartyGovernanceNFT.sol#L194-L198
When party phase starts (crowdfund finalized), Alice thinks her delegate is Charlie, but actually it's Bob. Alice still can change her delegate to Charlie by
delegateVotingPower
(L448-L453). But before Alice change her delegate, Bob holds her voting power and Bob can use that power to vote for existing proposals.https://github.com/code-423n4/2023-10-party/blob/main/contracts/party/PartyGovernance.sol#L448-L453
Tools Used
Manual audit
Recommended Mitigation Steps
mint
to prevent the new delegate from been ignored. Sincedelegate
is checked already in_processContribution
, it can be used inmint
directly.mint
. To be precise, usedelegationsByContributor[contributor]
instead ofdelegate
to avoid invaliddelegate
.delegateVotingPowerWithAuthorities
, similar todelegateVotingPower
, and limit it to only authorities. If one updates delegate with 0 contribution, call the newly addeddelegateVotingPowerWithAuthorities
before return.Assessed type
Governance
The text was updated successfully, but these errors were encountered: