This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add partial ordering and reduce principal specs
- Loading branch information
Thomas b e e f y b o i Bernardi
committed
Mar 12, 2021
1 parent
fafa7d2
commit ce55315
Showing
8 changed files
with
412 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
pragma solidity ^0.8.1; | ||
pragma abicoder v2; | ||
|
||
import './StarportHarness.sol'; | ||
|
||
|
||
contract StarportHarnessOrdering is StarportHarness { | ||
constructor(ICash cash_, address admin_) StarportHarness(cash_, admin_) {} | ||
|
||
function invokeNoticeInternal(bytes calldata notice, bytes32 noticeHash) override internal returns (bytes memory) { | ||
if (isNoticeInvoked[noticeHash]) { | ||
emit NoticeReplay(noticeHash); | ||
return ""; | ||
} | ||
|
||
isNoticeInvoked[noticeHash] = true; | ||
|
||
require(notice.length >= 100, "Must have full header"); // 4 + 3 * 32 | ||
require(notice[0] == MAGIC_HEADER[0], "Invalid header[0]"); | ||
require(notice[1] == MAGIC_HEADER[1], "Invalid header[1]"); | ||
require(notice[2] == MAGIC_HEADER[2], "Invalid header[2]"); | ||
require(notice[3] == MAGIC_HEADER[3], "Invalid header[3]"); | ||
|
||
(uint noticeEraId, uint noticeEraIndex, bytes32 noticeParent) = | ||
abi.decode(notice[4:100], (uint, uint, bytes32)); | ||
|
||
noticeParent; // unused | ||
|
||
bool startNextEra = noticeEraId == eraId + 1 && noticeEraIndex == 0; | ||
|
||
require( | ||
noticeEraId <= eraId || startNextEra, | ||
"Notice must use existing era or start next era" | ||
); | ||
|
||
if (startNextEra) { | ||
eraId++; | ||
} | ||
|
||
// bytes memory calldata_ = bytes(notice[100:]); | ||
// (bool success, bytes memory callResult) = address(this).call(calldata_); | ||
// if (!success) { | ||
// require(false, _getRevertMsg(callResult)); | ||
// } | ||
|
||
// emit NoticeInvoked(uint32(noticeEraId), uint32(noticeEraIndex), noticeHash, callResult); | ||
|
||
// return callResult; | ||
|
||
return "success"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
|
||
- Run Scripts | ||
CashToken: | ||
- runCashToken.sh: specs without any summarizing | ||
- runCashHarness.sh: spects summarizing index as 1e18 and axiomatizing | ||
amountToPrincipal as monotonic | ||
Starport: | ||
- runStarportHarness.sh: specs, no summaries but harnessing needed mostly because | ||
we have arrays as arguments | ||
- runStarportHarness.sh: specs, no summaries but harnessing needed | ||
- runStarportHarnessOrdering.sh: partial ordering spec, override invokeNoticeInternal to not | ||
perform the function call since this havocs all storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
certoraRun.py contracts/StarportHarnessOrdering.sol \ | ||
spec/harnesses/ERC20.sol \ | ||
spec/harnesses/NonStandardERC20.sol \ | ||
spec/harnesses/ExcessiveERC20.sol \ | ||
contracts/CashToken.sol \ | ||
--verify StarportHarnessOrdering:spec/StarportOrdering.spec \ | ||
--solc solc8.1 --settings -t=300,-assumeUnwindCond,-b=3 \ | ||
--cache "starport-ordering" \ | ||
--cloud --msg "Starport with Harness: Notice Partial Ordering" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.