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
6 changes: 3 additions & 3 deletions test/invariants/handlers/BaseHandler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ contract BaseHandler is Setup, Actors {
// Aggregators

function _totalPledgesFor(bytes32 _disputeId) internal view returns (uint256) {
return _aggregateSum(_ghost_pledgesFor, _disputeId);
return _reduceSum(_ghost_pledgesFor, _disputeId);
}

function _totalPledgesAgainst(bytes32 _disputeId) internal view returns (uint256) {
return _aggregateSum(_ghost_pledgesAgainst, _disputeId);
return _reduceSum(_ghost_pledgesAgainst, _disputeId);
}

function _aggregateSum(
function _reduceSum(
mapping(address => mapping(bytes32 => uint256)) storage _data,
bytes32 _id
) internal view returns (uint256) {
Expand Down
18 changes: 12 additions & 6 deletions test/invariants/properties/PropertyDisputer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,19 @@ contract PropertyDisputer is HandlerParent {
(bytes32 _disputeId, IOracle.Dispute memory _disputeData) = _getRandomDispute(_requestId, _disputeSeed);

vm.prank(msg.sender);
try bondEscalationModule.pledgeAgainstDispute(_requestData, _disputeData) {
assertTrue(_ghost_escalatedDisputes[_disputeId], 'property 8a: pledging for a dispute not escalated');
try bondEscalationModule.pledgeForDispute(_requestData, _disputeData) {
assertTrue(
_totalPledgesFor(_disputeId) >= _totalPledgesAgainst(_disputeId), 'property 8b: pledging for the wrong side'
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the purpose of property 8b to call pledgeAgainstDispute() instead of pledgeForDispute()?

);
} catch {
// !_ghost_escalatedDisputes or
// past deadline/tying buffer or
// already pledged this turn or
//
// add tying buffer to deadline

assertTrue(
!_ghost_escalatedDisputes[_disputeId]
|| block.timestamp > oracle.disputeCreatedAt(_disputeId) + DISPUTE_DEADLINE
|| _totalPledgesFor(_disputeId) < _totalPledgesAgainst(_disputeId),
'property 8b: fails on pledging for the correct side'
);
}
}

Expand Down