Skip to content

Commit

Permalink
test(medusa): prop 3 wip
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-something committed Nov 26, 2024
1 parent 4e57e08 commit dab5f34
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
10 changes: 10 additions & 0 deletions test/invariants/handlers/BaseHandler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ contract BaseHandler is Setup, Actors {
mapping(address _pledger => mapping(bytes32 _disputeId => uint256 _pledgedAmount)) internal _ghost_pledgesFor;
mapping(address _pledger => mapping(bytes32 _disputeId => uint256 _pledgedAmount)) internal _ghost_pledgesAgainst;

function _stakeGRT(uint256 _amount) internal {
GRT.transfer(msg.sender, _amount);

vm.prank(msg.sender);
GRT.approve(address(horizonStaking), _amount);

vm.prank(msg.sender);
horizonStaking.stake(_amount);
}

// Helper functions
function _getRandomChainId(uint256 _seed) internal view returns (string memory) {
bytes32[] memory chainIds = eboRequestCreator.getAllowedChainIds();
Expand Down
3 changes: 2 additions & 1 deletion test/invariants/properties/PropertyParent.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ pragma solidity 0.8.26;
import {PropertyDispute} from './PropertyDispute.t.sol';

import {PropertyFinalize} from './PropertyFinalize.t.sol';
import {PropertyPropose} from './PropertyPropose.t.sol';
import {PropertyRequester} from './PropertyRequester.t.sol';

contract PropertyParent is PropertyRequester, PropertyDispute, PropertyFinalize {
contract PropertyParent is PropertyRequester, PropertyPropose, PropertyDispute, PropertyFinalize {
// | 11 | bonded token can never be used on behalf of someone else, unless allowed by the Horizon staking contract | | [ ] |
}
18 changes: 18 additions & 0 deletions test/invariants/properties/PropertyPropose.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {IEBORequestModule, IOracle} from '../Setup.t.sol';
import {HandlerParent} from '../handlers/HandlerParent.t.sol';

contract PropertyPropose is HandlerParent {
/// @custom:property-id
/// @custom:property
function property_proposeBeforeDeadlineAndNoAnswer(uint256 _requestIdSeed, uint256 _responseIdSeed) public {
// Pick random Response
bytes32 _requestId = _getRandomRequestId(_requestIdSeed);
IOracle.Request memory _requestData = _ghost_requestData[_requestId];

// Stake some GRT in Horizon
_stakeGRT(DISPUTE_BOND_SIZE);
}
}

0 comments on commit dab5f34

Please sign in to comment.