Skip to content

Commit 1003e3f

Browse files
committed
update forge-std submodule reference
fix: coverage issues with block.number and block.timestamp fix: reset forge-std to master ci: skip testFork ci: no-match-test testFork lint: properly space --ir-minimum in yarn coverage fix: properly spell match
1 parent 7ab08ef commit 1003e3f

22 files changed

+157
-156
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ $ forge test
7676
Get a test coverage report:
7777

7878
```sh
79-
$ forge coverage
79+
$ forge coverage --ir-minimum
8080
```
8181

8282
### Deployment

lib/forge-std

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"scripts": {
1717
"clean": "rimraf cache out",
18-
"coverage": "forge coverage --report lcov",
18+
"coverage": "forge coverage --no-match-coverage testFork --ir-minimum --report lcov",
1919
"lint": "yarn lint:sol && yarn prettier:check",
2020
"lint:sol": "solhint \"{src,test,script}/**/*.sol\"",
2121
"prettier:check": "prettier --check \"**/*.{json,md,sol,yml}\"",

test/ActiveProposalsLimiterProposalValidationStrategy.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ contract ActiveProposalsLimterTest is SpaceTest {
6565
// max * 2 so we would revert if `cooldown` is not respected
6666
for (uint256 i = 0; i < maxActive * 2; i++) {
6767
_createProposal(author, proposalMetadataURI, executionStrategy, new bytes(0));
68-
vm.warp(block.timestamp + cooldown);
68+
vm.warp(vm.getBlockTimestamp() + cooldown);
6969
}
7070
}
7171

@@ -110,19 +110,19 @@ contract ActiveProposalsLimterTest is SpaceTest {
110110
}
111111

112112
// Advance until half of cooldown
113-
vm.warp(block.timestamp + cooldown / 2);
113+
vm.warp(vm.getBlockTimestamp() + cooldown / 2);
114114

115115
// Should still fail
116116
vm.expectRevert(FailedToPassProposalValidation.selector);
117117
_createProposal(author, proposalMetadataURI, executionStrategy, new bytes(0));
118118

119119
// Advance until ALMOST full cooldown has elapsed
120-
vm.warp(block.timestamp + cooldown / 2 - 1);
120+
vm.warp(vm.getBlockTimestamp() + cooldown / 2 - 1);
121121
vm.expectRevert(FailedToPassProposalValidation.selector);
122122
_createProposal(author, proposalMetadataURI, executionStrategy, new bytes(0));
123123

124124
// Advance until full cooldown has elapsed
125-
vm.warp(block.timestamp + 1);
125+
vm.warp(vm.getBlockTimestamp() + 1);
126126
// We should be able to create `maxActive` proposals now
127127
for (uint256 i = 0; i < maxActive; i++) {
128128
_createProposal(author, proposalMetadataURI, executionStrategy, new bytes(0));

test/AvatarExecutionStrategy.t.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
4747
new bytes(0)
4848
);
4949
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
50-
vm.roll(block.number + space.maxVotingDuration());
50+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
5151

5252
vm.expectEmit(true, true, true, true);
5353
emit ProposalExecuted(proposalId);
@@ -67,7 +67,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
6767
Strategy(address(avatarExecutionStrategy), abi.encode(transactions)),
6868
new bytes(0)
6969
);
70-
vm.roll(block.number + space.maxVotingDuration());
70+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
7171

7272
vm.expectRevert(abi.encodeWithSelector(InvalidProposalStatus.selector, ProposalStatus.Rejected));
7373
space.execute(proposalId, abi.encode(transactions));
@@ -83,7 +83,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
8383
new bytes(0)
8484
);
8585
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
86-
vm.roll(block.number + space.maxVotingDuration());
86+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
8787

8888
transactions[0] = MetaTransaction(recipient, 2, "", Enum.Operation.Call, 0);
8989

@@ -102,7 +102,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
102102
new bytes(0)
103103
);
104104
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
105-
vm.roll(block.number + space.maxVotingDuration());
105+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
106106

