-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReadme.md.mustache
607 lines (484 loc) · 23.5 KB
/
Readme.md.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
{{> partials/splash}}
[TOC]
## Details
- **Client** {{client_name}}
- **Date** {{date}}
- **Lead reviewer** Daniel Luca ([@cleanunicorn](https://twitter.com/cleanunicorn))
- **Reviewers** Daniel Luca ([@cleanunicorn](https://twitter.com/cleanunicorn))
- **Repository**: [{{project_name}}]({{source_repository}})
- **Commit hash** `{{commit_hash}}`
- **Final commit hash** `{{final_commit_hash}}`
- **Technologies**
- Solidity
- Node.JS
## Issues Summary
| SEVERITY | OPEN | CLOSED |
|----------------|:----------:|:------------:|
{{#issues_summary}}
| {{severity}} | {{open}} | {{closed}} |
{{/issues_summary}}
## Executive summary
This report represents the results of the engagement with **{{client_name}}** to review **{{project_name}}**.
The review was conducted over the course of **{{review_period}}** from **{{date_interval}}**. A total of **{{person_days}} person-days** were spent reviewing the code.
### Week 1
During the first week, we started to manually review the code and the provided documents. The code is well documented and of good quality, but it's highly modular and it's hard to understand the overall architecture. We started to write a high-level architecture diagram and we started to write a list of the most important contracts.
We identified a few low severity issues, but we didn't find any critical issues. We also identified a few issues that could be improved, but they don't represent a security risk.
On Wednesday, we set up a meeting with the client to discuss the architecture and the issues we found. The dev team needed us to check a new PR that is about to hit the mainnet. This PR is identified by commit hash `{{final_commit_hash}}`. The scope was extended to include the file `contracts/pcv/utils/ERC20Allocator.sol`.
On Thursday, we focused on the newly added file. We had another meeting with the client where we discussed details in the implementation of the new contract.
On Friday, we made sure we didn't have any open or unfinished issues and had another meeting with the client to deliver the report and discuss any open questions.
## Scope
The initial review focused on the [{{project_name}}]({{source_repository}}) repository, identified by the commit hash `{{commit_hash}}`. Later during the week, another file was added to the scope, identified by the commit hash `{{final_commit_hash}}`.
We focused on manually reviewing the codebase, searching for security issues such as, but not limited to, re-entrancy problems, transaction ordering, block timestamp dependency, exception handling, call stack depth limitation, integer overflow/underflow, self-destructible contracts, unsecured balance, use of origin, costly gas patterns, architectural problems, code readability.
**Includes:**
- PriceBoundPSM
- Core
- L2Core
- VoltSystemOracle
- OraclePassThrough
- TimelockController - from OpenZeppelin
- PCVGuardian
- PCVGuardAdmin
- CoreRef
- OracleRef
- ERC20CompoundPCVDeposit
- ERC20Allocator - added later in the scope
Documents:
- [Market Governance Whitepaper](https://github.com/volt-protocol/whitepaper/blob/mgov/README.md)
- [Market Governance Alpha](https://docs.google.com/document/d/1wmK0esBaIxHx_iDXXHWjMo7RaELo3RVBjImhMdefyJg/edit)
{{! ## Recommendations
We identified a few possible general improvements that are not security issues during the review, which will bring value to the developers and the community reviewing and using the product. }}
## Issues
{{#issues}}
### [{{title}}]({{url}})
![Issue status: {{status}}](https://img.shields.io/static/v1?label=Status&message={{status}}&color={{status_color}}&style=flat-square) ![{{severity}}](https://img.shields.io/static/v1?label=Severity&message={{severity}}&color={{severity_color}}&style=flat-square)
{{{body}}}
---
{{/issues}}
## Artifacts
### Architecture
The architecture is extremely hard to understand and it's not well documented. We started to work on a high-level architecture diagram.
![static/Volt-Diagram-Drawio.png](static/Volt-Diagram-Drawio.svg)
#### Describe
We used surya to generate these outputs:
```shell
$ npx surya describe ./Contract.sol
```
##### Core
```shell
+ Core (ICore, Permissions, Initializable)
- [Ext] init #
- modifiers: initializer
- [Ext] setVcon #
- modifiers: onlyGovernor
```
##### PriceBoundPSM
```shell
+ PriceBoundPSM (PegStabilityModule, IPriceBound)
- [Pub] <Constructor> #
- modifiers: PegStabilityModule
- [Ext] setOracleFloorBasisPoints #
- modifiers: onlyGovernorOrAdmin
- [Ext] setOracleCeilingBasisPoints #
- modifiers: onlyGovernorOrAdmin
- [Ext] isPriceValid
- [Int] _allocate #
- [Int] _setCeilingBasisPoints #
- [Int] _setFloorBasisPoints #
- [Int] _validPrice
- [Int] _validatePriceRange
```
##### L2Core
```shell
+ L2Core (ICore, Permissions)
- [Pub] <Constructor> #
- [Ext] setVcon #
- modifiers: onlyGovernor
```
##### VoltSystemOracle
```shell
+ VoltSystemOracle (IVoltSystemOracle)
- [Pub] <Constructor> #
- [Pub] getCurrentOraclePrice
- [Ext] compoundInterest #
```
##### OraclePassThrough
```shell
+ OraclePassThrough (IOraclePassThrough, Ownable)
- [Pub] <Constructor> #
- modifiers: Ownable
- [Pub] update #
- [Ext] read
- [Ext] getCurrentOraclePrice
- [Ext] currPegPrice
- [Ext] updateScalingPriceOracle #
- modifiers: onlyOwner
```
##### PCVGuardian
```shell
+ PCVGuardian (IPCVGuardian, CoreRef)
- [Pub] <Constructor> #
- modifiers: CoreRef
- [Pub] isWhitelistAddress
- [Pub] getWhitelistAddresses
- [Ext] addWhitelistAddress #
- modifiers: onlyGovernor
- [Ext] addWhitelistAddresses #
- modifiers: onlyGovernor
- [Ext] removeWhitelistAddress #
- modifiers: onlyGuardianOrGovernor
- [Ext] removeWhitelistAddresses #
- modifiers: onlyGuardianOrGovernor
- [Ext] withdrawToSafeAddress #
- modifiers: hasAnyOfThreeRoles,onlyWhitelist
- [Ext] withdrawAllToSafeAddress #
- modifiers: hasAnyOfThreeRoles,onlyWhitelist
- [Ext] withdrawERC20ToSafeAddress #
- modifiers: hasAnyOfThreeRoles,onlyWhitelist
- [Ext] withdrawAllERC20ToSafeAddress #
- modifiers: hasAnyOfThreeRoles,onlyWhitelist
- [Int] _withdrawToSafeAddress #
- [Int] _withdrawERC20ToSafeAddress #
- [Int] _addWhitelistAddress #
- [Int] _removeWhitelistAddress #
```
##### PCVGuardAdmin
```shell
+ PCVGuardAdmin (IPCVGuardAdmin, CoreRef)
- [Pub] <Constructor> #
- modifiers: CoreRef
- [Ext] grantPCVGuardRole #
- modifiers: onlyGovernor
- [Ext] revokePCVGuardRole #
- modifiers: onlyGuardianOrGovernor
```
##### CoreRef
```shell
+ CoreRef (ICoreRef, Pausable)
- [Pub] <Constructor> #
- [Int] _initialize #
- [Ext] setContractAdminRole #
- modifiers: onlyGovernor
- [Pub] isContractAdmin
- [Pub] pause #
- modifiers: onlyGuardianOrGovernor
- [Pub] unpause #
- modifiers: onlyGuardianOrGovernor
- [Pub] core
- [Pub] volt
- [Pub] vcon
- [Pub] voltBalance
- [Pub] vconBalance
- [Int] _burnVoltHeld #
- [Int] _mintVolt #
- [Int] _setContractAdminRole #
```
##### OracleRef
```shell
+ OracleRef (IOracleRef, CoreRef)
- [Pub] <Constructor> #
- modifiers: CoreRef
- [Ext] setOracle #
- modifiers: onlyGovernor
- [Ext] setDoInvert #
- modifiers: onlyGovernor
- [Ext] setDecimalsNormalizer #
- modifiers: onlyGovernor
- [Ext] setBackupOracle #
- modifiers: onlyGovernorOrAdmin
- [Pub] invert
- [Pub] updateOracle #
- [Pub] readOracle
- [Int] _setOracle #
- [Int] _setBackupOracle #
- [Int] _setDoInvert #
- [Int] _setDecimalsNormalizer #
- [Int] _setDecimalsNormalizerFromToken #
```
##### ERC20CompoundPCVDeposit
```shell
+ ERC20CompoundPCVDeposit (CompoundPCVDepositBase)
- [Pub] <Constructor> #
- modifiers: CompoundPCVDepositBase
- [Ext] deposit #
- modifiers: whenNotPaused
- [Int] _transferUnderlying #
- [Pub] balanceReportedIn
```
Legend
```shell
($) = payable function
# = non-constant function
```
### Tests
```text
$ npm run test
> @voltprotocol/[email protected] test
> forge test --match-contract UnitTest -vvv
[⠒] Compiling...
[⠑] Compiling 1 files with 0.4.26
[⠘] Compiling 71 files with 0.8.13
[⠃] Compiling 78 files with 0.8.16
[⠔] Solc 0.4.26 finished in 36.38ms
[⠊] Solc 0.8.16 finished in 4.48s
[⠘] Solc 0.8.13 finished in 10.90s
Compiler run successful (with warnings)
contracts/external/WETH9.sol:47:9: Warning: Invoking events without "emit" prefix is deprecated.
Deposit(msg.sender, msg.value);
^----------------------------^
contracts/external/WETH9.sol:54:9: Warning: Invoking events without "emit" prefix is deprecated.
Withdrawal(msg.sender, wad);
^-------------------------^
contracts/external/WETH9.sol:58:16: Warning: Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).balance" instead.
return this.balance;
^----------^
contracts/external/WETH9.sol:63:9: Warning: Invoking events without "emit" prefix is deprecated.
Approval(msg.sender, guy, wad);
^----------------------------^
contracts/external/WETH9.sol:86:9: Warning: Invoking events without "emit" prefix is deprecated.
Transfer(src, dst, wad);
^---------------------^
warning[8760]: Warning: This declaration has the same name as another declaration.
--> contracts/pcv/utils/ERC20Allocator.sol:79:9:
|
79 | uint248 targetBalance,
| ^^^^^^^^^^^^^^^^^^^^^
Note: The other declaration is here:
--> contracts/pcv/utils/ERC20Allocator.sol:280:5:
|
280 | function targetBalance(address psm) external view returns (uint256) {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[8760]: Warning: This declaration has the same name as another declaration.
--> contracts/pcv/utils/ERC20Allocator.sol:104:48:
|
104 | function editPSMTargetBalance(address psm, uint248 targetBalance)
| ^^^^^^^^^^^^^^^^^^^^^
Note: The other declaration is here:
--> contracts/pcv/utils/ERC20Allocator.sol:280:5:
|
280 | function targetBalance(address psm) external view returns (uint256) {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2072]: Warning: Unused local variable.
--> contracts/test/integration/vip/vip8.sol:94:9:
|
94 | uint256 daiBalance = PegStabilityModule(MainnetAddresses.FEI_DAI_PSM)
| ^^^^^^^^^^^^^^^^^^
warning[2072]: Warning: Unused local variable.
--> contracts/test/unit/pcv/utils/ERC20Allocator.t.sol:619:9:
|
619 | uint256 skimAmount = (bufferCap - bufferEnd) * 2;
| ^^^^^^^^^^^^^^^^^^
warning[2018]: Warning: Function state mutability can be restricted to view
--> contracts/test/integration/vip/vip10.sol:121:5:
|
121 | function getMainnetProposal()
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2018]: Warning: Function state mutability can be restricted to pure
--> contracts/test/integration/vip/vip10.sol:185:5:
|
185 | function arbitrumSetup() public override {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2018]: Warning: Function state mutability can be restricted to pure
--> contracts/test/integration/vip/vip10.sol:189:5:
|
189 | function arbitrumValidate() public override {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2018]: Warning: Function state mutability can be restricted to pure
--> contracts/test/integration/vip/vip8.sol:141:5:
|
141 | function arbitrumSetup() public override {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2018]: Warning: Function state mutability can be restricted to pure
--> contracts/test/integration/vip/vip8.sol:145:5:
|
145 | function arbitrumValidate() public override {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2018]: Warning: Function state mutability can be restricted to pure
--> contracts/test/integration/vip/vip9.sol:110:5:
|
110 | function arbitrumSetup() public override {
| ^ (Relevant source part starts here and spans across multiple lines).
warning[2018]: Warning: Function state mutability can be restricted to pure
--> contracts/test/integration/vip/vip9.sol:114:5:
|
114 | function arbitrumValidate() public override {
| ^ (Relevant source part starts here and spans across multiple lines).
Running 2 tests for contracts/test/unit/Volt.t.sol:UnitTestVolt
[PASS] testDeployedMetaData() (gas: 17541)
[PASS] testMintsVolt() (gas: 70031)
Test result: ok. 2 passed; 0 failed; finished in 8.31ms
Running 2 tests for contracts/test/unit/core/Core.t.sol:UnitTestCore
[PASS] testGovernorSetsVcon() (gas: 22417)
[PASS] testNonGovernorFailsSettingVcon() (gas: 13096)
Test result: ok. 2 passed; 0 failed; finished in 7.28ms
Running 4 tests for contracts/test/unit/oracle/OraclePassThrough.t.sol:UnitTestOraclePassThrough
[PASS] testDataPassThroughSync() (gas: 23897)
[PASS] testSetup() (gas: 12820)
[PASS] testUpdateScalingPriceOracleFailureNotGovernor() (gas: 13697)
[PASS] testUpdateScalingPriceOracleSuccess() (gas: 244964)
Test result: ok. 4 passed; 0 failed; finished in 10.97ms
Running 6 tests for contracts/test/unit/utils/KArrayTree.t.sol:KArrayTreeUnitTest
[PASS] testAddDuplicateFails() (gas: 5643)
[PASS] testAddDuplicateFailsFind() (gas: 39737)
[PASS] testCanChangeRole() (gas: 40888)
[PASS] testCannotChangeToExistingRole() (gas: 5672)
[PASS] testFree() (gas: 52596)
[PASS] testSetup() (gas: 46808)
Test result: ok. 6 passed; 0 failed; finished in 452.71µs
Running 3 tests for contracts/test/unit/utils/Deviation.t.sol:UnitTestDeviation
[PASS] testDeviation() (gas: 1332)
[PASS] testOutsideDeviation() (gas: 3350)
[PASS] testWithinDeviation() (gas: 3120)
Test result: ok. 3 passed; 0 failed; finished in 179.65µs
Running 3 tests for contracts/test/unit/core/L2Core.t.sol:UnitTestL2Core
[PASS] testGovernorSetsVcon() (gas: 39600)
[PASS] testNonGovernorFailsSettingVcon() (gas: 13129)
[PASS] testSetup() (gas: 57635)
Test result: ok. 3 passed; 0 failed; finished in 955.64µs
Running 7 tests for contracts/test/unit/pcv/PCVGuardAdmin.t.sol:UnitTestPCVGuardAdmin
[PASS] testGrantPCVGuard() (gas: 99226)
[PASS] testGrantPCVGuardFailWhenGuardian() (gas: 17065)
[PASS] testGrantPCVGuardFailWhenNoRoles() (gas: 14577)
[PASS] testPCVGuardAdminRole() (gas: 10163)
[PASS] testRevokePCVGuardFailWhenNoRole() (gas: 19918)
[PASS] testRevokePCVGuardGovernor() (gas: 36082)
[PASS] testRevokePCVGuardGuardian() (gas: 38636)
Test result: ok. 7 passed; 0 failed; finished in 1.66ms
Running 11 tests for contracts/test/unit/pcv/ERC20HoldingPCVDeposit.t.sol:UnitTestERC20HoldingsPCVDeposit
[PASS] testDepositFailsOnPause() (gas: 40859)
[PASS] testDepositNoOp() (gas: 7591)
[PASS] testWithdrawAllFailsNonPCVController() (gas: 17439)
[PASS] testWithdrawAllSucceeds() (gas: 82588)
[PASS] testWithdrawERC20FailsNonPCVController() (gas: 16553)
[PASS] testWithdrawERC20Succeeds() (gas: 82261)
[PASS] testWithdrawEthFailsNonPCVController() (gas: 14410)
[PASS] testWithdrawEthSucceeds() (gas: 51551)
[PASS] testWithdrawFailsNonPCVController() (gas: 17497)
[PASS] testWithdrawSucceeds() (gas: 81625)
[PASS] testWrapEthFailsWhenNotOnMainnetOrArbitrum() (gas: 9021)
Test result: ok. 11 passed; 0 failed; finished in 22.95ms
Running 34 tests for contracts/test/unit/pcv/PCVGuardian.t.sol:UnitTestPCVGuardian
[PASS] testAddWhiteListAddress() (gas: 68365)
[PASS] testGovernorWithdrawAllERC20ToSafeAddress() (gas: 62208)
[PASS] testGovernorWithdrawERC20ToSafeAddress() (gas: 61455)
[PASS] testGuardianWithdrawAllERC20ToSafeAddress() (gas: 65460)
[PASS] testGuardianWithdrawAllToSafeAddress() (gas: 71328)
[PASS] testGuardianWithdrawERC20ToSafeAddress() (gas: 64622)
[PASS] testGuardianWithdrawToSafeAddress() (gas: 70016)
[PASS] testPCVGuardAdminRole() (gas: 10202)
[PASS] testPCVGuardWithdrawAllERC20ToSafeAddress() (gas: 68592)
[PASS] testPCVGuardWithdrawAllToSafeAddress() (gas: 74451)
[PASS] testPCVGuardWithdrawERC20ToSafeAddress() (gas: 67830)
[PASS] testPCVGuardWithdrawToSafeAddress() (gas: 73213)
[PASS] testPCVGuardianRoles() (gas: 13642)
[PASS] testPausedAfterWithdrawAllToSafeAddress() (gas: 105301)
[PASS] testPausedAfterWithdrawToSafeAddress() (gas: 104032)
[PASS] testRemoveWhiteListAddress() (gas: 25129)
[PASS] testWithdrawAllERC20ToSafeAddressFailWhenGuardRevokedGovernor() (gas: 48315)
[PASS] testWithdrawAllERC20ToSafeAddressFailWhenGuardRevokedGuardian() (gas: 50886)
[PASS] testWithdrawAllERC20ToSafeAddressFailWhenNoRole() (gas: 25445)
[PASS] testWithdrawAllERC20ToSafeAddressFailWhenNotWhitelist() (gas: 21962)
[PASS] testWithdrawAllToSafeAddress() (gas: 68108)
[PASS] testWithdrawAllToSafeAddressFailWhenGuardRevokedGovernor() (gas: 46547)
[PASS] testWithdrawAllToSafeAddressFailWhenGuardRevokedGuardian() (gas: 49153)
[PASS] testWithdrawAllToSafeAddressFailWhenNoRole() (gas: 23211)
[PASS] testWithdrawAlloSafeAddressFailWhenNotWhitelist() (gas: 19715)
[PASS] testWithdrawERC20ToSafeAddressFailWhenGuardRevokedGovernor() (gas: 50140)
[PASS] testWithdrawERC20ToSafeAddressFailWhenGuardRevokedGuardian() (gas: 52607)
[PASS] testWithdrawERC20ToSafeAddressFailWhenNoRole() (gas: 27607)
[PASS] testWithdrawERC20oSafeAddressFailWhenNotWhitelist() (gas: 24150)
[PASS] testWithdrawToSafeAddress() (gas: 66851)
[PASS] testWithdrawToSafeAddressFailWhenGuardRevokedGovernor() (gas: 48264)
[PASS] testWithdrawToSafeAddressFailWhenGuardRevokedGuardian() (gas: 50871)
[PASS] testWithdrawToSafeAddressFailWhenNoRole() (gas: 25402)
[PASS] testWithdrawToSafeAddressFailWhenNotWhitelist() (gas: 21838)
Test result: ok. 34 passed; 0 failed; finished in 33.85ms
Running 10 tests for contracts/test/unit/pcv/utils/ERC20AllocatorConnector.t.sol:UnitTestERC20AllocatorConnector
[PASS] testConnectAndRemoveNewDeposit() (gas: 1363694)
[PASS] testConnectNewDepositFailsTokenMismatch() (gas: 1344233)
[PASS] testConnectNewDepositFailsUnderlyingTokenMismatch() (gas: 1344278)
[PASS] testConnectNewDepositSkimToDripFrom() (gas: 1591079)
[PASS] testCreateDuplicateDepositFails() (gas: 24620)
[PASS] testCreateNewDepositFailsUnderlyingTokenMismatch() (gas: 2687951)
[PASS] testDripFailsToNonConnectedAddress(address) (runs: 256, μ: 15788, ~: 15788)
[PASS] testEditPSMTargetBalanceFailsPsmUnderlyingChanged() (gas: 180236)
[PASS] testSetTargetBalanceNonExistingPsmFails() (gas: 130986)
[PASS] testSkimFailsToNonConnectedAddress(address) (runs: 256, μ: 15701, ~: 15701)
Test result: ok. 10 passed; 0 failed; finished in 39.03ms
Running 12 tests for contracts/test/unit/utils/RateLimitedV2.t.sol:UnitTestRateLimitedV2
[PASS] testDepleteBuffer(uint128,uint16) (runs: 256, μ: 22136, ~: 25794)
[PASS] testDepleteBufferFailsWhenZeroBuffer() (gas: 20234)
[PASS] testDepleteThenReplenishBuffer(uint128,uint128,uint16) (runs: 256, μ: 28172, ~: 27111)
[PASS] testReplenishBuffer(uint128,uint16) (runs: 256, μ: 30682, ~: 31404)
[PASS] testReplenishWhenAtBufferCapHasNoEffect(uint128) (runs: 256, μ: 13537, ~: 13537)
[PASS] testSetBufferCapGovSucceeds() (gas: 30801)
[PASS] testSetBufferCapNonGovFails() (gas: 14344)
[PASS] testSetRateLimitPerSecondAboveMaxFails() (gas: 17059)
[PASS] testSetRateLimitPerSecondGovSucceeds() (gas: 29020)
[PASS] testSetRateLimitPerSecondNonGovFails() (gas: 14266)
[PASS] testSetRateLimitPerSecondSucceeds() (gas: 27052)
[PASS] testSetup() (gas: 13286)
Test result: ok. 12 passed; 0 failed; finished in 67.82ms
Running 45 tests for contracts/test/unit/pcv/utils/ERC20Allocator.t.sol:UnitTestERC20Allocator
[PASS] testAllConditionsFalseWhenPaused() (gas: 142927)
[PASS] testBufferDepletesAndReplenishesCorrectly() (gas: 261973)
[PASS] testBufferDepletesAndReplenishesCorrectlyMultipleDecimalNormalizedDeposits() (gas: 3849611)
[PASS] testBufferUpdatesCorrectly() (gas: 261566)
[PASS] testConnectDepositNonGovFails() (gas: 14567)
[PASS] testCreateDepositNonGovFails() (gas: 14728)
[PASS] testDeleteDepositGovSucceeds() (gas: 27065)
[PASS] testDeleteDepositNonGovFails() (gas: 14419)
[PASS] testDeletePSMGovSucceeds() (gas: 29270)
[PASS] testDeletePSMGovSucceedsDripFails() (gas: 36233)
[PASS] testDeletePSMGovSucceedsDripFailsDeleteDeposit() (gas: 35591)
[PASS] testDeletePSMGovSucceedsSkimFails() (gas: 36098)
[PASS] testDeletePSMGovSucceedsSkimFailsDeleteDeposit() (gas: 36628)
[PASS] testDeletePSMNonGovFails() (gas: 16548)
[PASS] testDoActionDripSucceedsWhenUnderFullTargetBalance(uint8) (runs: 256, μ: 217770, ~: 217770)
[PASS] testDoActionFailsWhenUnderTargetWithoutPCVControllerRole() (gas: 116833)
[PASS] testDoActionNoOpOnNonWhitelistedPSM() (gas: 20223)
[PASS] testDoActionNoOpWhenUnderTargetWithoutPCVControllerRole() (gas: 29353)
[PASS] testDoActionSkimSucceedsWhenOverThresholdWithPCVControllerFuzz(uint128) (runs: 256, μ: 165043, ~: 146330)
[PASS] testDripAndSkimFailsWhenPaused() (gas: 44873)
[PASS] testDripFailsOnNonWhitelistedPSM() (gas: 20189)
[PASS] testDripFailsWhenBufferExhausted() (gas: 261410)
[PASS] testDripFailsWhenBufferZero() (gas: 194307)
[PASS] testDripFailsWhenUnderFunded() (gas: 177840)
[PASS] testDripFailsWhenUnderTargetWithoutPCVControllerRole() (gas: 116701)
[PASS] testDripNoOpWhenUnderTargetWithoutPCVControllerRole() (gas: 50015)
[PASS] testDripSucceedsWhenBufferFiftyPercentDepleted() (gas: 243180)
[PASS] testDripSucceedsWhenBufferFiftyPercentDepletedDecimalsNormalized() (gas: 3639644)
[PASS] testDripSucceedsWhenBufferFiftyPercentDepletedDecimalsNormalizedNegative() (gas: 3639613)
[PASS] testDripSucceedsWhenOverThreshold() (gas: 217932)
[PASS] testDripSucceedsWhenOverThresholdAndPSMPartiallyFunded() (gas: 248718)
[PASS] testDripSucceedsWhenUnderFullTargetBalance(uint8) (runs: 256, μ: 198531, ~: 198531)
[PASS] testDripperFailsWhenUnderFunded() (gas: 137455)
[PASS] testGetAdjustedAmountDown(uint128) (runs: 256, μ: 6991, ~: 6991)
[PASS] testGetAdjustedAmountUp(uint128) (runs: 256, μ: 6683, ~: 6683)
[PASS] testPullSucceedsWhenOverThresholdWithPCVController() (gas: 219109)
[PASS] testSetup() (gas: 56236)
[PASS] testSkimFailsOnNonWhitelistedPSM() (gas: 20211)
[PASS] testSkimFailsWhenOverTargetWithoutPCVController() (gas: 93596)
[PASS] testSkimFailsWhenUnderFunded() (gas: 48287)
[PASS] testSkimSucceedsWhenOverThresholdWithPCVControllerFuzz(uint128) (runs: 256, μ: 175953, ~: 162026)
[PASS] testSweepGovSucceeds() (gas: 76589)
[PASS] testSweepNonGovFails() (gas: 16783)
[PASS] testTargetBalanceGovSucceeds() (gas: 34072)
[PASS] testeditPSMTargetBalanceNonGovFails() (gas: 14647)
Test result: ok. 45 passed; 0 failed; finished in 220.07ms
Running 10 tests for contracts/test/unit/oracle/VoltSystemOracle.t.sol:VoltSystemOracleUnitTest
[PASS] testCompoundBeforePeriodStartFails() (gas: 10763)
[PASS] testCompoundSucceedsAfterOnePeriod() (gas: 28455)
[PASS] testLERPPerDay() (gas: 198204)
[PASS] testLinearInterpolation() (gas: 30104)
[PASS] testLinearInterpolationFuzz(uint32) (runs: 256, μ: 21821, ~: 24128)
[PASS] testLinearInterpolationFuzzMultiplePeriods(uint32,uint8) (runs: 256, μ: 1344004, ~: 563838)
[PASS] testLinearInterpolationUnderYearFuzzPeriods(uint24,uint8) (runs: 256, μ: 842437, ~: 334878)
[PASS] testMultipleSequentialPeriodCompounds() (gas: 51930321)
[PASS] testNoLinearInterpolationBeforeStartTime(uint16) (runs: 256, μ: 13584, ~: 13584)
[PASS] testSetup() (gas: 12398)
Test result: ok. 10 passed; 0 failed; finished in 1.24s
```
## License
This report falls under the terms described in the included [LICENSE](./LICENSE).
{{> partials/features}}
<link rel="stylesheet" href="./style/print.css"/>