paradigmxyz / artemis

A simple, modular, and fast framework for writing MEV bots in Rust.
Apache License 2.0
2.33k stars 447 forks source link

ci: auto-discover all strategies and matrix forge tests across them #50

Open sambarnes opened 1 year ago

sambarnes commented 1 year ago

:v: started studying the repo and saw that mev-share-uni-arb was not getting tested in ci

this should prevent that step in the future

tested locally with act:

act --container-architecture linux/amd64 --workflows .github/workflows/contracts.yml

Local output ``` [Solidity/Strategy list] πŸš€ Start image=ghcr.io/catthehacker/ubuntu:act-latest [Solidity/Strategy list] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 username= forcePull=false [Solidity/Strategy list] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Solidity/Strategy list] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Solidity/Strategy list] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [Solidity/Strategy list] 🐳 docker cp src=/Users/sam/dev/artemis/. dst=/Users/sam/dev/artemis [Solidity/Strategy list] 🐳 docker exec cmd=[mkdir -p /Users/sam/dev/artemis] user= workdir= [Solidity/Strategy list] ⭐ Run actions/checkout@v2 [Solidity/Strategy list] βœ… Success - actions/checkout@v2 [Solidity/Strategy list] ⭐ Run echo "::set-output name=matrix::$(ls ./crates/strategies | jq -R -s -c 'split("\n")[:-1]')" [Solidity/Strategy list] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/set-matrix] user= workdir= [Solidity/Strategy list] βš™ ::set-output:: matrix=["mev-share-uni-arb","opensea-sudo-arb"] [Solidity/Strategy list] βœ… Success - echo "::set-output name=matrix::$(ls ./crates/strategies | jq -R -s -c 'split("\n")[:-1]')" [Solidity/tests-2 ] πŸ§ͺ Matrix: map[target:opensea-sudo-arb] [Solidity/tests-2 ] πŸš€ Start image=ghcr.io/catthehacker/ubuntu:act-latest [Solidity/tests-1 ] πŸ§ͺ Matrix: map[target:mev-share-uni-arb] [Solidity/tests-1 ] πŸš€ Start image=ghcr.io/catthehacker/ubuntu:act-latest [Solidity/tests-1 ] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 username= forcePull=false [Solidity/tests-2 ] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 username= forcePull=false [Solidity/tests-2 ] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Solidity/tests-1 ] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Solidity/tests-2 ] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Solidity/tests-1 ] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Solidity/tests-2 ] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [Solidity/tests-1 ] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [Solidity/tests-2 ] 🐳 docker cp src=/Users/sam/dev/artemis/. dst=/Users/sam/dev/artemis [Solidity/tests-2 ] 🐳 docker exec cmd=[mkdir -p /Users/sam/dev/artemis] user= workdir= [Solidity/tests-1 ] 🐳 docker cp src=/Users/sam/dev/artemis/. dst=/Users/sam/dev/artemis [Solidity/tests-1 ] 🐳 docker exec cmd=[mkdir -p /Users/sam/dev/artemis] user= workdir= [Solidity/tests-2 ] ⭐ Run actions/checkout@v2 [Solidity/tests-2 ] βœ… Success - actions/checkout@v2 [Solidity/tests-1 ] ⭐ Run actions/checkout@v2 [Solidity/tests-1 ] βœ… Success - actions/checkout@v2 [Solidity/tests-2 ] ⭐ Run Install Foundry [Solidity/tests-2 ] ☁ git clone 'https://github.com/onbjerg/foundry-toolchain' # ref=v1 [Solidity/tests-1 ] ⭐ Run Install Foundry [Solidity/tests-1 ] ☁ git clone 'https://github.com/onbjerg/foundry-toolchain' # ref=v1 [Solidity/tests-2 ] 🐳 docker cp src=/Users/sam/.cache/act/onbjerg-foundry-toolchain@v1/ dst=/var/run/act/actions/onbjerg-foundry-toolchain@v1/ [Solidity/tests-2 ] 🐳 docker exec cmd=[mkdir -p /var/run/act/actions/onbjerg-foundry-toolchain@v1/] user= workdir= [Solidity/tests-1 ] 🐳 docker cp src=/Users/sam/.cache/act/onbjerg-foundry-toolchain@v1/ dst=/var/run/act/actions/onbjerg-foundry-toolchain@v1/ [Solidity/tests-1 ] 🐳 docker exec cmd=[mkdir -p /var/run/act/actions/onbjerg-foundry-toolchain@v1/] user= workdir= [Solidity/tests-2 ] 🐳 docker exec cmd=[node /var/run/act/actions/onbjerg-foundry-toolchain@v1/dist/index.js] user= workdir= [Solidity/tests-1 ] 🐳 docker exec cmd=[node /var/run/act/actions/onbjerg-foundry-toolchain@v1/dist/index.js] user= workdir= | Downloading Foundry 'nightly' from: https://github.com/foundry-rs/foundry/releases/download/nightly/foundry_nightly_linux_amd64.tar.gz [Solidity/tests-2 ] πŸ’¬ ::debug::Downloading https://github.com/foundry-rs/foundry/releases/download/nightly/foundry_nightly_linux_amd64.tar.gz [Solidity/tests-2 ] πŸ’¬ ::debug::Destination /tmp/d4fabce3-ee14-419d-99ff-8009e30a83eb | Downloading Foundry 'nightly' from: https://github.com/foundry-rs/foundry/releases/download/nightly/foundry_nightly_linux_amd64.tar.gz [Solidity/tests-1 ] πŸ’¬ ::debug::Downloading https://github.com/foundry-rs/foundry/releases/download/nightly/foundry_nightly_linux_amd64.tar.gz [Solidity/tests-1 ] πŸ’¬ ::debug::Destination /tmp/8040b3de-742f-4e6a-9f02-eefe023ed7fe [Solidity/tests-1 ] πŸ’¬ ::debug::download complete [Solidity/tests-1 ] πŸ’¬ ::debug::Extracting /tmp/8040b3de-742f-4e6a-9f02-eefe023ed7fe [Solidity/tests-1 ] πŸ’¬ ::debug::Checking tar --version [Solidity/tests-1 ] πŸ’¬ ::debug::tar (GNU tar) 1.34%0ACopyright (C) 2021 Free Software Foundation, Inc.%0ALicense GPLv3+: GNU GPL version 3 or later .%0AThis is free software: you are free to change and redistribute it.%0AThere is NO WARRANTY, to the extent permitted by law.%0A%0AWritten by John Gilmore and Jay Fenlason. | [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/c1873a17-2b87-4110-a498-6f9de8f1f33a -f /tmp/8040b3de-742f-4e6a-9f02-eefe023ed7fe [Solidity/tests-2 ] πŸ’¬ ::debug::download complete [Solidity/tests-2 ] πŸ’¬ ::debug::Extracting /tmp/d4fabce3-ee14-419d-99ff-8009e30a83eb [Solidity/tests-2 ] πŸ’¬ ::debug::Checking tar --version [Solidity/tests-2 ] πŸ’¬ ::debug::tar (GNU tar) 1.34%0ACopyright (C) 2021 Free Software Foundation, Inc.%0ALicense GPLv3+: GNU GPL version 3 or later .%0AThis is free software: you are free to change and redistribute it.%0AThere is NO WARRANTY, to the extent permitted by law.%0A%0AWritten by John Gilmore and Jay Fenlason. | [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/086c1522-b1dc-4fb9-abe1-0e0634ae9561 -f /tmp/d4fabce3-ee14-419d-99ff-8009e30a83eb [Solidity/tests-1 ] πŸ’¬ ::debug::Resolved Keys: [Solidity/tests-1 ] πŸ’¬ ::debug::["linux-foundry-chain-fork-88fb49346eb32b983fab9c7a035436ffc603a8d7","linux-foundry-chain-fork-"] [Solidity/tests-1 ] πŸ’¬ ::debug::Checking zstd --version [Solidity/tests-1 ] πŸ’¬ ::debug::*** zstd command line interface 64-bits v1.4.8, by Yann Collet *** [Solidity/tests-1 ] πŸ’¬ ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache. [Solidity/tests-2 ] πŸ’¬ ::debug::Resolved Keys: [Solidity/tests-2 ] πŸ’¬ ::debug::["linux-foundry-chain-fork-88fb49346eb32b983fab9c7a035436ffc603a8d7","linux-foundry-chain-fork-"] [Solidity/tests-2 ] πŸ’¬ ::debug::Checking zstd --version [Solidity/tests-2 ] πŸ’¬ ::debug::*** zstd command line interface 64-bits v1.4.8, by Yann Collet *** [Solidity/tests-2 ] πŸ’¬ ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache. [Solidity/tests-1 ] πŸ’¬ ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache. [Solidity/tests-2 ] πŸ’¬ ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache. [Solidity/tests-1 ] 🚧 ::warning::Failed to restore: getCacheEntry failed: Cache Service Url not found, unable to restore cache. [Solidity/tests-1 ] πŸ’¬ ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink '' [Solidity/tests-1 ] βœ… Success - Install Foundry [Solidity/tests-1 ] ⭐ Run Foundry version [Solidity/tests-1 ] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir= | forge 0.2.0 (06a17bf 2023-08-19T00:14:54.453240995Z) [Solidity/tests-1 ] βœ… Success - Foundry version [Solidity/tests-1 ] ⭐ Run Run ${{ matrix.target }} tests [Solidity/tests-1 ] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir= [Solidity/tests-2 ] 🚧 ::warning::Failed to restore: getCacheEntry failed: Cache Service Url not found, unable to restore cache. [Solidity/tests-2 ] πŸ’¬ ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink '' [Solidity/tests-2 ] βœ… Success - Install Foundry [Solidity/tests-2 ] ⭐ Run Foundry version [Solidity/tests-2 ] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir= | forge 0.2.0 (06a17bf 2023-08-19T00:14:54.453240995Z) [Solidity/tests-2 ] βœ… Success - Foundry version [β ’] Compiling... [Solidity/tests-2 ] ⭐ Run Run ${{ matrix.target }} tests [Solidity/tests-2 ] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir= [β ”] Installing solc version 0.8.21 [β †] Compiling... [β ƒ] Successfully installed solc 0.8.21 [β °] Installing solc version 0.8.21 [⠘] Successfully installed solc 0.8.21 [β ”] Compiling 19 files with 0.8.21 [β ”] Solc 0.8.21 finished in 15.59s | Compiler run successful with warnings: ... | | Running 1 test for test/BlindArb.t.sol:BlindArbTest | [PASS] testArb() (gas: 255388) | Test result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.40s | Ran 1 test suites: 1 tests passed, 0 failed, 0 skipped (1 total tests) [Solidity/tests-1 ] βœ… Success - Run ${{ matrix.target }} tests [β ’] Compiling 124 files with 0.8.21 [⠊] Solc 0.8.21 finished in 65.91s | Compiler run successful! | | Running 5 tests for test/SudoOpenseaArb.t.sol:SudoOpenseaArbTest | [PASS] testFuzzTransferOwnership(address) (runs: 1024, ΞΌ: 17324, ~: 17324) | [PASS] testFuzzTransferOwnershipUnauthorized(address) (runs: 1024, ΞΌ: 15295, ~: 15295) | [PASS] testFuzzWithdraw(uint256) (runs: 1024, ΞΌ: 17953, ~: 18150) | [PASS] testFuzzWithdrawUnauthorized(address) (runs: 1024, ΞΌ: 11934, ~: 11934) | [PASS] testOwner() (gas: 9665) | Test result: ok. 5 passed; 0 failed; 0 skipped; finished in 656.60ms | | Running 2 tests for test/SudoPairQuoter.t.sol:SudoPairQuoterTest | [PASS] testCorrectSingleQuote() (gas: 38910) | [PASS] testCorrectnessMultiQuote() (gas: 50341) | Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.68s | | Running 2 tests for test/SudoOpenseaArbFork.t.sol:SudoOpenseaArbForkTest | [PASS] testArb() (gas: 475627) | [PASS] testUnprofitableArb() (gas: 476083) | Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 5.29s | Ran 3 test suites: 9 tests passed, 0 failed, 0 skipped (9 total tests) [Solidity/tests-2 ] βœ… Success - Run ${{ matrix.target }} tests ```
sambarnes commented 1 year ago

example of what itll look like in ui (on this tmp pr)

image