Platform: Code4rena
Start Date: 31/10/2023
Pot Size: $60,500 USDC
Total HM: 9
Participants: 65
Period: 10 days
Judge: gzeon
Total Solo HM: 2
Id: 301
League: ETH
Rank: 45/65
Findings: 1
Award: $60.01
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: catellatech
Also found by: 0xSmartContract, 0xbrett8571, Bauchibred, K42, Myd, SAAJ, ZanyBonzy, clara, foxb868, hunter_w3b, kaveyjoe, pavankv
60.0107 USDC - $60.01
Party Protocol is an open protocol for on-chain group coordination. It provides on-chain functionality for group formation, coordination, and distribution, with the goal of making Ethereum multiplayer
.
Party Protocol is built on three core pillars:
decentralized voting
system.1 . InitialETHCrowdfund.sol
InitialETHCrowdfund
contract is a crowdfund contract for raising initial funds for new parties. It includes features such as contribution, batch contribution, refund, and batch refund. It also interacts with several external contracts such as ETHCrowdfundBase
, ProposalStorage
, Party
, Crowdfund
, and IGateKeeper
.
2 . crowdfund/ETHCrowdfundBase.sol
ETHCrowdfundBase
contract is a comprehensive smart contract designed for managing Ethereum-based
crowdfunding campaigns. It includes features such as setting minimum and maximum contribution limits, defining a lifecycle for the crowdfunding campaign, splitting funds between the campaign and a separate recipient, and an emergency execution function for the contract owner.
3 . PartyGovernance.sol
The PartyGovernance.sol
contract implements the governance functionality for Party Protocol. It allows party members to create and vote on proposals, as well as execute approved proposals. It uses a ProposalExecutionEngine
to execute arbitrary calls on behalf of the party, and supports a variety of proposal types, including arbitrary calls proposals, fractionalize proposals, list on Opensea
proposals, and list on Zora proposals
. Party members can vote on proposals using Party Governance NFTs
, which they receive by contributing to the party during the crowdfunding phase.
4 . PartyGovernanceNFT.sol
PartyGovernanceNFT
is an ERC721 token contract that is built on top of PartyGovernance
. The contract uses OpenZeppelin's IERC2981
interface for royalty management. It also uses several utility libraries such as LibSafeCast
, LibAddress
, and LibERC20Compat
. The contract has a governance mechanism where certain addresses are given authority to perform specific actions such as minting tokens, updating voting power, and setting the rage quit timestamp.
5 . ProposalExecutionEngine.sol
ProposalExecutionEngine
contract is an upgradable implementation of proposal execution logic for parties that use it. It is designed to be used with a proxy contract that delegate calls to it. The contract supports various types of proposals such as ListOnOpenseaProposal
, ListOnZoraProposal
, FractionalizeProposal
, ArbitraryCallsProposal
, etc. The contract provides several key functions for initializing, executing, and cancelling proposals, as well as checking the validity of signatures.
6 . ProposalStorage.sol
ProposalStorage
contract is an abstract contract that provides a storage structure for proposals in a decentralized governance system. It uses a pattern of explicit storage buckets, which is a way to manage and isolate contract storage in a more explicit and controlled manner. The contract defines several structures and functions to manage the governance parameters and proposal engine options.
7 . SetGovernanceParameterProposal.sol
SetGovernanceParameterProposa
l is a part of a decentralized governance system. It allows for the modification of certain governance parameters, specifically voteDuration
, executionDelay
, and passThresholdBps
. The contract includes checks to ensure that the new values for these parameters are within acceptable ranges, and it emits events when these values are changed.
8 . SetSignatureValidatorProposal.sol
SetSignatureValidatorProposal
contract is designed to manage and validate ERC1271
signatures. ERC1271
is a standard for verifying signatures on-chain, which is useful for smart contracts that need to verify off-chain signatures. The contract allows for setting a signature validator for a given hash and retrieving the validator for a given hash.
9 . OffChainSignatureValidator.sol
OffChainSignatureValidator
implements the IERC1271
interface. The contract is designed to validate off-chain signatures for parties. It includes functionality to set a signing threshold for each party and to validate signatures based on the signer's voting power within the party. The contract uses OpenZeppelin's
Strings library and a custom Party contract.
10 . Implementation.sol
Implementation
contract is designed to be delegatecalled
into by other contracts. It includes a constructor that sets the implementation address to the contract's own address, and two modifiers: onlyDelegateCall
and onlyInitialize
. The onlyDelegateCall
modifier ensures that the function it is attached to can only be called in a delegatecall
context, while the onlyInitialize
modifier ensures that the function it is attached to can only be called once. The contract also includes a function IMPL()
that returns the implementation address.
gateKeeper
. If an adversary gains control over the deployer's private key or compromises the deployment process, they could influence the gatekeeper or other critical parameters.OnlyPartyHostError
modifier allows only the party host to finalize the crowdfund early. This centralizes authority in the hands of the host, which could be a risk if the host acts maliciously or becomes compromised.emergencyExecute
function allows the DAO to execute arbitrary functions, potentially including critical operations. If the DAO address is compromised, it poses a significant risk to the crowdfund._delegateToRenderer
function calls an external contract to delegate certain functionality. If this external contract becomes unavailable or compromised, it can result in a single point of failure for the entire system. _assertAuthority
modifier and related functions enforce a specific ownership and control structure. If this ownership structure is not decentralized or if the authorities are compromised, it can lead to governance issues.isValidSignature
function has logic for signature validation. If the choice of the signature validator is centrally controlled, it can lead to centralization of signature verification.(_initProposalImpl)
that allows changing the implementation of the IProposalExecutionEngine.
If the upgrade process is controlled by a centralized entity, it introduces centralization risks.block.timestamp
for time calculations assumes that miners will timestamp blocks correctly. This could be manipulated by miners to some extent, and reliance on it for critical decisions should be done cautiously.rageQuit
function uses a reentrancy guard (rageQuitTimestamp)
to prevent reentrancy attacks. However, any oversight in the implementation might expose the contract to reentrancy vulnerabilities.mint, increaseVotingPower, decreaseVotingPower
) should be carefully monitored for potential gas limit issues, especially as the number of authorities and minting requests increases. Gas limits might be exceeded during minting, causing transactions to fail.burn, abdicateAuthority, etc.
) need to be robust to prevent unauthorized access. Any lapses in these checks could lead to unauthorized actions, impacting the integrity of the system.Modularity: The codebase is organized into distinct contracts, each handling specific functionalities. This modular approach promotes code readability and maintainability.
Documentation: Each contract is accompanied by clear explanations of its purpose and functionality. This aids developers in understanding the code and its intended use.
Use of Libraries: The project leverages established libraries like OpenZeppelin's IERC2981 and utility libraries such as LibSafeCast
, LibAddress
, and LibERC20Compat
. This promotes code reuse and reduces the likelihood of implementation errors.
Governance Mechanism: The governance system implemented in PartyGovernanceNFT.sol
provides a structured way for party members to participate in decision-making, enhancing the protocol's democratic nature.
OnlyPartyHostError
and emergencyExecute
. This helps prevent concentration of power and reduces the risk of malicious actions._delegateToRenderer
function. Consider fallback mechanisms or alternative solutions to minimize the impact of external contract failures.(_initProposalImpl)
to ensure decentralization in the upgrade process. Involve the community in decision-making to minimize centralization risks.Performing an audit on the Party Protocol codebase has been an invaluable learning experience, providing significant insights into enhancing codebase skills related to decentralized applications (DApps)
and smart contract development. The audit process has contributed to my understanding in several key areas:
Modular Design and Documentation:
Governance Systems and Token Contracts:
DApps
, as evidenced by the PartyGovernance.sol
and PartyGovernanceNFT.sol
contracts. The governance mechanism, involving proposal creation, voting, and execution, adds a layer of transparency and decentralization to decision-making.(PartyGovernanceNFT.sol)
and the utilization of OpenZeppelin's IERC2981
interface for royalty management. This experience broadens my understanding of token-based functionalities within decentralized ecosystems.Centralization and Security Concerns:
Systematic Risks and Best Practices:
Continuous Improvement and Community Involvement:
The Party Protocol demonstrates a thoughtful design for on-chain group coordination, but addressing the identified centralization and systematic risks is crucial for ensuring the protocol's security and resilience. Conducting thorough audits, implementing additional security measures, and fostering decentralization in governance and control structures will contribute to the overall robustness of the Party Protocol.
33 hours
#0 - c4-pre-sort
2023-11-13T10:42:05Z
ydspa marked the issue as sufficient quality report
#1 - c4-judge
2023-11-19T17:41:49Z
gzeon-c4 marked the issue as grade-b