Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #305 from AstariaXYZ/c4/changes
Browse files Browse the repository at this point in the history
C4/changes
  • Loading branch information
androolloyd authored Feb 22, 2023
2 parents f4be950 + 59675de commit 9166b91
Show file tree
Hide file tree
Showing 48 changed files with 2,524 additions and 1,315 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
submodules: recursive
token: ${{ secrets.MY_REPO_PAT }}

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn
- uses: onbjerg/foundry-toolchain@v1
with:
Expand Down
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
path = lib/gpl
url = https://github.com/AstariaXYZ/astaria-gpl
branch = main
[submodule "lib/clones-with-immutable-args"]
path = lib/clones-with-immutable-args
url = https://github.com/wighawag/clones-with-immutable-args
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
Expand All @@ -17,3 +14,7 @@
[submodule "lib/seaport"]
path = lib/seaport
url = https://github.com/projectopensea/seaport
[submodule "lib/create2-clones-with-immutable-args"]
path = lib/create2-clones-with-immutable-args
url = https://github.com/emo-eth/create2-clones-with-immutable-args
branch = v0.1.1
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ remappings = [
'solmate/=lib/solmate/src/',
'gpl/=lib/gpl/src/',
'clones-with-immutable-args/=lib/clones-with-immutable-args/src/',
'create2-clones-with-immutable-args/=lib/create2-clones-with-immutable-args/src/',
'create2-helpers/=lib/create2-clones-with-immutable-args/lib/create2-helpers/src/',
'core/=./src/',
'seaport/=lib/seaport/contracts',
]
Expand Down
1 change: 0 additions & 1 deletion lib/clones-with-immutable-args
Submodule clones-with-immutable-args deleted from 96f785
1 change: 1 addition & 0 deletions lib/create2-clones-with-immutable-args
2 changes: 1 addition & 1 deletion lib/gpl
Submodule gpl updated from 4b49fe to 40ad6a
2 changes: 1 addition & 1 deletion lib/seaport
Submodule seaport updated 70 files
+1 −20 .github/workflows/test.yml
+1 −8 .gitignore
+1 −1 .prettierrc.js
+0 −3 config/.solcover-reference.js
+0 −3 config/.solcover.js
+0 −8 contracts/interfaces/AbridgedTokenInterfaces.sol
+0 −5 contracts/interfaces/ConsiderationInterface.sol
+0 −43 contracts/interfaces/ContractOffererInterface.sol
+0 −5 contracts/interfaces/SeaportInterface.sol
+2 −4 contracts/lib/AmountDeriver.sol
+6 −10 contracts/lib/Assertions.sol
+20 −22 contracts/lib/BasicOrderFulfiller.sol
+2 −11 contracts/lib/Consideration.sol
+5 −23 contracts/lib/ConsiderationBase.sol
+59 −483 contracts/lib/ConsiderationConstants.sol
+1 −4 contracts/lib/ConsiderationEnums.sol
+0 −299 contracts/lib/ConsiderationErrors.sol
+8 −8 contracts/lib/CriteriaResolution.sol
+7 −18 contracts/lib/Executor.sol
+35 −28 contracts/lib/FulfillmentApplier.sol
+13 −14 contracts/lib/GettersAndDerivers.sol
+0 −42 contracts/lib/LowLevelHelpers.sol
+66 −121 contracts/lib/OrderCombiner.sol
+9 −16 contracts/lib/OrderFulfiller.sol
+40 −355 contracts/lib/OrderValidator.sol
+2 −2 contracts/lib/ReentrancyGuard.sol
+12 −22 contracts/lib/SignatureVerification.sol
+38 −52 contracts/lib/TokenTransferrer.sol
+37 −48 contracts/lib/TokenTransferrerConstants.sol
+15 −96 contracts/lib/Verifiers.sol
+20 −68 contracts/lib/ZoneInteraction.sol
+0 −250 contracts/test/TestContractOfferer.sol
+0 −68 contracts/test/TestPostExecution.sol
+0 −35 eip-712-types/bulkOrder.js
+9 −27 foundry.toml
+1 −1 hardhat-coverage.config.ts
+2 −10 hardhat.config.ts
+1 −1 lib/forge-std
+0 −46 offerers/TestPoolFactory.sol
+0 −340 offerers/TestPoolOfferer.sol
+0 −560 offerers/test/TestPoolOfferer.t.sol
+0 −45,910 package-lock.json
+3 −14 package.json
+0 −9 reference/ReferenceConsideration.sol
+23 −24 reference/lib/ReferenceBasicOrderFulfiller.sol
+0 −17 reference/lib/ReferenceConsiderationBase.sol
+69 −105 reference/lib/ReferenceOrderCombiner.sol
+6 −13 reference/lib/ReferenceOrderFulfiller.sol
+34 −298 reference/lib/ReferenceOrderValidator.sol
+0 −59 reference/lib/ReferenceVerifiers.sol
+2 −4 reference/lib/ReferenceZoneInteraction.sol
+0 −2 reference/shim/Shim.sol
+5 −7 remappings.txt
+0 −1,736 test/advanced.spec.ts
+1 −151 test/basic.spec.ts
+1 −1 test/foundry/GetterTests.t.sol
+0 −535 test/foundry/offerers/TestPoolOfferrer.t.sol
+1 −1 test/foundry/utils/BaseConsiderationTest.sol
+2 −2 test/utils/contracts.ts
+0 −128 test/utils/eip712/Eip712MerkleTree.ts
+0 −45 test/utils/eip712/bulk-orders.ts
+0 −46 test/utils/eip712/code-gen.ts
+0 −113 test/utils/eip712/defaults.ts
+0 −239 test/utils/eip712/eip712-merkle.ts
+0 −54 test/utils/eip712/utils.ts
+0 −4 test/utils/fixtures/index.ts
+2 −60 test/utils/fixtures/marketplace.ts
+0 −4 test/utils/types.ts
+10 −6 test/zone.spec.ts
+1,893 −816 yarn.lock
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"lint": "eslint src/**/*.sol",
"lint:fix": "prettier --write src/**/*.sol",
"lint:fix": "prettier --write src/**/*.sol src/*.sol",
"postinstall": "husky install"
},
"lint-staged": {
Expand Down
2 changes: 2 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
clones-with-immutable-args/=lib/clones-with-immutable-args/src/
create2-clones-with-immutable-args/=lib/create2-clones-with-immutable-args/src/
create2-helpers/=lib/create2-clones-with-immutable-args/lib/create2-helpers/src/
forge-std/=lib/forge-std/src/
eip4626/=lib/foundry_eip-4626/src/
gpl/=lib/gpl/src/
Expand Down
48 changes: 48 additions & 0 deletions scripts/coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import json
import subprocess

coverage_contracts = ["IAstariaRouter", "ClearingHouse", "ICollateralToken", "ILienToken", "IPublicVault", "IVaultImplementation", "WithdrawProxy"]
excluded_parent_contracts = ["AuthInitializable", "Initializable", "AmountDeriver", "Clone", "IERC1155", "IERC721Receiver", "ERC721", "ZoneInterface", "IERC4626"]

tests = subprocess.run(["forge", "test", "--ffi", "--no-match-contract", "ForkedTest", "-vvvvv"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

with open("coverage.txt", "w") as file:
pass

excluded_parent_fns = []
for contract in excluded_parent_contracts:
with open("out/" + contract + ".sol/" + contract + ".json") as file:
abi = json.load(file)
for fn in abi["methodIdentifiers"].keys():
excluded_parent_fns.append(fn.split("(")[0])\

# remove duplicates
excluded_parent_fns = list(dict.fromkeys(excluded_parent_fns))

for contract in coverage_contracts:
with open("out/" + contract + ".sol/" + contract + ".json") as file:
abi = json.load(file)
covered_fns = abi["methodIdentifiers"]
coverage = len(covered_fns)
excluded_fns = 0
uncovered_fns = []
for fn in covered_fns.keys():
fn_name = fn.split("(")[0]
if fn_name in excluded_parent_fns or fn_name.startswith("get") or fn_name.startswith("is") or fn_name == fn_name.upper():
excluded_fns += 1
elif fn_name not in tests.stdout.decode("utf-8"):
uncovered_fns.append(fn_name)
coverage -= 1
# store the contents of uncovered_fns in a text file
with open("coverage.txt", "a") as file:
file.write("\n" + contract + ": ")
for fn_name in uncovered_fns:
file.write(fn_name + ", ")
print(contract + ": " + str(coverage - excluded_fns) + "/" + str(len(covered_fns) - excluded_fns))







Loading

0 comments on commit 9166b91

Please sign in to comment.