107107
vm.expectRevert(ExecutionFailed.selector);
108108
space.execute(proposalId, abi.encode(transactions));
@@ -126,7 +126,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
126126
new bytes(0)
127127
);
128128
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
129-
vm.roll(block.number + space.maxVotingDuration());
129+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
130130

131131
assertEq(recipient.balance, 0); // sanity check
132132
assertEq(avatar.isModuleEnabled(address(0xbeef)), false); // sanity check
@@ -153,7 +153,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
153153
new bytes(0)
154154
);
155155
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
156-
vm.roll(block.number + space.maxVotingDuration());
156+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
157157

158158
vm.expectRevert(ExecutionFailed.selector);
159159
space.execute(proposalId, abi.encode(transactions));
@@ -246,7 +246,7 @@ abstract contract AvatarExecutionStrategyTest is SpaceTest {
246246
new bytes(0)
247247
);
248248
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
249-
vm.roll(block.number + space.maxVotingDuration());
249+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
250250

251251
vm.expectRevert(InvalidSpace.selector);
252252
space.execute(proposalId, abi.encode(transactions));

test/CompTimelockExecutionStrategy.t.sol

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
5757
uint256 eta = block.timestamp + 1000;
5858
timelock.queueTransaction(address(timelock), 0, "", callData, eta);
5959

60-
vm.warp(block.timestamp + 1000);
60+
vm.warp(vm.getBlockTimestamp() + 1000);
6161

6262
timelock.executeTransaction(address(timelock), 0, "", callData, eta);
6363

@@ -76,7 +76,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
7676
new bytes(0)
7777
);
7878
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
79-
vm.warp(block.timestamp + space.maxVotingDuration());
79+
vm.warp(vm.getBlockTimestamp() + space.maxVotingDuration());
8080

8181
vm.expectRevert(InvalidSpace.selector);
8282
space.execute(proposalId, abi.encode(transactions));
@@ -92,7 +92,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
9292
new bytes(0)
9393
);
9494
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
95-
vm.roll(block.number + space.maxVotingDuration());
95+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
9696

9797
vm.expectEmit(true, true, true, true);
9898
emit TransactionQueued(transactions[0], block.timestamp + 1000);
@@ -111,7 +111,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
111111
new bytes(0)
112112
);
113113
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
114-
vm.roll(block.number + space.maxVotingDuration());
114+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
115115

116116
vm.expectRevert(DuplicateMetaTransaction.selector);
117117
space.execute(proposalId, abi.encode(transactions));
@@ -144,7 +144,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
144144
_vote(author, secondProposalId, Choice.For, userVotingStrategies, voteMetadataURI);
145145

146146
// Move forward in time.
147-
vm.roll(block.number + space.maxVotingDuration());
147+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
148148

149149
// Queue the first one: it should work properly.
150150
space.execute(firstProposalId, abi.encode(transactions));
@@ -163,7 +163,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
163163
Strategy(address(timelockExecutionStrategy), abi.encode(transactions)),
164164
new bytes(0)
165165
);
166-
vm.roll(block.number + space.maxVotingDuration());
166+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
167167

168168
vm.expectRevert(abi.encodeWithSelector(InvalidProposalStatus.selector, ProposalStatus.Rejected));
169169
space.execute(proposalId, abi.encode(transactions));
@@ -179,7 +179,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
179179
new bytes(0)
180180
);
181181
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
182-
vm.roll(block.number + space.maxVotingDuration());
182+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
183183

184184
vm.expectEmit(true, true, true, true);
185185
emit TransactionQueued(transactions[0], block.timestamp + 1000);
@@ -206,7 +206,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
206206
);
207207
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
208208
_vote(author, proposalId2, Choice.For, userVotingStrategies, voteMetadataURI);
209-
vm.roll(block.number + space.maxVotingDuration());
209+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
210210

211211
space.execute(proposalId, abi.encode(transactions));
212212

@@ -225,7 +225,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
225225
new bytes(0)
226226
);
227227
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
228-
vm.roll(block.number + space.maxVotingDuration());
228+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
229229

230230
transactions[0] = MetaTransaction(recipient, 2, "", Enum.Operation.Call, 0);
231231

@@ -243,15 +243,15 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
243243
new bytes(0)
244244
);
245245
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
246-
vm.roll(block.number + space.maxVotingDuration());
246+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
247247

