Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid vm/console address when fuzzing #20

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions solidity/test/unit/modules/dispute/BondEscalationModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

function _getRandomDispute(
bytes32 _requestId,
IOracle.DisputeStatus _status

Check warning on line 128 in solidity/test/unit/modules/dispute/BondEscalationModule.t.sol

View workflow job for this annotation

GitHub Actions / Run Linters (16.x)

Variable "_status" is unused
) internal view returns (IOracle.Dispute memory _dispute) {
_dispute =
IOracle.Dispute({disputer: disputer, responseId: bytes32('response'), proposer: proposer, requestId: _requestId});
Expand Down Expand Up @@ -388,8 +388,8 @@
* @notice Tests that disputeResponse reverts the caller is not the oracle address.
*/
function test_revertIfCallerIsNotOracle(
bytes32 _requestId,

Check warning on line 391 in solidity/test/unit/modules/dispute/BondEscalationModule.t.sol

View workflow job for this annotation

GitHub Actions / Run Linters (16.x)

Variable "_requestId" is unused
bytes32 _responseId,

Check warning on line 392 in solidity/test/unit/modules/dispute/BondEscalationModule.t.sol

View workflow job for this annotation

GitHub Actions / Run Linters (16.x)

Variable "_responseId" is unused
address _caller,
IOracle.Request calldata _request
) public {
Expand Down Expand Up @@ -582,7 +582,7 @@
vm.assume(_status < 4);

IOracle.DisputeStatus _disputeStatus = IOracle.DisputeStatus(_status);
IOracle.Dispute memory _dispute = _getRandomDispute(_requestId, _disputeStatus);

Check warning on line 585 in solidity/test/unit/modules/dispute/BondEscalationModule.t.sol

View workflow job for this annotation

GitHub Actions / Run Linters (16.x)

Variable "_dispute" is unused

// Check: does it revert if not called by the Oracle?
vm.expectRevert(IModule.Module_OnlyOracle.selector);
Expand Down Expand Up @@ -1024,6 +1024,7 @@
*/
function test_revertIfAttemptToBreakTieDuringTyingBuffer(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.bondSize = 1;
_params.maxNumberOfEscalations = 3;
Expand All @@ -1050,7 +1051,10 @@
/**
* @notice Tests that pledgeForDispute is called successfully
*/
function test_successfulCall(IBondEscalationModule.RequestParameters memory _params) public {
function test_successfulCall(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.bondSize = 1000;
_params.maxNumberOfEscalations = 3;
_params.bondEscalationDeadline = block.timestamp - 1;
Expand Down Expand Up @@ -1115,7 +1119,10 @@
/**
* @notice Tests that pledgeAgainstDispute reverts if someone tries to pledge after the tying buffer.
*/
function test_revertIfTimestampBeyondTyingBuffer(IBondEscalationModule.RequestParameters memory _params) public {
function test_revertIfTimestampBeyondTyingBuffer(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.bondSize = 1;
_params.maxNumberOfEscalations = 1;
_params.bondEscalationDeadline = block.timestamp;
Expand All @@ -1139,7 +1146,10 @@
/**
* @notice Tests that pledgeAgainstDispute reverts if the maximum number of escalations has been reached.
*/
function test_revertIfMaxNumberOfEscalationsReached(IBondEscalationModule.RequestParameters memory _params) public {
function test_revertIfMaxNumberOfEscalationsReached(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.bondSize = 1;
_params.maxNumberOfEscalations = 2;
_params.bondEscalationDeadline = block.timestamp - 1;
Expand Down Expand Up @@ -1169,6 +1179,7 @@
*/
function test_revertIfThereIsMorePledgedAgainstDisputeThanFor(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.tyingBuffer = bound(_params.tyingBuffer, 0, type(uint128).max);
_params.bondSize = 1;
Expand Down Expand Up @@ -1199,6 +1210,7 @@
*/
function test_revertIfAttemptToBreakTieDuringTyingBuffer(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
// Set mock request parameters
_params.bondSize = 1;
Expand Down Expand Up @@ -1279,6 +1291,7 @@
*/
function test_revertIfTimestampLessThanEndOfTyingBuffer(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.tyingBuffer = bound(_params.tyingBuffer, 0, type(uint128).max);
_params.bondEscalationDeadline = block.timestamp;
Expand All @@ -1295,6 +1308,7 @@
*/
function test_revertIfStatusOfBondEscalationIsNotActive(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.bondEscalationDeadline = block.timestamp;
_params.tyingBuffer = 1000;
Expand All @@ -1315,7 +1329,10 @@
* @notice Tests that settleBondEscalation reverts if someone tries to settle a bond-escalated dispute that
* has the same number of pledgers.
*/
function test_revertIfSameNumberOfPledgers(IBondEscalationModule.RequestParameters memory _params) public {
function test_revertIfSameNumberOfPledgers(IBondEscalationModule.RequestParameters memory _params)
public
assumeFuzzable(address(_params.accountingExtension))
{
_params.bondEscalationDeadline = block.timestamp;
_params.tyingBuffer = 1000;
mockRequest.disputeModuleData = abi.encode(_params);
Expand Down
Loading