Skip to content

Deep Fuzzing on Newly Modified Solidity Files #2

@gitcoindev

Description

@gitcoindev

QA for ubiquity#515

GitHub action run:

https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412

Example commit that changed comments in three different Solidity contracts and triggered the action: 5f5c6a6

Found changed contracts:

packages/contracts/src/dollar/Diamond.sol was changed
packages/contracts/src/dollar/core/CreditClock.sol was changed
packages/contracts/src/dollar/core/StakingShare.sol was changed

Found the following tests for deep fuzzing:

test/diamond/facets/ChefFacet.t.sol
test/diamond/facets/StakingFacet.t.sol
test/diamond/facets/StakingFormulasFacet.t.sol
test/diamond/facets/UbiquityPoolFacet.t.sol
test/dollar/core/CreditClock.t.sol
test/dollar/core/StakingShare.t.sol

Deep fuzzing execution for 10000 runs:

Compiling 200 files with 0.8.19
Solc 0.8.19 finished in 117.37s
Compiler run successful!

Running 6 tests for test/diamond/facets/ChefFacet.t.sol:DepositStateChefTest
[PASS] testCannotGetRewardsOtherAccount() (gas: 2[35](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:36)93)
[PASS] testGetRewards(uint256) (runs: 10000, μ: 244035, ~: 243888)
[PASS] testGetStakingShareInfo() (gas: 18208)
[PASS] testPendingGovernance(uint256) (runs: 10000, μ: 40874, ~: 40578)
[PASS] testRemoveLiquidity(uint256,uint256) (runs: 10000, μ: 430065, ~: 432016)
[PASS] testTotalShares() (gas: 14864)
Test result: ok. 6 passed; 0 failed; 0 skipped; finished in 13.12s

Running 4 tests for test/diamond/facets/ChefFacet.t.sol:ZeroStateChefTest
[PASS] testDepositFromZeroState(uint256) (runs: 10000, μ: 447279, ~: 447998)
[PASS] testSetGovernanceDiv(uint256) (runs: 10000, μ: 26538, ~: 26738)
[PASS] testSetGovernancePerBlock(uint256) (runs: 10000, μ: 29315, ~: 29520)
[PASS] testSetMinPriceDiff(uint256) (runs: 10000, μ: 29283, ~: 29490)
Test result: ok. 4 passed; 0 failed; 0 skipped; finished in 10.51s
No files changed, compilation skipped

Running 6 tests for test/diamond/facets/StakingFacet.t.sol:DepositStateTest
[PASS] testCannotGetRewardsOtherAccount() (gas: 23593)
[PASS] testGetRewards(uint256) (runs: 10000, μ: 244078, ~: 244169)
[PASS] testGetStakingShareInfo() (gas: 18208)
[PASS] testPendingGovernance(uint256) (runs: 10000, μ: 40875, ~: 40578)
[PASS] testRemoveLiquidity(uint256,uint256) (runs: 10000, μ: 429804, ~: 432016)
[PASS] testTotalShares() (gas: 14864)
Test result: ok. 6 passed; 0 failed; 0 skipped; finished in 13.16s

Running 6 tests for test/diamond/facets/StakingFacet.t.sol:ZeroStateStakingTest
[PASS] testCannotDepositZeroWeeks() (gas: 18186)
[PASS] testCannotStakeMoreThan4Years(uint256) (runs: 10000, μ: 22300, ~: 22249)
[PASS] testDeposit_Staking(uint256,uint256) (runs: 10000, μ: 434929, ~: 434974)
[PASS] testLockupMultiplier() (gas: 740559)
[PASS] testSetBlockCountInAWeek(uint256) (runs: 10000, μ: 28964, ~: 29162)
[PASS] testSetStakingDiscountMultiplier(uint256) (runs: 10000, μ: 28991, ~: 29182)
Test result: ok. 6 passed; 0 failed; 0 skipped; finished in 10.67s
No files changed, compilation skipped

Running 6 tests for test/diamond/facets/StakingFormulasFacet.t.sol:StakingFormulasFacetTest
[PASS] testDurationMultiply_ShouldReturnAmount() (gas: 17469)
[PASS] test_correctedAmountToWithdraw_calcSharedAmount() (gas: 13715)
[PASS] test_correctedAmountToWithdraw_returnAmount() (gas: 10731)
[PASS] test_lpRewardsAddLiquidityNormalization((address,uint256,uint256,uint256,uint256,uint256),uint256[2],uint256) (runs: 10000, μ: 12576, ~: 12576)
[PASS] test_lpRewardsRemoveLiquidityNormalization((address,uint256,uint256,uint256,uint256,uint256),uint256[2],uint256) (runs: 10000, μ: 12619, ~: 12619)
[PASS] test_sharesForLP() (gas: 14997)
Test result: ok. 6 passed; 0 failed; 0 skipped; finished in 3.25s
No files changed, compilation skipped