248248
vm.expectEmit(true, true, true, true);
249249
emit TransactionQueued(transactions[0], block.timestamp + 1000);
250250
space.execute(proposalId, abi.encode(transactions));
251251

252252
assertEq(recipient.balance, 0);
253253

254-
vm.warp(block.timestamp + timelockExecutionStrategy.timelockDelay());
254+
vm.warp(vm.getBlockTimestamp() + timelockExecutionStrategy.timelockDelay());
255255
timelockExecutionStrategy.executeQueuedProposal(abi.encode(transactions));
256256

257257
assertEq(recipient.balance, 1);
@@ -267,11 +267,11 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
267267
new bytes(0)
268268
);
269269
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
270-
vm.roll(block.number + space.maxVotingDuration());
270+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
271271

272272
space.execute(proposalId, abi.encode(transactions));
273273

274-
vm.warp(block.timestamp + timelockExecutionStrategy.timelockDelay());
274+
vm.warp(vm.getBlockTimestamp() + timelockExecutionStrategy.timelockDelay());
275275

276276
vm.expectRevert("Timelock::executeTransaction: Transaction execution reverted.");
277277
timelockExecutionStrategy.executeQueuedProposal(abi.encode(transactions));
@@ -287,11 +287,11 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
287287
new bytes(0)
288288
);
289289
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
290-
vm.roll(block.number + space.maxVotingDuration());
290+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
291291

292292
space.execute(proposalId, abi.encode(transactions));
293293

294-
vm.warp(block.timestamp + timelockExecutionStrategy.timelockDelay());
294+
vm.warp(vm.getBlockTimestamp() + timelockExecutionStrategy.timelockDelay());
295295
transactions[0] = MetaTransaction(recipient, 2, "", Enum.Operation.Call, 0);
296296

297297
vm.expectRevert(ProposalNotQueued.selector);
@@ -308,7 +308,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
308308
new bytes(0)
309309
);
310310
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
311-
vm.roll(block.number + space.maxVotingDuration());
311+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
312312

313313
vm.expectEmit(true, true, true, true);
314314
emit TransactionQueued(transactions[0], block.timestamp + 1000);
@@ -328,7 +328,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
328328
new bytes(0)
329329
);
330330
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
331-
vm.roll(block.number + space.maxVotingDuration());
331+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
332332

333333
vm.expectRevert(ProposalNotQueued.selector);
334334
timelockExecutionStrategy.executeQueuedProposal(abi.encode(transactions));
@@ -344,15 +344,15 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
344344
new bytes(0)
345345
);
346346
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
347-
vm.roll(block.number + space.maxVotingDuration());
347+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
348348

349349
vm.expectEmit(true, true, true, true);
350350
emit TransactionQueued(transactions[0], block.timestamp + 1000);
351351
space.execute(proposalId, abi.encode(transactions));
352352

353353
assertEq(recipient.balance, 0);
354354

355-
vm.warp(block.timestamp + timelockExecutionStrategy.timelockDelay());
355+
vm.warp(vm.getBlockTimestamp() + timelockExecutionStrategy.timelockDelay());
356356
timelockExecutionStrategy.executeQueuedProposal(abi.encode(transactions));
357357

358358
vm.expectRevert(ProposalNotQueued.selector);
@@ -377,7 +377,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
377377
new bytes(0)
378378
);
379379
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
380-
vm.roll(block.number + space.maxVotingDuration());
380+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
381381

382382
vm.expectRevert(InvalidTransaction.selector);
383383
space.execute(proposalId, abi.encode(transactions));
@@ -393,7 +393,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
393393
new bytes(0)
394394
);
395395
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
396-
vm.roll(block.number + space.maxVotingDuration());
396+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
397397

398398
space.execute(proposalId, abi.encode(transactions));
399399

@@ -408,7 +408,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
408408
emit ProposalVetoed(keccak256(abi.encode(transactions)));
409409
timelockExecutionStrategy.veto(abi.encode(transactions));
410410

