Skip to content

Commit

Permalink
fix: WorkedExample tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xBalbinus committed Nov 17, 2023
1 parent 28e0ccf commit a67ecc9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/CallBreakerTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ struct Call {
struct CallBalance {
bool set;
int256 balance;
}
}
2 changes: 1 addition & 1 deletion src/timetravel/CallBreaker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,4 @@ contract CallBreaker is CallBreakerStorage {
revert CallPositionFailed(callObj, index);
}
}
}
}
2 changes: 1 addition & 1 deletion test/examples/SelfCheckout.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract SelfCheckout is SmarterContract {
callvalue: abi.encodeWithSignature("checkBalance()")
});
emit LogCallObj(callObj);
assertFutureCallTo(callObj, 3);
assertFutureCallTo(callObj, 2);

balanceScheduled = true;
}
Expand Down
23 changes: 8 additions & 15 deletions test/solve-lib/WorkedExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ contract WorkedExampleLib {
}

function solverLand(uint256 laminatorSequenceNumber, address filler, uint256 x) public {
CallObject[] memory callObjs = new CallObject[](4);
ReturnObject[] memory returnObjs = new ReturnObject[](4);
erc20b.approve(address(selfcheckout), x);

CallObject[] memory callObjs = new CallObject[](3);
ReturnObject[] memory returnObjs = new ReturnObject[](3);

callObjs[0] = CallObject({
amount: 0,
Expand All @@ -84,35 +86,26 @@ contract WorkedExampleLib {

returnObjs[0] = ReturnObject({returnvalue: abi.encode(abi.encode(returnObjsFromPull))});

callObjs[1] = CallObject({
amount: 0,
addr: address(erc20b),
gas: 1000000,
callvalue: abi.encodeWithSignature("approve(address,uint256)", address(selfcheckout), x)
});
// return object is still nothing
returnObjs[1] = ReturnObject({returnvalue: abi.encode(true)});

// then we'll call giveSomeBtokenToOwner and get the imbalance back to zero
callObjs[2] = CallObject({
callObjs[1] = CallObject({
amount: 0,
addr: address(selfcheckout),
gas: 1000000,
callvalue: abi.encodeWithSignature("giveSomeBtokenToOwner(uint256)", x)
});
// return object is still nothing
returnObjs[2] = ReturnObject({returnvalue: ""});
returnObjs[1] = ReturnObject({returnvalue: ""});

// then we'll call checkBalance
callObjs[3] = CallObject({
callObjs[2] = CallObject({
amount: 0,
addr: address(selfcheckout),
gas: 1000000,
callvalue: abi.encodeWithSignature("checkBalance()")
});
// log what this callobject looks like
// return object is still nothing
returnObjs[3] = ReturnObject({returnvalue: ""});
returnObjs[2] = ReturnObject({returnvalue: ""});

// Constructing something that'll decode happily
bytes32[] memory keys = new bytes32[](5);
Expand Down

0 comments on commit a67ecc9

Please sign in to comment.