Running 12 tests for test/diamond/facets/UbiquityPoolFacet.t.sol:UbiquityPoolFacetTest
[PASS] test_addTokenShouldFailIfNotAdmin() (gas: 18235)
[PASS] test_addTokenShouldWorkIfAdmin() (gas: 94725)
[PASS] test_addTokenWithZeroAddressFail() (gas: 32168)
[PASS] test_collectRedemptionShouldWork() (gas: 1300972)
[PASS] test_mintDollarShouldFailWhenSlippageIsReached() (gas: 1035421)
[PASS] test_mintDollarShouldWork() (gas: 11[36](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:37)786)
[PASS] test_redeemDollarShouldFailWhenDollarIAboveOne() (gas: 1171280)
[PASS] test_redeemDollarShouldWork() (gas: 1308267)
[PASS] test_setMintActiveShouldFailIfNotAdmin() (gas: 16020)
[PASS] test_setMintActiveShouldWorkIfAdmin() (gas: 44221)
[PASS] test_setRedeemActiveShouldFailIfNotAdmin() (gas: 16129)
[PASS] test_setRedeemActiveShouldWorkIfAdmin() (gas: 44298)
Test result: ok. 12 passed; 0 failed; 0 skipped; finished in 27.70ms
No files changed, compilation skipped

Running 5 tests for test/dollar/core/CreditClock.t.sol:CreditClockTest
[PASS] test() (gas: 194908653)
[PASS] testGetRate_ShouldRevert_WhenBlockIsInThePast() (gas: 9111)
[PASS] testSetManager_ShouldRevert_WhenNotAdmin() (gas: 21674)
[PASS] testSetManager_ShouldSetDiamond() (gas: 27[40](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:41)6)
[PASS] testSetRatePerBlock_ShouldRevert_WhenNotAdmin() (gas: 22105)
Test result: ok. 5 passed; 0 failed; 0 skipped; finished in 2.04s
No files changed, compilation skipped

Running 23 tests for test/dollar/core/StakingShare.t.sol:StakingShareTest
[PASS] testGetStake_ShouldReturnStake() (gas: 59897)
[PASS] testMint_ShouldMint(uint128,uint128,uint256) (runs: 10000, μ: 316032, ~: 320118)
[PASS] testMint_ShouldRevert_IfMintingToZeroAddress(uint128,uint128,uint256) (runs: 10000, μ: 24314, ~: 24314)
[PASS] testMint_ShouldRevert_IfNotMinter(uint128,uint128,uint256) (runs: 10000, μ: 24293, ~: 24293)
[PASS] testMint_ShouldRevert_IfPaused(uint128,uint128,uint256) (runs: 10000, μ: 33685, ~: 33685)
[PASS] testPause_ShouldPause() (gas: 42760)
[PASS] testPause_ShouldRevert_IfNotPauser() (gas: 20473)
[PASS] testSafeBatchTransferFrom_ShouldRevert_IfPaused() (gas: 40026)
[PASS] testSafeBatchTransferFrom_ShouldTransferTokenIds() (gas: 303011)
[PASS] testSafeTransferFrom_ShouldRevert_IfInsufficientBalance() (gas: 47494)
[PASS] testSafeTransferFrom_ShouldRevert_IfPaused() (gas: 34630)
[PASS] testSafeTransferFrom_ShouldRevert_IfToAddressZero() (gas: 42[41](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:42)5)
[PASS] testSafeTransferFrom_ShouldTransferTokenId() (gas: 162659)
[PASS] testSetBaseUri_ShouldSetUri() (gas: 401695)
[PASS] testSetUriSingle_ShouldSetUri() (gas: 180600)
[PASS] testSetUri_ShouldRevert_IfGovernanceTokenNotStakingManager() (gas: 24649)
[PASS] testSetUri_ShouldSetUri() (gas: 255859)
[PASS] testTotalSupply_ShouldReturn_TotalSupply() (gas: 7655)
[PASS] testUnpause_ShouldRevert_IfNotPauser() (gas: 49882)
[PASS] testUnpause_ShouldUnpause() (gas: 344[42](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:43))
[PASS] testUpdateStake_ShouldRevert_IfNotMinter(uint128,uint128,uint256) (runs: 10000, μ: 24233, ~: 24233)
[PASS] testUpdateStake_ShouldRevert_IfPaused(uint128,uint128,uint256) (runs: 10000, μ: 33599, ~: 33599)
[PASS] testUpdateStake_ShouldUpdateStake(uint128,uint128,uint256) (runs: 10000, μ: 161759, ~: 16[45](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:46)49)
Test result: ok. 23 passed; 0 failed; 0 skipped; finished in 6.[71](https://github.com/gitcoindev/ubiquity-dollar/actions/runs/5927596118/job/16071424412#step:7:72)s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions