Skip to content

Commit

Permalink
Merge pull request #11 from rainprotocol/2023-07-18-tests
Browse files Browse the repository at this point in the history
2023 07 18 tests
  • Loading branch information
thedavidmeister authored Jul 20, 2023
2 parents 8f79f5a + 16525a4 commit 2ac2cd2
Show file tree
Hide file tree
Showing 22 changed files with 496 additions and 169 deletions.
56 changes: 32 additions & 24 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
GenericPoolOrderBookFlashBorrowerTest:testMinimumOutput(uint256,uint256) (runs: 5096, μ: 2315773, ~: 2319046)
GenericPoolOrderBookFlashBorrowerTest:testMinimumOutput(uint256,uint256) (runs: 5096, μ: 2315742, ~: 2319046)
GenericPoolOrderBookFlashBorrowerTest:testTakeOrdersSender() (gas: 2230881)
OrderBookAddOrderMockTest:testAddOrderSameAccountWithDifferentConfig(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address,address) (runs: 5096, μ: 3332897, ~: 3311290)
OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithDifferentConfig(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address,address) (runs: 5096, μ: 3178640, ~: 3183991)
OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithSameConfig(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 2984203, ~: 2983512)
OrderBookAddOrderMockTest:testAddOrderWithCalculationsInputsAndOutputsSucceeds(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 1552081, ~: 1543479)
OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaEmitsMetaV1(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 1561961, ~: 1553408)
OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 861676, ~: 859777)
OrderBookAddOrderMockTest:testAddOrderWithoutCalculationsReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 285903, ~: 284875)
OrderBookAddOrderMockTest:testAddOrderWithoutInputsReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 297793, ~: 295925)
OrderBookAddOrderMockTest:testAddOrderWithoutOutputsReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 298512, ~: 296468)
OrderBookAddOrderTest:testAddOrderRealNoHandleIOReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 249422, ~: 248374)
OrderBookAddOrderTest:testAddOrderRealNoSourcesReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 241014, ~: 239965)
OrderBookAddOrderTest:testAddOrderRealOneStackCalculateReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 272576, ~: 271479)
OrderBookAddOrderTest:testAddOrderRealThreeStackCalculate(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 1677570, ~: 1667344)
OrderBookAddOrderTest:testAddOrderRealTwoStackCalculateReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 1671739, ~: 1661513)
OrderBookAddOrderTest:testAddOrderRealZeroStackCalculateReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 268146, ~: 267050)
LibOrderTest:testHashEqual((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[])) (runs: 5096, μ: 194389, ~: 191140)
LibOrderTest:testHashNotEqual((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),(address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[])) (runs: 5096, μ: 298734, ~: 298554)
OrderBookAddOrderMockTest:testAddOrderSameAccountWithDifferentConfig(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address,address) (runs: 5096, μ: 3327619, ~: 3300143)
OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithDifferentConfig(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address,address) (runs: 5096, μ: 3171805, ~: 3178905)
OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithSameConfig(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 2973414, ~: 2969001)
OrderBookAddOrderMockTest:testAddOrderWithCalculationsInputsAndOutputsSucceeds(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 1553370, ~: 1544769)
OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaEmitsMetaV1(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 1563247, ~: 1554684)
OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 863899, ~: 862000)
OrderBookAddOrderMockTest:testAddOrderWithoutCalculationsReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 288136, ~: 287123)
OrderBookAddOrderMockTest:testAddOrderWithoutInputsReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 300009, ~: 298141)
OrderBookAddOrderMockTest:testAddOrderWithoutOutputsReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 300728, ~: 298684)
OrderBookAddOrderTest:testAddOrderRealNoHandleIOReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 247907, ~: 247005)
OrderBookAddOrderTest:testAddOrderRealNoSourcesReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 239466, ~: 238574)
OrderBookAddOrderTest:testAddOrderRealOneStackCalculateReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 271077, ~: 270308)
OrderBookAddOrderTest:testAddOrderRealThreeStackCalculate(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 1675201, ~: 1668189)
OrderBookAddOrderTest:testAddOrderRealTwoStackCalculateReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 1669370, ~: 1662358)
OrderBookAddOrderTest:testAddOrderRealZeroStackCalculateReverts(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes)) (runs: 5096, μ: 266647, ~: 265877)
OrderBookDepositTest:testDepositEvent(address,uint256,uint256) (runs: 5096, μ: 38710, ~: 38710)
OrderBookDepositTest:testDepositFail(address,uint256,uint256) (runs: 5096, μ: 8937393460516740785, ~: 8937393460516740786)
OrderBookDepositTest:testDepositFail(address,uint256,uint256) (runs: 5096, μ: 8937393460516740741, ~: 8937393460516740727)
OrderBookDepositTest:testDepositGas00() (gas: 8176)
OrderBookDepositTest:testDepositGas01() (gas: 34620)
OrderBookDepositTest:testDepositMany((address,address,uint256,uint248)[]) (runs: 5096, μ: 5023411, ~: 4663258)
OrderBookDepositTest:testDepositMany((address,address,uint256,uint248)[]) (runs: 5096, μ: 5464154, ~: 5358203)
OrderBookDepositTest:testDepositOverflow(address,uint256,uint256,uint256) (runs: 5096, μ: 46645, ~: 46645)
OrderBookDepositTest:testDepositReentrancy(address,uint256,uint256,address,uint256,uint256) (runs: 5096, μ: 495175, ~: 496632)
OrderBookDepositTest:testDepositReentrancy(address,uint256,uint256,address,uint256,uint256) (runs: 5096, μ: 494421, ~: 496632)
OrderBookDepositTest:testDepositSimple(address,uint256,uint256) (runs: 5096, μ: 37840, ~: 37840)
OrderBookDepositTest:testDepositZero(address,uint256) (runs: 5096, μ: 12639, ~: 12639)
OrderBookDepositTest:testVaultBalanceNoDeposits(address,uint256) (runs: 5096, μ: 8263, ~: 8263)
OrderBookDepositTest:testVaultBalanceReentrant(address,uint256,uint256,address,address,uint256) (runs: 5096, μ: 494155, ~: 495964)
OrderBookDepositTest:testVaultBalanceReentrant(address,uint256,uint256,address,address,uint256) (runs: 5096, μ: 493269, ~: 495964)
OrderBookRemoveOrderMockTest:testRemoveOrderAddRemoveMulti(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 7852729, ~: 7760163)
OrderBookRemoveOrderMockTest:testRemoveOrderDifferent(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 5595387, ~: 5533281)
OrderBookRemoveOrderMockTest:testRemoveOrderDifferentOwners(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 5323719, ~: 5284644)
OrderBookRemoveOrderMockTest:testRemoveOrderDifferentOwnersDifferent(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 11257905, ~: 11141262)
OrderBookRemoveOrderMockTest:testRemoveOrderDoesNotExist(address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 451197, ~: 448009)
OrderBookRemoveOrderMockTest:testRemoveOrderOnlyOwner(address,address,((address,uint8,uint256)[],(address,uint8,uint256)[],(address,bytes[],uint256[]),bytes),address) (runs: 5096, μ: 2868562, ~: 2850555)
OrderBookWithdrawTest:testWithdrawEmptyVault(address,address,uint256,uint256) (runs: 5096, μ: 15251, ~: 15251)
OrderBookWithdrawTest:testWithdrawFailure(address,uint256,uint256,uint256) (runs: 5096, μ: 8937393460516719508, ~: 8937393460516700411)
OrderBookWithdrawTest:testWithdrawFullVault(address,uint256,uint256,uint256) (runs: 5096, μ: 41245, ~: 41244)
OrderBookWithdrawTest:testWithdrawMany((bool,address,address,uint256,uint248)[]) (runs: 5096, μ: 1392625, ~: 1325216)
OrderBookWithdrawTest:testWithdrawFailure(address,uint256,uint256,uint256) (runs: 5096, μ: 8937393460516719412, ~: 8937393460516700411)
OrderBookWithdrawTest:testWithdrawFullVault(address,uint256,uint256,uint256) (runs: 5096, μ: 41228, ~: 41225)
OrderBookWithdrawTest:testWithdrawMany((bool,address,address,uint256,uint248)[]) (runs: 5096, μ: 1429599, ~: 1390000)
OrderBookWithdrawTest:testWithdrawPartialVault(address,uint256,uint256,uint256) (runs: 5096, μ: 51914, ~: 51914)
OrderBookWithdrawTest:testWithdrawReentrant(address,uint256,uint256,address,address,uint256) (runs: 5096, μ: 506222, ~: 507991)
OrderBookWithdrawTest:testWithdrawReentrant(address,uint256,uint256,address,address,uint256) (runs: 5096, μ: 505472, ~: 507991)
OrderBookWithdrawTest:testWithdrawZero(address,address,uint256) (runs: 5096, μ: 12809, ~: 12809)
4 changes: 2 additions & 2 deletions .github/workflows/ci-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
uses: DeterminateSystems/nix-installer-action@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
# https://github.com/foundry-rs/foundry/issues/3440#issuecomment-1641853058
version: nightly-cc5637a979050c39b3d06bc4cc6134f0591ee8d0
- name: Install rain
run: nix profile install github:rainprotocol/rain.cli
- run: rain --version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
# https://github.com/foundry-rs/foundry/issues/3440#issuecomment-1641853058
version: nightly-cc5637a979050c39b3d06bc4cc6134f0591ee8d0
- name: Generate docs
run: forge doc -b
- name: Deploy to GitHub Pages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: QAKit Slither Analysis
name: Slither Analysis
on: [push]
jobs:
analyze:
slither-analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -10,7 +10,8 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
# https://github.com/foundry-rs/foundry/issues/3440#issuecomment-1641853058
version: nightly-cc5637a979050c39b3d06bc4cc6134f0591ee8d0
- name: Use Node.js
uses: actions/setup-node@v3

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Gas snapshot

on: [push]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Gas snapshot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
# https://github.com/foundry-rs/foundry/issues/3440#issuecomment-1641853058
version: nightly-cc5637a979050c39b3d06bc4cc6134f0591ee8d0

- name: Check gas snapshots
run: forge snapshot --check
id: snapshot
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: QAKit test
name: Tests

on: [push]

Expand All @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: true

name: QAKit Tests
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -20,7 +20,8 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
# https://github.com/foundry-rs/foundry/issues/3440#issuecomment-1641853058
version: nightly-cc5637a979050c39b3d06bc4cc6134f0591ee8d0

- name: Run Forge fmt
run: forge fmt --check
Expand All @@ -32,8 +33,4 @@ jobs:

- name: Run Forge tests
run: forge test -vvv --gas-report
id: test

- name: Check gas snapshots
run: forge snapshot --check
id: snapshot
id: test
24 changes: 15 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
[submodule "lib/rain.math.fixedpoint"]
path = lib/rain.math.fixedpoint
url = https://github.com/rainprotocol/rain.math.fixedpoint
[submodule "lib/rain.factory"]
path = lib/rain.factory
url = https://github.com/rainprotocol/rain.factory
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/rain.interpreter"]
path = lib/rain.interpreter
url = https://github.com/rainprotocol/rain.interpreter
[submodule "lib/rain.metadata"]
path = lib/rain.metadata
url = https://github.com/rainprotocol/rain.metadata
[submodule "lib/rain.erc1820"]
path = lib/rain.erc1820
url = https://github.com/rainprotocol/rain.erc1820
[submodule "lib/rain.interpreter"]
path = lib/rain.interpreter
url = https://github.com/rainprotocol/rain.interpreter
[submodule "lib/rain.factory"]
path = lib/rain.factory
url = https://github.com/rainprotocol/rain.factory
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/rain.lib.memkv"]
path = lib/rain.lib.memkv
url = https://github.com/rainprotocol/rain.lib.memkv
[submodule "lib/rain.datacontract"]
path = lib/rain.datacontract
url = https://github.com/rainprotocol/rain.datacontract
1 change: 1 addition & 0 deletions lib/rain.datacontract
Submodule rain.datacontract added at 723bc2
2 changes: 1 addition & 1 deletion lib/rain.factory
2 changes: 1 addition & 1 deletion lib/rain.interpreter
1 change: 1 addition & 0 deletions lib/rain.lib.memkv
Submodule rain.lib.memkv added at 818f26
Loading

0 comments on commit 2ac2cd2

Please sign in to comment.