forked from aave/gho-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e59bf9
commit 239a3b8
Showing
7 changed files
with
235 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: certora-upgradeable-gho-token | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install python | ||
uses: actions/setup-python@v2 | ||
with: { python-version: 3.9 } | ||
|
||
- name: Install java | ||
uses: actions/setup-java@v1 | ||
with: { java-version: '11', java-package: jre } | ||
|
||
- name: Install certora cli | ||
run: pip install certora-cli==4.13.1 | ||
|
||
- name: Install solc | ||
run: | | ||
wget https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux | ||
chmod +x solc-static-linux | ||
sudo mv solc-static-linux /usr/local/bin/solc8.10 | ||
- name: Verify rule ${{ matrix.rule }} | ||
run: | | ||
cd certora/gho | ||
touch applyHarness.patch | ||
make munged | ||
cd ../.. | ||
echo "key length" ${#CERTORAKEY} | ||
certoraRun certora/gho/conf/${{ matrix.rule }} | ||
env: | ||
CERTORAKEY: ${{ secrets.CERTORAKEY }} | ||
|
||
strategy: | ||
fail-fast: false | ||
max-parallel: 16 | ||
matrix: | ||
rule: | ||
- verifyUpgradeableGhoToken.conf |
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,18 @@ | ||
{ | ||
"files": [ | ||
"certora/gho/harness/UpgradeableGhoTokenHarness.sol:UpgradeableGhoTokenHarness", | ||
// "certora/gho/munged/contracts/gho/GhoToken.sol" | ||
], | ||
"packages": [ | ||
"@aave/core-v3/=lib/aave-v3-core", | ||
"@aave/periphery-v3/=lib/aave-v3-periphery", | ||
"@aave/=lib/aave-token", | ||
"@openzeppelin/=lib/openzeppelin-contracts", | ||
], | ||
"loop_iter": "3", | ||
"msg": "GhoToken, all rules.", | ||
"optimistic_loop": true, | ||
"process": "emv", | ||
"solc": "solc8.10", | ||
"verify": "UpgradeableGhoTokenHarness:certora/gho/specs/ghoToken.spec" | ||
} |
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,84 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
import {IGhoToken} from '../munged/contracts/gho/interfaces/IGhoToken.sol'; | ||
import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; | ||
import {UpgradeableGhoToken} from '../munged/contracts/gho/UpgradeableGhoToken.sol'; | ||
|
||
contract UpgradeableGhoTokenHarness is UpgradeableGhoToken { | ||
using EnumerableSet for EnumerableSet.AddressSet; | ||
|
||
constructor() UpgradeableGhoToken() {} | ||
|
||
/** | ||
* @notice Returns the bucket capacity | ||
* @param facilitator The address of the facilitator | ||
* @return The facilitator bucket capacity | ||
*/ | ||
function getFacilitatorBucketCapacity(address facilitator) public view returns (uint256) { | ||
(uint256 bucketCapacity, ) = getFacilitatorBucket(facilitator); | ||
return bucketCapacity; | ||
} | ||
|
||
/** | ||
* @notice Returns the bucket level | ||
* @param facilitator The address of the facilitator | ||
* @return The facilitator bucket level | ||
*/ | ||
function getFacilitatorBucketLevel(address facilitator) public view returns (uint256) { | ||
(, uint256 bucketLevel) = getFacilitatorBucket(facilitator); | ||
return bucketLevel; | ||
} | ||
|
||
/** | ||
* @notice Returns the length of the facilitator list | ||
* @return The length of the facilitator list | ||
*/ | ||
function getFacilitatorsListLen() external view returns (uint256) { | ||
address[] memory flist = getFacilitatorsList(); | ||
return flist.length; | ||
} | ||
|
||
/** | ||
* @notice Indicator of GhoToken mapping | ||
* @param addr An address of a facilitator | ||
* @return True of facilitator is in GhoToken mapping | ||
*/ | ||
function is_in_facilitator_mapping(address addr) external view returns (bool) { | ||
Facilitator memory facilitator = _facilitators[addr]; | ||
return facilitator.isLabelNonempty; //TODO: remove workaround when CERT-977 is resolved | ||
// return (bytes(facilitator.label).length > 0); | ||
} | ||
|
||
/** | ||
* @notice Indicator of AddressSet mapping | ||
* @param addr An address of a facilitator | ||
* @return True of facilitator is in AddressSet mapping | ||
*/ | ||
function is_in_facilitator_set_map(address addr) external view returns (bool) { | ||
return _facilitatorsList.contains(addr); | ||
} | ||
|
||
/** | ||
* @notice Indicator of AddressSet list | ||
* @param addr An address of a facilitator | ||
* @return True of facilitator is in AddressSet array | ||
*/ | ||
function is_in_facilitator_set_array(address addr) external view returns (bool) { | ||
address[] memory flist = getFacilitatorsList(); | ||
for (uint256 i = 0; i < flist.length; ++i) { | ||
if (address(flist[i]) == addr) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* @notice Converts address to bytes32 | ||
* @param value Some address | ||
* @return b the value as bytes32 | ||
*/ | ||
function to_bytes32(address value) external pure returns (bytes32 b) { | ||
b = bytes32(uint256(uint160(value))); | ||
} | ||
} |
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