You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a feature request. Medusa fails to solve the (in)famous SimpleDSChielf example. There is a bit of history about this abstracted code from MakerDAO here. I copied the code here:
contractSimpleDSChief {
mapping(bytes32=>address) public slates;
mapping(address=>bytes32) public votes;
mapping(address=>uint256) public approvals;
mapping(address=>uint256) public deposits;
function lock(uintwad) public {
deposits[msg.sender] =add(deposits[msg.sender], wad);
addWeight(wad, votes[msg.sender]);
}
function free(uintwad) public {
deposits[msg.sender] =sub(deposits[msg.sender], wad);
subWeight(wad, votes[msg.sender]);
}
function voteYays(addressyay) publicreturns (bytes32){
bytes32 slate =etch(yay);
voteSlate(slate);
return slate;
}
function etch(addressyay) publicreturns (bytes32slate) {
bytes32 hash =keccak256(abi.encodePacked(yay));
slates[hash] = yay;
return hash;
}
function voteSlate(bytes32slate) public {
uint weight = deposits[msg.sender];
subWeight(weight, votes[msg.sender]);
votes[msg.sender] = slate;
addWeight(weight, votes[msg.sender]);
}
function addWeight(uintweight, bytes32slate) internal {
address yay = slates[slate];
approvals[yay] =add(approvals[yay], weight);
}
function subWeight(uintweight, bytes32slate) internal {
address yay = slates[slate];
approvals[yay] =sub(approvals[yay], weight);
}
function add(uintx, uinty) internalpurereturns (uintz) {
require((z = x + y) >= x);
}
function sub(uintx, uinty) internalpurereturns (uintz) {
require((z = x - y) <= x);
}
function checkAnInvariant() public {
bytes32 senderSlate = votes[msg.sender];
address option = slates[senderSlate];
uint256 senderDeposit = deposits[msg.sender];
assert(approvals[option] >= senderDeposit);
}
}
Medusa will have a lot of trouble to break the invariant since it needs some value is dynamically produced in the votesSlate function. It was the example that pushed our tools to catch these values during the testing.
This is a feature request. Medusa fails to solve the (in)famous SimpleDSChielf example. There is a bit of history about this abstracted code from MakerDAO here. I copied the code here:
To reproduce, just run:
Medusa will have a lot of trouble to break the invariant since it needs some value is dynamically produced in the votesSlate function. It was the example that pushed our tools to catch these values during the testing.
Echidna output when running the example:
The text was updated successfully, but these errors were encountered: