@@ -194,6 +194,69 @@ contract SetProposalType is ProposalTypesConfiguratorTest {
194
194
}
195
195
}
196
196
197
+ contract UpdateScopeForProposalType is ProposalTypesConfiguratorTest {
198
+ function testFuzz_UpdateScopeForProposalType (uint256 _actorSeed ) public {
199
+ vm.prank (_adminOrTimelock (_actorSeed));
200
+ vm.expectEmit ();
201
+ bytes32 [] memory transactions = new bytes32 [](1 );
202
+ emit ProposalTypeSet (0 , 4_000 , 6_000 , "New Default " , transactions);
203
+ proposalTypesConfigurator.setProposalType (0 , 4_000 , 6_000 , "New Default " , address (0 ), transactions);
204
+
205
+ vm.startPrank (admin);
206
+ bytes32 txTypeHash1 = keccak256 ("transfer(address,address,uint) " );
207
+ bytes memory txEncoded1 = abi.encode ("transfer(address,address,uint) " , 0xdeadbeef , 0xdeadbeef , 10 );
208
+
209
+ bytes32 txTypeHash2 = keccak256 ("initialize(address,address) " );
210
+ bytes memory txEncoded2 = abi.encode ("initialize(address,address) " , 0xdeadbeef , 0xdeadbeef );
211
+ bytes [] memory parameters = new bytes [](1 );
212
+ IProposalTypesConfigurator.Comparators[] memory comparators = new IProposalTypesConfigurator.Comparators [](1 );
213
+
214
+ proposalTypesConfigurator.setScopeForProposalType (0 , txTypeHash1, txEncoded1, parameters, comparators);
215
+
216
+ IProposalTypesConfigurator.Scope memory scope = IProposalTypesConfigurator.Scope (txTypeHash2, txEncoded2, new bytes [](1 ), new IProposalTypesConfigurator.Comparators [](1 ));
217
+ proposalTypesConfigurator.updateScopeForProposalType (0 , scope);
218
+ vm.stopPrank ();
219
+
220
+ bytes memory limit1 = proposalTypesConfigurator.getLimit (0 , txTypeHash1);
221
+ bytes memory limit2 = proposalTypesConfigurator.getLimit (0 , txTypeHash2);
222
+ assertEq (limit1, txEncoded1);
223
+ assertEq (limit2, txEncoded2);
224
+ }
225
+
226
+ function testRevert_updateScopeForProposalType_InvalidProposalType () public {
227
+ vm.startPrank (admin);
228
+ bytes32 txTypeHash = keccak256 ("transfer(address,address,uint) " );
229
+ bytes memory txEncoded = abi.encode ("transfer(address,address,uint) " , 0xdeadbeef , 0xdeadbeef , 10 );
230
+
231
+ vm.expectRevert (IProposalTypesConfigurator.InvalidProposalType.selector );
232
+ IProposalTypesConfigurator.Scope memory scope = IProposalTypesConfigurator.Scope (txTypeHash, txEncoded, new bytes [](1 ), new IProposalTypesConfigurator.Comparators [](1 ));
233
+ proposalTypesConfigurator.updateScopeForProposalType (3 , scope);
234
+ vm.stopPrank ();
235
+ }
236
+
237
+ function testRevert_updateScopeForProposalType_NoDuplicateTxTypes () public {
238
+ vm.startPrank (admin);
239
+ bytes32 txTypeHash = keccak256 ("transfer(address,address,uint) " );
240
+ bytes memory txEncoded = abi.encode ("transfer(address,address,uint) " , 0xdeadbeef , 0xdeadbeef , 10 );
241
+
242
+ proposalTypesConfigurator.setScopeForProposalType (
243
+ 0 , txTypeHash, txEncoded, new bytes [](1 ), new IProposalTypesConfigurator.Comparators [](1 )
244
+ );
245
+
246
+ vm.expectRevert (IProposalTypesConfigurator.NoDuplicateTxTypes.selector );
247
+ IProposalTypesConfigurator.Scope memory scope = IProposalTypesConfigurator.Scope (txTypeHash, txEncoded, new bytes [](1 ), new IProposalTypesConfigurator.Comparators [](1 ));
248
+ proposalTypesConfigurator.updateScopeForProposalType (0 , scope);
249
+ vm.stopPrank ();
250
+ }
251
+ }
252
+
253
+ contract getLimit is ProposalTypesConfiguratorTest {
254
+ function testRevert_getLimit_InvalidProposalType () public {
255
+ vm.expectRevert (IProposalTypesConfigurator.InvalidProposalType.selector );
256
+ proposalTypesConfigurator.getLimit (3 , keccak256 ("foobar(address,address) " ));
257
+ }
258
+ }
259
+
197
260
contract GovernorMock {
198
261
address immutable adminAddress;
199
262
address immutable timelockAddress;
0 commit comments