Skip to content

Commit

Permalink
Fix stack too deep by reverting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cabrador committed Jan 30, 2025
1 parent 15c67ac commit 50137a3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions contracts/pfactory/PlainTextProposalFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,32 @@ contract PlainTextProposalFactory is ScopedVerifier {
/// @param __start The start time
/// @param __minEnd The minimum end time
/// @param __maxEnd The maximum end time
function create(string calldata __name, string calldata __description, bytes32[] calldata __options,
uint256 __minVotes, uint256 __minAgreement, uint256 __start, uint256 __minEnd, uint256 __maxEnd) payable external {
function create(
string calldata __name,
string calldata __description,
bytes32[] calldata __options,
uint256 __minVotes,
uint256 __minAgreement,
uint256 __start,
uint256 __minEnd,
uint256 __maxEnd
) payable external {
// use memory to avoid stack overflow
uint256[] memory params = new uint256[](5);
params[0] = __minVotes;
params[1] = __minAgreement;
params[2] = __start;
params[3] = __minEnd;
params[4] = __maxEnd;
_create(__name, __description, __options, params);
}

/// @dev internal function to create a new PlainTextProposal
/// @param __name The name of the proposal
/// @param __description The description of the proposal
/// @param __options The options of the proposal
/// @param params The parameters of the proposal
function _create(string memory __name, string memory __description, bytes32[] memory __options, uint256[] memory params) internal {
PlainTextProposal proposal = new PlainTextProposal(__name, __description, __options,
params[0], params[1], params[2], params[3], params[4], address(0));
proposal.transferOwnership(msg.sender);
Expand Down

0 comments on commit 50137a3

Please sign in to comment.