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

feat: medusa tests #51

Draft
wants to merge 29 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5d5fd14
chore: properties md update
simon-something Oct 29, 2024
3b77715
test(medusa): handlers and working setup
simon-something Nov 10, 2024
1b53763
test(medusa): add lib to crytic compile
simon-something Nov 10, 2024
98de161
test(medusa): prop 0 sanity check ok
simon-something Nov 10, 2024
92a50e3
test(medusa): git ignore corpus
simon-something Nov 10, 2024
1e78bdb
test(medusa): git ignore corpus
simon-something Nov 10, 2024
efc8876
test(medusa): typo medusa json
simon-something Nov 10, 2024
e4cf1e5
test(medusa): rm corpus
simon-something Nov 10, 2024
c0ffee6
test(medusa): natspec
simon-something Nov 11, 2024
c0ffee7
test(medusa): rm non-sensical handlers onlyoracle etc
simon-something Nov 11, 2024
c0ffeed
test(medusa): ghosts refactor
simon-something Nov 13, 2024
c0ffee6
test(medusa): more handler fixes
simon-something Nov 13, 2024
c0ffeee
test(medusa): properties md update
simon-something Nov 20, 2024
9c8dce2
test(medusa): requester properties (#57)
0xJabberwock Nov 28, 2024
c0ffee9
test(medusa): dispute window in prop6
simon-something Nov 28, 2024
c0ffeef
test(medusa): fix approveModule
simon-something Nov 28, 2024
c0ffeeb
test(medusa): fix approveModule
simon-something Nov 28, 2024
97fff3c
test(medusa): rename PropertyDispute to PropertyDisputer
0xJabberwock Nov 29, 2024
80d145f
test(medusa): correct prop-6
0xJabberwock Nov 29, 2024
1d45342
test(medusa): assert prop-7
0xJabberwock Nov 29, 2024
c0ffee6
test(medusa): properties 13
simon-something Nov 30, 2024
c0ffee9
test(medusa): fix prop1 for empty finalized req
simon-something Dec 7, 2024
c0ffee7
test(medusa): fix fp
simon-something Dec 11, 2024
7218056
test(medusa): proposer properties
0xJabberwock Dec 13, 2024
2b8bc63
test(medusa): fix prop8b
simon-something Dec 11, 2024
c0ffee2
test(medusa): false pos fix
simon-something Dec 16, 2024
c0ffeea
test(medusa): false pos fix
simon-something Dec 16, 2024
a3b8f1c
Merge branch 'dev' into test/handler-cov
simon-something Dec 18, 2024
c0ffee8
Revert "Merge branch 'dev' into test/handler-cov"
simon-something Dec 18, 2024
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
18 changes: 9 additions & 9 deletions test/invariants/properties/PropertyDispute.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {HandlerParent} from '../handlers/HandlerParent.t.sol';
contract PropertyDispute is HandlerParent {
/// @custom:property-id 6
/// @custom:property Disputer can always dispute a response before the finalisation, if no previous dispute has been made.
/// @custom:property-id 13
/// @custom:property Each disputeId and responseId can only be tied to one requestId
function property_disputerCanAlwaysCreateDispute(uint256 _requestIdSeed, uint256 _responseIdSeed) public {
// Pick random Response
(bytes32 _requestId, IOracle.Request memory _requestData) = _getRandomRequest(_requestIdSeed);
Expand All @@ -30,16 +28,18 @@ contract PropertyDispute is HandlerParent {
// check if no previous dispute
assertEq(_ghost_disputes[_requestId].length, 0, 'property 6: new dispute duplicate');

// check the disputeId isn't tied to another requestId
// property 13
assertEq(_ghost_disputeData[_disputeId].requestId, bytes32(0), 'Property 13: disputeId tied to another requestId');

// add to ghost disputes
_ghost_disputes[_responseId].push(_disputeId);
_ghost_disputes[_requestId].push(_disputeId);
_ghost_disputeData[_disputeId] = _disputeData;
} catch {
// check that there was a previous dispute, or...?
assertTrue(_ghost_disputes[_responseId].length > 0, 'property 6: fails but no previous active dispute');
// check that there was a previous dispute, or
// outside of the dispute window, or
//
assertTrue(
_ghost_disputes[_responseId].length > 0
0xJabberwock marked this conversation as resolved.
Show resolved Hide resolved
|| block.timestamp > oracle.responseCreatedAt(_responseId) + RESPONSE_DISPUTE_WINDOW,
'property 6: fails but no previous active dispute'
);
}
}

Expand Down
2 changes: 0 additions & 2 deletions test/invariants/properties/PropertyProposer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ contract PropertyProposer is HandlerParent {
(bytes32 requestId, IOracle.Request memory requestData) = _getRandomRequest(_requestIdSeed);
if (requestId == bytes32(0) || !_ghost_validRequests[requestId]) return;

// address proposer = _pickActor(_actorSeed);

// Build response data
IOracle.Response memory responseData = IOracle.Response(msg.sender, requestId, _response); // abi.encode(_blockNumber)?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that the caller must coincide with the proposer, should an actor be picked as the proposer, or is using msg.sender enough? _stakeGRT() and _provisionGRT() helpers do not accept actor picking currently, so I set the proposer to msg.sender.

More generally, when should an actor be picked and/or pranked instead of relying on the fuzzed unpranked msg.sender?


Expand Down
Loading