-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: integration test #36
Merged
Merged
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
7a79a49
ci: integration tests
fadeev ad743ba
permissions
fadeev 74cef4f
fix: PRIVATE_KEY
fadeev 58555cb
fix: balances should throw an error if no pk
fadeev 15b8495
omnichain Swap && compile
fadeev 665ecc0
compile without typechain
fadeev 7c5be43
ls
fadeev c3f906d
remove deploy and interact from hardhat config
fadeev b24d2a6
set -e
fadeev 57af295
fix: PRIVATE_KEY
fadeev c313d8d
npx hardhat compile --force --no-typechain
fadeev 00ffe2b
yarn build
fadeev 3204374
deploy and interact
fadeev 46b71ac
hardhat account --save
fadeev 27a2598
hardhat messaging
fadeev af59dbe
git reset --hard HEAD
fadeev caecbe2
fees
fadeev 5453436
Build & Integration
fadeev 2279ae0
Merge branch 'main' into ci/integration
fadeev 604eb0d
deploy
fadeev 72e3c15
deploy: output JSON
fadeev 4d09914
deploy: formatting
fadeev fcff252
add jq
fadeev 1fcade5
store contract address in a variable
fadeev 0a2d4e2
to testing in a separate dir
fadeev 49e7970
import system contract to make yarn build working again
fadeev eeff30d
typechain
fadeev d85be4c
deploy
fadeev 091d16c
deploy
fadeev 2e66bd5
add interact
fadeev ce1941c
interact
fadeev 1ecbbc4
whitespace
fadeev abd1a4e
Merge branch 'main' into ci/integration
fadeev 425da52
merge main
fadeev 68553f9
npx hardhat cctx
fadeev db5a781
json
fadeev f40129b
json
fadeev d73c284
cctx
fadeev 298d166
exit code 1 if cctx failed
fadeev c0f3c17
test success and fail
fadeev fe20443
fix tx var
fadeev c73e65f
messaging template, added json flag
fadeev 64648fe
json flag
fadeev af257d7
Revert to fe204438c769e8128ebc2fdd29c847256ac2a80d
fadeev d21457b
merge main
fadeev 98ef3e9
fix
fadeev 31f1819
deploy CCM
fadeev 1e7c60b
CCM integration
fadeev 7041cfc
json flag
fadeev 662fe48
ccm fee fix
fadeev acde645
echo ccm fee
fadeev 5d4f63a
remove jq
fadeev 063f69b
remove extra print in ccm interact
fadeev 3b75041
set fee to 3 ZETA
fadeev cba6c7c
debug
fadeev 6f3295a
use calculated ccm fee
fadeev fb9ef73
integration label
fadeev 32c3852
remove integration label
fadeev 720861c
skip integration if in draft
fadeev b77206a
integration label
fadeev 8dc554c
labeled
fadeev 95c59d5
manual dispatch
fadeev 283bf51
ci
fadeev 2f47270
pr target
fadeev 2a0957e
ready for review
fadeev 2855505
cancel if drafted
fadeev 2d99c65
revert
fadeev e9910ae
nightly
fadeev 950f492
cctx: remove dependency on HRE
fadeev afa3548
lint
fadeev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # Runs every day at midnight | ||
workflow_dispatch: | ||
|
||
jobs: | ||
integration: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install jq | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y jq | ||
|
||
- name: Install dependencies | ||
run: | | ||
yarn | ||
yarn link | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Integration | ||
run: ./scripts/integration.sh | ||
env: | ||
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} |
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,90 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
git clone https://github.com/zeta-chain/template | ||
|
||
cd template | ||
|
||
yarn | ||
|
||
yarn link @zetachain/toolkit | ||
|
||
npx hardhat balances | ||
|
||
npx hardhat fees | ||
|
||
npx hardhat account --save | ||
|
||
if [[ ! -f .env ]]; then | ||
echo ".env file was not created." | ||
exit 1 | ||
fi | ||
|
||
if grep -E "^PRIVATE_KEY=[a-fA-F0-9]{64}$" .env; then | ||
echo "The .env file contains a valid PRIVATE_KEY entry without the 0x prefix." | ||
rm .env | ||
else | ||
echo "The .env file doesn't contain a valid PRIVATE_KEY entry or it contains the 0x prefix." | ||
exit 1 | ||
fi | ||
|
||
echo "TESTING OMNICHAIN CONTRACT" | ||
|
||
git reset --hard HEAD | ||
npx hardhat omnichain Swap targetZRC20:address recipient minAmountOut:uint256 | ||
npx hardhat compile --force --no-typechain | ||
|
||
OMNICHAIN_CONTRACT=$(npx hardhat deploy --network zeta_testnet --json | jq -r '.address') | ||
|
||
echo "Deployed omnichain contract address: $OMNICHAIN_CONTRACT" | ||
|
||
echo "TESTING TRANSACTION THAT SHOULD SUCCEED" | ||
|
||
OMNICHAIN_TX_SHOULD_SUCCEED=$(npx hardhat interact --contract $OMNICHAIN_CONTRACT --network goerli_testnet --amount 0.000000000000000001 --target-z-r-c20 $OMNICHAIN_CONTRACT --recipient $OMNICHAIN_CONTRACT --min-amount-out 0 --json | jq -r '.hash') | ||
|
||
echo "TX hash: $OMNICHAIN_TX_SHOULD_SUCCEED" | ||
|
||
OMNICHAIN_CCTX_SHOULD_SUCCEED=$(npx hardhat cctx $OMNICHAIN_TX_SHOULD_SUCCEED --json) | ||
|
||
echo "CCTX: $OMNICHAIN_CCTX_SHOULD_SUCCEED" | ||
|
||
echo "TESTING TRANSACTION THAT SHOULD FAIL" | ||
|
||
OMNICHAIN_TX_SHOULD_FAIL=$(npx hardhat interact --contract 0x0000000000000000000000000000000000000000 --network goerli_testnet --amount 0.000000000000000001 --target-z-r-c20 $OMNICHAIN_CONTRACT --recipient $OMNICHAIN_CONTRACT --min-amount-out 0 --json | jq -r '.hash') | ||
|
||
echo "TX hash: $OMNICHAIN_TX_SHOULD_FAIL" | ||
|
||
npx hardhat cctx $OMNICHAIN_TX_SHOULD_FAIL --json || { | ||
exit_status=$? | ||
if [[ $exit_status -eq 0 ]]; then | ||
echo "The command was expected to fail but it succeeded." | ||
exit 1 | ||
fi | ||
} | ||
|
||
echo "TESTING CROSS-CHAIN MESSAGING" | ||
|
||
git reset --hard HEAD | ||
npx hardhat messaging CrossChainMessage message:string --fees zeta | ||
npx hardhat compile --force --no-typechain | ||
|
||
CCM_CONTRACT=$(npx hardhat deploy --networks goerli_testnet,mumbai_testnet --json | jq -r '.goerli_testnet') | ||
|
||
echo "Deployed CCM contract address: $CCM_CONTRACT" | ||
|
||
CCM_FEE=$(npx hardhat fees --json | jq -r ".feesCCM.mumbai_testnet.totalFee") | ||
|
||
echo "CCM fee: $CCM_FEE" | ||
|
||
CCM_TX_OUT=$(npx hardhat interact --network goerli_testnet --contract $CCM_CONTRACT --message "Hello World" --destination mumbai_testnet --amount $CCM_FEE --json) | ||
|
||
echo "CCM TX out: $CCM_TX_OUT" | ||
|
||
CCM_TX=$(echo $CCM_TX_OUT | jq -r '.hash') | ||
|
||
echo "CCM TX hash: $CCM_TX" | ||
|
||
CCM_CCTX=$(npx hardhat cctx $CCM_TX --json) | ||
|
||
echo "CCM CCTX: $CCM_CCTX" |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean why have
rm .env
? The reason is in this section of the test I'm testing the key generation functionality, but I don't need the actual key for the rest of the test. I'm using aPRIVATE_KEY
env variable stored in GitHub secrets, which has enough tokens (both native and ZETA) to deploy and test contracts. At some point I'll add faucet to the test, but I'll probably still keep using the evn variable, because I need native gETH, for example, which I can't get from a faucet.