Skip to content

Commit 4d94daf

Browse files
committed
test: improve submitFundingProposal assertions
1 parent 75657d5 commit 4d94daf

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/contracts-bedrock/src/governance/ProposalValidator.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ contract ProposalValidator is OwnableUpgradeable, ReinitializableBase, ISemver {
193193
mapping(ProposalType => ProposalTypeData) public proposalTypesData;
194194

195195
/// @notice Mapping of proposal hash to their corresponding proposal data.
196-
mapping(bytes32 => ProposalData) private _proposals;
196+
mapping(bytes32 => ProposalData) internal _proposals;
197197

198198
/// @notice Semantic version.
199199
/// @custom:semver 1.0.0-beta.1

packages/contracts-bedrock/test/governance/ProposalValidator.t.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ contract ProposalValidatorForTest is ProposalValidator {
4747
{
4848
return _hashProposalWithModule(_module, _proposalData, _descriptionHash);
4949
}
50+
51+
function getProposalData(bytes32 _proposalHash)
52+
public
53+
view
54+
returns (
55+
address proposer,
56+
ProposalType proposalType,
57+
bool inVoting,
58+
uint256 approvalCount
59+
)
60+
{
61+
ProposalData storage proposal = _proposals[_proposalHash];
62+
return (proposal.proposer, proposal.proposalType, proposal.inVoting, proposal.approvalCount);
63+
}
5064
}
5165

5266
/// @title ProposalValidator_Init
@@ -801,6 +815,15 @@ contract ProposalValidator_SubmitFundingProposal_Test is ProposalValidator_Init
801815
);
802816

803817
assertEq(proposalHash, expectedHash);
818+
819+
// Verify proposal data was stored correctly
820+
(address proposer, ProposalValidator.ProposalType storedProposalType, bool inVoting, uint256 approvalCount) =
821+
validator.getProposalData(proposalHash);
822+
823+
assertEq(proposer, rando, "Proposer should be rando");
824+
assertEq(uint8(storedProposalType), uint8(proposalType), "Proposal type should match input");
825+
assertFalse(inVoting, "Proposal should not be in voting yet");
826+
assertEq(approvalCount, 0, "Approval count should be 0");
804827
}
805828

806829
}

0 commit comments

Comments
 (0)