Skip to content

Commit

Permalink
refactor: remove weight of selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Nov 25, 2024
1 parent e95b180 commit a3767dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
6 changes: 0 additions & 6 deletions test/forge/InvariantTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ contract InvariantTest is BaseTest {
vm.stopPrank();
}

function _weightSelector(bytes4 selector, uint256 weight) internal {
for (uint256 i; i < weight; ++i) {
selectors.push(selector);
}
}

/* HANDLERS */

function mine(uint256 blocks) external {
Expand Down
16 changes: 8 additions & 8 deletions test/forge/invariant/BaseInvariantTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ contract BaseInvariantTest is InvariantTest {
}

function setUp() public virtual override {
_weightSelector(this.supplyAssetsOnBehalfNoRevert.selector, 15);
_weightSelector(this.supplySharesOnBehalfNoRevert.selector, 5);
_weightSelector(this.withdrawAssetsOnBehalfNoRevert.selector, 10);
_weightSelector(this.borrowAssetsOnBehalfNoRevert.selector, 15);
_weightSelector(this.repayAssetsOnBehalfNoRevert.selector, 10);
_weightSelector(this.repaySharesOnBehalfNoRevert.selector, 10);
_weightSelector(this.supplyCollateralOnBehalfNoRevert.selector, 15);
_weightSelector(this.withdrawCollateralOnBehalfNoRevert.selector, 10);
selectors.push(this.supplyAssetsOnBehalfNoRevert.selector);
selectors.push(this.supplySharesOnBehalfNoRevert.selector);
selectors.push(this.withdrawAssetsOnBehalfNoRevert.selector);
selectors.push(this.borrowAssetsOnBehalfNoRevert.selector);
selectors.push(this.repayAssetsOnBehalfNoRevert.selector);
selectors.push(this.repaySharesOnBehalfNoRevert.selector);
selectors.push(this.supplyCollateralOnBehalfNoRevert.selector);
selectors.push(this.withdrawCollateralOnBehalfNoRevert.selector);

super.setUp();

Expand Down
10 changes: 5 additions & 5 deletions test/forge/invariant/DynamicInvariantTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ contract DynamicInvariantTest is BaseInvariantTest {
uint256 internal immutable MAX_PRICE = ORACLE_PRICE_SCALE * 10;

function setUp() public virtual override {
_weightSelector(this.liquidateSeizedAssetsNoRevert.selector, 2);
_weightSelector(this.liquidateRepaidSharesNoRevert.selector, 2);
_weightSelector(this.setFeeNoRevert.selector, 1);
_weightSelector(this.setPrice.selector, 5);
_weightSelector(this.mine.selector, 100);
selectors.push(this.liquidateSeizedAssetsNoRevert.selector);
selectors.push(this.liquidateRepaidSharesNoRevert.selector);
selectors.push(this.setFeeNoRevert.selector);
selectors.push(this.setPrice.selector);
selectors.push(this.mine.selector);

super.setUp();
}
Expand Down

0 comments on commit a3767dd

Please sign in to comment.