411-
vm.warp(block.timestamp + timelockExecutionStrategy.timelockDelay());
411+
vm.warp(vm.getBlockTimestamp() + timelockExecutionStrategy.timelockDelay());
412412
vm.expectRevert(ProposalNotQueued.selector);
413413
timelockExecutionStrategy.executeQueuedProposal(abi.encode(transactions));
414414
}
@@ -423,7 +423,7 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
423423
new bytes(0)
424424
);
425425
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
426-
vm.roll(block.number + space.maxVotingDuration());
426+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
427427

428428
space.execute(proposalId, abi.encode(transactions));
429429

@@ -487,15 +487,15 @@ abstract contract CompTimelockExecutionStrategyTest is SpaceTest {
487487
new bytes(0)
488488
);
489489
_vote(author, proposalId, Choice.For, userVotingStrategies, voteMetadataURI);
490-
vm.roll(block.number + space.maxVotingDuration());
490+
vm.roll(vm.getBlockNumber() + space.maxVotingDuration());
491491

492492
vm.expectEmit(true, true, true, true);
493493
emit TransactionQueued(transactions[0], block.timestamp + 1000);
494494
space.execute(proposalId, abi.encode(transactions));
495495

496496
assertEq(erc721.ownerOf(1), address(timelock));
497497

498-
vm.warp(block.timestamp + timelockExecutionStrategy.timelockDelay());
498+
vm.warp(vm.getBlockTimestamp() + timelockExecutionStrategy.timelockDelay());
499499
timelockExecutionStrategy.executeQueuedProposal(abi.encode(transactions));
500500

501501
assertEq(erc721.ownerOf(1), address(author));

test/CompVotingStrategy.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ contract CompVotingStrategyTest is Test {
2323
compToken.mint(user, 1);
2424
// Must delegate to self to activate checkpoints
2525
compToken.delegate(user);
26-
vm.roll(block.number + 1);
26+
vm.roll(vm.getBlockNumber() + 1);
2727
assertEq(
2828
compVotingStrategy.getVotingPower(uint32(block.number), user, abi.encodePacked(address(compToken)), ""),
2929
1
@@ -33,7 +33,7 @@ contract CompVotingStrategyTest is Test {
3333
function testGetZeroVotingPower() public {
3434
compToken.mint(user, 1);
3535
// No delegation, so voting power is zero
36-
vm.roll(block.number + 1);
36+
vm.roll(vm.getBlockNumber() + 1);
3737
assertEq(
3838
compVotingStrategy.getVotingPower(uint32(block.number), user, abi.encodePacked(address(compToken)), ""),
3939
0
@@ -43,7 +43,7 @@ contract CompVotingStrategyTest is Test {
4343
function testGetVotingPowerInvalidToken() public {
4444
compToken.mint(user, 1);
4545
compToken.delegate(user);
46-
vm.roll(block.number + 1);
46+
vm.roll(vm.getBlockNumber() + 1);
4747
vm.expectRevert();
4848
// Token address is set to zero
4949
compVotingStrategy.getVotingPower(uint32(block.number), user, abi.encodePacked(address(0)), "");
@@ -52,7 +52,7 @@ contract CompVotingStrategyTest is Test {
5252
function testGetVotingPowerInvalidParamsArray() public {
5353
compToken.mint(user, 1);
5454
compToken.delegate(user);
55-
vm.roll(block.number + 1);
55+
vm.roll(vm.getBlockNumber() + 1);
5656
vm.expectRevert(InvalidByteArray.selector);
5757
// Params array is too short
5858
compVotingStrategy.getVotingPower(uint32(block.number), user, abi.encodePacked("1234"), "");

test/Deployer.t.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ contract DeployerTest is Test {
2525
function setUp() public {
2626
vm.setEnv("NETWORK", "test");
2727
vm.setEnv("DEPLOYER_ADDRESS", vm.toString(address(this)));
28+
vm.setEnv("PRIVATE_KEY", vm.toString(uint256(1234)));
2829

2930
// Setting the bytecode at the singleton address of the singleton factory.
3031
vm.etch(address(0xce0042B868300000d44A59004Da54A005ffdcf9f), singletonFactoryBytecode);

0 commit comments

Comments
 (0)