Improved bounty tests. (#1350)
* Improved bounty tests. * Fixed linter errors. * Addressed review comments.
This commit is contained in:
committed by
Francisco Giordano
parent
5fdeaa81d5
commit
ae109f69cc
@ -5,14 +5,24 @@ pragma solidity ^0.4.24;
|
||||
// solium-disable-next-line max-len
|
||||
import {BreakInvariantBounty, Target} from "../bounties/BreakInvariantBounty.sol";
|
||||
|
||||
contract SecureInvariantTargetMock is Target {
|
||||
function checkInvariant() public returns(bool) {
|
||||
contract TargetMock is Target {
|
||||
bool private exploited;
|
||||
|
||||
function exploitVulnerability() public {
|
||||
exploited = true;
|
||||
}
|
||||
|
||||
function checkInvariant() public returns (bool) {
|
||||
if (exploited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
contract SecureInvariantTargetBounty is BreakInvariantBounty {
|
||||
contract BreakInvariantBountyMock is BreakInvariantBounty {
|
||||
function _deployContract() internal returns (address) {
|
||||
return new SecureInvariantTargetMock();
|
||||
return new TargetMock();
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
// When this line is split, truffle parsing fails.
|
||||
// See: https://github.com/ethereum/solidity/issues/4871
|
||||
// solium-disable-next-line max-len
|
||||
import {BreakInvariantBounty, Target} from "../bounties/BreakInvariantBounty.sol";
|
||||
|
||||
contract InsecureInvariantTargetMock is Target {
|
||||
function checkInvariant() public returns(bool) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
contract InsecureInvariantTargetBounty is BreakInvariantBounty {
|
||||
function _deployContract() internal returns (address) {
|
||||
return new InsecureInvariantTargetMock();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user