From 26d70e53071d5bbfcbe40ea76f99edfbd28b3a69 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:52:56 -0300 Subject: [PATCH 001/111] fix: transfer refactored to new PaymentRegistry.tranfer() version --- contracts/zksync/test/claim_payment.sh | 4 ++-- contracts/zksync/test/transfer.sh | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 5719557f..89259d53 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -4,7 +4,7 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_PUBLIC_ADDRESS) +MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) echo "Initial MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" @@ -32,7 +32,7 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ sleep 15 -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_PUBLIC_ADDRESS) +MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) echo "After MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index f880e482..28a38f68 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -7,7 +7,7 @@ printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" -MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_PUBLIC_ADDRESS) +MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) echo "Initial MM balance: $MM_INITIAL_BALANCE" echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE" @@ -16,13 +16,12 @@ echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE" echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY \ - $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, uint256, uint8)" \ - "0" "$USER_ETHEREUM_PUBLIC_ADDRESS_UINT" "1"\ + $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ + "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ --value $BRIDGE_AMOUNT_WEI >> /dev/null - -MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_PUBLIC_ADDRESS) +MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) echo "Final MM balance: $MM_FINAL_BALANCE" echo "Final Destination balance: $DESTINATION_FINAL_BALANCE" From 0eaddaa6da908d4aac114bd13e2b07f0a44ada2f Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:53:10 -0300 Subject: [PATCH 002/111] fix: added eth/.env.test missing variables --- contracts/ethereum/test/.env.test | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/contracts/ethereum/test/.env.test b/contracts/ethereum/test/.env.test index eabdc287..c3f71988 100644 --- a/contracts/ethereum/test/.env.test +++ b/contracts/ethereum/test/.env.test @@ -8,7 +8,23 @@ ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 -MM_ETHEREUM_PUBLIC_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 +MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 USER_ETHEREUM_PUBLIC_ADDRESS=0xceee57f2b700c2f37d1476a7974965e149fce2d4 #random address with no funds -USER_ETHEREUM_PUBLIC_ADDRESS_UINT=1181367337507422765615536123397692015769584198356 + + + +ZKSYNC_CLAIM_PAYMENT_SELECTOR=0xa5168739 +ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae +ZKSYNC_CHAIN_ID=300 + + +#irrelevant SN variables +STARKNET_CLAIM_PAYMENT_SELECTOR=0x03636c566f6409560d55d5f6d1eb4ee163b096b4698c503e69e210be79de2afa +STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=0x0354a01e49fe07e43306a97ed84dbd5de8238c7d8ff616caa3444630cfc559e6 +STARKNET_MESSAGING_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 +STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 + + + + From 7bde201d89716e7acf57daf50b1fd188b6826d45 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:56:30 -0300 Subject: [PATCH 003/111] fix: refactored claimPaymentZKSync to latest version --- contracts/zksync/test/claim_payment.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 89259d53..8191dafa 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -19,11 +19,11 @@ echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ - $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, uint256, uint256, uint256, uint256)" \ - "0" "$USER_ETHEREUM_PUBLIC_ADDRESS_UINT" "$BRIDGE_AMOUNT_WEI" "2000000000" "800"\ + $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ + "0" $USER_ETHEREUM_PUBLIC_ADDRESS "$BRIDGE_AMOUNT_WEI" "2000000000" "800"\ --value 5000000000000000000 -#ele pe eme + #me revertea con info: None #no estoy seguro si existe un diamond proxy en la dada address. From b627883d9d3aa7cdd52793903153c087614aa70c Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:46:34 -0300 Subject: [PATCH 004/111] fix: L1->L2 message on zksync integration test, was reading wrong env var --- contracts/ethereum/deploy.sh | 2 +- contracts/ethereum/test/.env.test | 2 +- contracts/zksync/test/claim_payment.sh | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index cf5c4184..1f98107b 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -5,8 +5,8 @@ cd contracts/ethereum printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESET}\n" - export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY +export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail diff --git a/contracts/ethereum/test/.env.test b/contracts/ethereum/test/.env.test index c3f71988..d89417ab 100644 --- a/contracts/ethereum/test/.env.test +++ b/contracts/ethereum/test/.env.test @@ -10,7 +10,7 @@ ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 -USER_ETHEREUM_PUBLIC_ADDRESS=0xceee57f2b700c2f37d1476a7974965e149fce2d4 #random address with no funds +USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 8191dafa..c848ae23 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -20,7 +20,7 @@ echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ - "0" $USER_ETHEREUM_PUBLIC_ADDRESS "$BRIDGE_AMOUNT_WEI" "2000000000" "800"\ + "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 @@ -28,10 +28,6 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ #no estoy seguro si existe un diamond proxy en la dada address. - -sleep 15 - - MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) echo "After MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" From c4dc30d8d5e6cad88a46ba6791aa429a63245165 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:47:11 -0300 Subject: [PATCH 005/111] refactor: remove old comments --- contracts/zksync/test/claim_payment.sh | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index c848ae23..5b953584 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -23,11 +23,6 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 - -#me revertea con info: None -#no estoy seguro si existe un diamond proxy en la dada address. - - MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) echo "After MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" @@ -37,12 +32,3 @@ npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WA echo "After Escrow balance:" npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" - - - -# starkli call $ESCROW_CONTRACT_ADDRESS get_order_pending u256:0 - -# ESCROW_FINAL_BALANCE=$(starkli balance $ESCROW_CONTRACT_ADDRESS) -# MM_FINAL_BALANCE=$(starkli balance $MM_SN_WALLET_ADDR) -# echo "Final Escrow balance: $ESCROW_FINAL_BALANCE" -# echo "Final MM balance: $MM_FINAL_BALANCE" From cda84ef71148e05951fe55490e162efa04ed306e Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:05:14 -0300 Subject: [PATCH 006/111] feat: add files to CI, wip CI development --- .github/workflows/zksync-integration-test.yml | 0 .github/workflows/zksync-scripts/.env.test | 10 ++++++ .../workflows/zksync-scripts/claim_payment.sh | 34 +++++++++++++++++++ .github/workflows/zksync-scripts/set_order.sh | 28 +++++++++++++++ .github/workflows/zksync-scripts/transfer.sh | 27 +++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 .github/workflows/zksync-integration-test.yml create mode 100644 .github/workflows/zksync-scripts/.env.test create mode 100755 .github/workflows/zksync-scripts/claim_payment.sh create mode 100755 .github/workflows/zksync-scripts/set_order.sh create mode 100755 .github/workflows/zksync-scripts/transfer.sh diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/zksync-scripts/.env.test b/.github/workflows/zksync-scripts/.env.test new file mode 100644 index 00000000..51d92687 --- /dev/null +++ b/.github/workflows/zksync-scripts/.env.test @@ -0,0 +1,10 @@ +TEST=true + + +WALLET_PRIVATE_KEY=0xe131bc3f481277a8f73d680d9ba404cc6f959e64296e0914dded403030d4f705 #prefunded 0 #LA SAQUE DESDE LA MNEMONIC QUE USAN PARA DEPLOYAR +MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 + +NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A + +USER_ZKSYNC_PRIVATE_ADDRESS=0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93 #prefunded 4 +USER_ZKSYNC_PUBLIC_ADDRESS=0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 #prefunded 4 diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh new file mode 100755 index 00000000..5b953584 --- /dev/null +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +. contracts/utils/colors.sh #for ANSI colors + +printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" + +MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +echo "Initial MM balance L1:" +echo "$MM_INITIAL_BALANCE_L1" + +echo "Initial MM balance L2:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" + +echo "Initial Escrow balance:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" + + +echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" +echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" + +cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ + $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ + "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ + --value 5000000000000000000 + +MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +echo "After MM balance L1:" +echo "$MM_INITIAL_BALANCE_L1" + +echo "After MM balance L2:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" + +echo "After Escrow balance:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh new file mode 100755 index 00000000..1c2c5d58 --- /dev/null +++ b/.github/workflows/zksync-scripts/set_order.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# cast call 0x97589bcE7727f5D0C8082440681DB6092b6Dda1a "getNames()(string)" --rpc-url http://localhost:8545 +# exit + +. contracts/utils/colors.sh #for ANSI colors + +FEE=10000000000000000 #in WEI +VALUE=2 #in ETH +VALUE_WEI=$(echo "scale=0; $VALUE * 10^18" | bc) +BRIDGE_AMOUNT_WEI=$(echo "scale=0; $VALUE_WEI - $FEE" | bc) +BRIDGE_AMOUNT_ETH=$(echo "scale=18; $BRIDGE_AMOUNT_WEI / 10^18" | bc) +# BRIDGE_AMOUNT_WEI=$(printf "%.0f" "$BRIDGE_AMOUNT_WEI") + + +printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" +echo "\nUser ZKSync funds before setOrder:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +echo "\nEscrow ZKSync funds before setOrder:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" + + +npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --chain "dockerized-node" --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null + + +echo "\nUser ZKSync funds after setOrder:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +echo "\nEscrow ZKSync funds after setOrder:" +npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" diff --git a/.github/workflows/zksync-scripts/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh new file mode 100755 index 00000000..28a38f68 --- /dev/null +++ b/.github/workflows/zksync-scripts/transfer.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +. contracts/utils/colors.sh #for ANSI colors + +# export DESTINATION_ADDRESS=0xceee57f2b700c2f37d1476a7974965e149fce2d4 +# export DESTINATION_ADDRESS_UINT=1181367337507422765615536123397692015769584198356 + +printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" + +MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) +echo "Initial MM balance: $MM_INITIAL_BALANCE" +echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE" + + +echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" + +cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY \ + $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ + "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ + --value $BRIDGE_AMOUNT_WEI >> /dev/null + + +MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) +echo "Final MM balance: $MM_FINAL_BALANCE" +echo "Final Destination balance: $DESTINATION_FINAL_BALANCE" From a60060f3c5018aff032b76591a14c36a0ee0c0c2 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:19:35 -0300 Subject: [PATCH 007/111] feat: zksync-integration-test.yml --- .github/workflows/zksync-integration-test.yml | 87 +++++++++++++++++++ .../zksync-scripts/.ethereum.env.test | 29 +++++++ .../{.env.test => .zksync.env.test} | 0 contracts/ethereum/test/.env.test | 1 - 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/zksync-scripts/.ethereum.env.test rename .github/workflows/zksync-scripts/{.env.test => .zksync.env.test} (100%) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index e69de29b..86c61631 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -0,0 +1,87 @@ +name: ZKSync Integration Test +on: + push: + branches: + - main + - develop + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + Test: + runs-on: ubuntu-latest + environment: Test + + steps: + - uses: actions/checkout@v4 + + + # Ethereum Setup + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Install Forge + run: | + cd contracts/ethereum + forge install + + # ZKSync Setup + - name: Install scarb + uses: software-mansion/setup-scarb@v1 + with: + scarb-version: "2.3.1" + + - name: Install starkliup + run: curl https://get.starkli.sh | sh + + - name: Install Starkli + run: | + /home/runner/.config/.starkli/bin/starkliup --version 0.1.20 + sudo mv /home/runner/.config/.starkli/bin/starkli /usr/local/bin/ + + - name: Setup Katana .env + run: | + cp .github/workflows/katana/katana.env .env + + - name: Download Katana + run: | + wget https://github.com/dojoengine/dojo/releases/download/v0.4.4/dojo_v0.4.4_linux_amd64.tar.gz + tar -xzvf dojo_v0.4.4_linux_amd64.tar.gz + rm sozo torii dojo-language-server + + # Run Dockerized L1-L2 + - name: Setup Dockerized L1-L2 + run: | + git clone https://github.com/matter-labs/local-setup.git + cd local-setup + ./start.sh + +# # Build Ethereum Contract +# - name: Build Ethereum Contract +# run: | +# make ethereum-build + +# # Build Starknet Contract +# - name: Build ZKSync Contract +# run: | +# make zksync-build + +#zksync-test-integration: +# @make ethereum-build && make zksync-build && \ +# . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ +# . ./contracts/ethereum/deploy.sh && \ +# . ./contracts/zksync/deploy.sh && \ +# . ./contracts/ethereum/set_zksync_escrow.sh && \ +# . ./contracts/zksync/test/set_order.sh && \ +# . ./contracts/zksync/test/transfer.sh && \ +# . ./contracts/zksync/test/claim_payment.sh + + # Deploy PaymentRegistry, Escrow, set escrow, and test complete flow + - name: Deploy and test complete flow + run: | + make zksync-test-integration: diff --git a/.github/workflows/zksync-scripts/.ethereum.env.test b/.github/workflows/zksync-scripts/.ethereum.env.test new file mode 100644 index 00000000..5e8aa451 --- /dev/null +++ b/.github/workflows/zksync-scripts/.ethereum.env.test @@ -0,0 +1,29 @@ +SKIP_VERIFY=true #cant verify on local devnet + +ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url + +ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a + +ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 + +MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 + +USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds + + + +ZKSYNC_CLAIM_PAYMENT_SELECTOR=0xa5168739 +ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae +ZKSYNC_CHAIN_ID=300 + + +#irrelevant SN variables +STARKNET_CLAIM_PAYMENT_SELECTOR=0x03636c566f6409560d55d5f6d1eb4ee163b096b4698c503e69e210be79de2afa +STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=0x0354a01e49fe07e43306a97ed84dbd5de8238c7d8ff616caa3444630cfc559e6 +STARKNET_MESSAGING_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 +STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 + + + + diff --git a/.github/workflows/zksync-scripts/.env.test b/.github/workflows/zksync-scripts/.zksync.env.test similarity index 100% rename from .github/workflows/zksync-scripts/.env.test rename to .github/workflows/zksync-scripts/.zksync.env.test diff --git a/contracts/ethereum/test/.env.test b/contracts/ethereum/test/.env.test index d89417ab..5e8aa451 100644 --- a/contracts/ethereum/test/.env.test +++ b/contracts/ethereum/test/.env.test @@ -4,7 +4,6 @@ ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a - ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 From 3c0215c2ab39ce6b893ba0079c9564d32d32d76b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:35:59 -0300 Subject: [PATCH 008/111] feat(wip): send Dockerized L1-L2 to bg, + fixed zksync setup --- .github/workflows/zksync-integration-test.yml | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 86c61631..b6cf1b2c 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -31,35 +31,16 @@ jobs: forge install # ZKSync Setup - - name: Install scarb - uses: software-mansion/setup-scarb@v1 - with: - scarb-version: "2.3.1" - - - name: Install starkliup - run: curl https://get.starkli.sh | sh - - - name: Install Starkli - run: | - /home/runner/.config/.starkli/bin/starkliup --version 0.1.20 - sudo mv /home/runner/.config/.starkli/bin/starkli /usr/local/bin/ - - - name: Setup Katana .env - run: | - cp .github/workflows/katana/katana.env .env - - - name: Download Katana + - name: Install ZKSync libs run: | - wget https://github.com/dojoengine/dojo/releases/download/v0.4.4/dojo_v0.4.4_linux_amd64.tar.gz - tar -xzvf dojo_v0.4.4_linux_amd64.tar.gz - rm sozo torii dojo-language-server + cd ./contracts/zksync/ && yarn install # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 run: | git clone https://github.com/matter-labs/local-setup.git cd local-setup - ./start.sh + ./start.sh & # # Build Ethereum Contract # - name: Build Ethereum Contract From 21a2fecf8266cf6342edbe490a8c51a1cd524238 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:43:42 -0300 Subject: [PATCH 009/111] test(wip): trying to execute make target to avoid migrating whole process --- .github/workflows/zksync-integration-test.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index b6cf1b2c..cfc28734 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -42,15 +42,15 @@ jobs: cd local-setup ./start.sh & -# # Build Ethereum Contract -# - name: Build Ethereum Contract -# run: | -# make ethereum-build +# # Build Ethereum Contract +# - name: Build Ethereum Contract +# run: | +# make ethereum-build -# # Build Starknet Contract -# - name: Build ZKSync Contract -# run: | -# make zksync-build +# # Build Starknet Contract +# - name: Build ZKSync Contract +# run: | +# make zksync-build #zksync-test-integration: # @make ethereum-build && make zksync-build && \ @@ -65,4 +65,7 @@ jobs: # Deploy PaymentRegistry, Escrow, set escrow, and test complete flow - name: Deploy and test complete flow run: | + echo asd + pwd + echo qwe make zksync-test-integration: From e46c3770912300e3dc83b51011e40fc30838e97f Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:46:58 -0300 Subject: [PATCH 010/111] test(wip): trying to execute make target --- .github/workflows/zksync-integration-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index cfc28734..b9cd8b6f 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -67,5 +67,7 @@ jobs: run: | echo asd pwd + ls -la + cat Makefile echo qwe make zksync-test-integration: From 5c0fc31499a88c02ae10523aef48cbb1adb0ec7c Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:48:40 -0300 Subject: [PATCH 011/111] fix: make target name --- .github/workflows/zksync-integration-test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index b9cd8b6f..1b81e504 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -65,9 +65,4 @@ jobs: # Deploy PaymentRegistry, Escrow, set escrow, and test complete flow - name: Deploy and test complete flow run: | - echo asd - pwd - ls -la - cat Makefile - echo qwe - make zksync-test-integration: + make zksync-test-integration From 545b839e2ecd6a9dc16a436936ca3cc960c7cca8 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:54:27 -0300 Subject: [PATCH 012/111] fix: add zksync/test/.env.test to repo (was gitignored) --- .github/workflows/zksync-integration-test.yml | 6 +++++- contracts/zksync/.gitignore | 1 - contracts/zksync/test/.env.test | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 contracts/zksync/test/.env.test diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 1b81e504..d29744f0 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -29,9 +29,13 @@ jobs: run: | cd contracts/ethereum forge install + + - name: Install Ethereum foundry + run: | + make install-ethereum-foundry # ZKSync Setup - - name: Install ZKSync libs + - name: Install ZKSync libraries run: | cd ./contracts/zksync/ && yarn install diff --git a/contracts/zksync/.gitignore b/contracts/zksync/.gitignore index 6144bb56..f690d704 100644 --- a/contracts/zksync/.gitignore +++ b/contracts/zksync/.gitignore @@ -79,7 +79,6 @@ typings/ # dotenv environment variables file .env -.env.test # parcel-bundler cache (https://parceljs.org/) .cache diff --git a/contracts/zksync/test/.env.test b/contracts/zksync/test/.env.test new file mode 100644 index 00000000..103c8cbb --- /dev/null +++ b/contracts/zksync/test/.env.test @@ -0,0 +1,10 @@ +TEST=true + + +WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 + +NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A + +USER_ZKSYNC_PRIVATE_ADDRESS=0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93 #prefunded 4 +USER_ZKSYNC_PUBLIC_ADDRESS=0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 #prefunded 4 From 2aa02bac76fac23e13dedf77bae9dabf109a2280 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:58:01 -0300 Subject: [PATCH 013/111] fix: comment make install-eth-foundry --- .github/workflows/zksync-integration-test.yml | 6 +++--- .github/workflows/zksync-scripts/.zksync.env.test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index d29744f0..5cab922f 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -30,9 +30,9 @@ jobs: cd contracts/ethereum forge install - - name: Install Ethereum foundry - run: | - make install-ethereum-foundry + # - name: Install Ethereum foundry + # run: | + # make install-ethereum-foundry # ZKSync Setup - name: Install ZKSync libraries diff --git a/.github/workflows/zksync-scripts/.zksync.env.test b/.github/workflows/zksync-scripts/.zksync.env.test index 51d92687..4020dcc4 100644 --- a/.github/workflows/zksync-scripts/.zksync.env.test +++ b/.github/workflows/zksync-scripts/.zksync.env.test @@ -1,7 +1,7 @@ TEST=true -WALLET_PRIVATE_KEY=0xe131bc3f481277a8f73d680d9ba404cc6f959e64296e0914dded403030d4f705 #prefunded 0 #LA SAQUE DESDE LA MNEMONIC QUE USAN PARA DEPLOYAR +WALLET_PRIVATE_KEY=0xe131bc3f481277a8f73d680d9ba404cc6f959e64296e0914dded403030d4f705 #prefunded 0 MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A From 56fa8f9440613eea52226176ee4fa79963f622c0 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:03:16 -0300 Subject: [PATCH 014/111] fix: run make target on same CI step as start dockerized L1L2 --- .github/workflows/zksync-integration-test.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 5cab922f..ab305e47 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -45,6 +45,8 @@ jobs: git clone https://github.com/matter-labs/local-setup.git cd local-setup ./start.sh & + cd .. + make zksync-test-integration # # Build Ethereum Contract # - name: Build Ethereum Contract @@ -66,7 +68,7 @@ jobs: # . ./contracts/zksync/test/transfer.sh && \ # . ./contracts/zksync/test/claim_payment.sh - # Deploy PaymentRegistry, Escrow, set escrow, and test complete flow - - name: Deploy and test complete flow - run: | - make zksync-test-integration + # # Deploy PaymentRegistry, Escrow, set escrow, and test complete flow + # - name: Deploy and test complete flow + # run: | + # make zksync-test-integration From 112b3d2b0841c0f2caa55f1c7e87830c5fc77d34 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:19:30 -0300 Subject: [PATCH 015/111] fix: add sleep to let docker set up --- .github/workflows/zksync-integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index ab305e47..c4dff35c 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -46,6 +46,7 @@ jobs: cd local-setup ./start.sh & cd .. + sleep 200 make zksync-test-integration # # Build Ethereum Contract From 7c3dfb4e24665289c42f28ccddc4fb63a5f9dee6 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:51:36 -0300 Subject: [PATCH 016/111] fix: more wait time + skip_verify on test --- .github/workflows/zksync-integration-test.yml | 2 +- contracts/ethereum/deploy.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index c4dff35c..0d1ed84e 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -46,7 +46,7 @@ jobs: cd local-setup ./start.sh & cd .. - sleep 200 + sleep 300 make zksync-test-integration # # Build Ethereum Contract diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 1f98107b..560ae32a 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -7,6 +7,7 @@ printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESE export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS +export SKIP_VERIFY=$SKIP_VERIFY RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail From 2cc01419a4df307958bb2e113e11d660da48c8da Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:40:54 -0300 Subject: [PATCH 017/111] fix: add fake etherscan_api_key --- contracts/ethereum/test/.env.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ethereum/test/.env.test b/contracts/ethereum/test/.env.test index 5e8aa451..e687c817 100644 --- a/contracts/ethereum/test/.env.test +++ b/contracts/ethereum/test/.env.test @@ -11,7 +11,7 @@ MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds - +ETHERSCAN_API_KEY=0x1 ZKSYNC_CLAIM_PAYMENT_SELECTOR=0xa5168739 ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae From 22f9a691ea94988421641cb5facc7b071109bde9 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:58:52 -0300 Subject: [PATCH 018/111] fix(wip): test deploy without --verify --- contracts/ethereum/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 560ae32a..1e2e0490 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -9,7 +9,7 @@ export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS export SKIP_VERIFY=$SKIP_VERIFY -RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) +RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast) # echo "$RESULT_LOG" #uncomment this line for debugging in detail # Getting result addresses From 52bee73ad55ecd73961ef3e800854caabcc8fd69 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:15:43 -0300 Subject: [PATCH 019/111] fix: undo previous remove --- contracts/ethereum/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 1e2e0490..560ae32a 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -9,7 +9,7 @@ export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS export SKIP_VERIFY=$SKIP_VERIFY -RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast) +RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail # Getting result addresses From a73d6370f940ec6fb6d65eef276ee4ac43cd0ebc Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:17:46 -0300 Subject: [PATCH 020/111] add ETHERSCAN_API_KEY in CI --- .github/workflows/zksync-integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 0d1ed84e..b8bd8b16 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -42,6 +42,7 @@ jobs: # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 run: | + export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} git clone https://github.com/matter-labs/local-setup.git cd local-setup ./start.sh & From 46ac077ecb3254f2a7bec5ef01a46aa8f96cd878 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:18:41 -0300 Subject: [PATCH 021/111] fix: (temp) lower sleep in run Dockerized L1-L2 --- .github/workflows/zksync-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index b8bd8b16..cfd81dc6 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -47,7 +47,7 @@ jobs: cd local-setup ./start.sh & cd .. - sleep 300 + sleep 100 make zksync-test-integration # # Build Ethereum Contract From e3eb4f721fac84923eeb04fcac37ab14ef9179dc Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:25:53 -0300 Subject: [PATCH 022/111] fix: add more explicit env var sourcing in CI --- .github/workflows/zksync-integration-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index cfd81dc6..5d2cdbe7 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -43,11 +43,13 @@ jobs: - name: Setup Dockerized L1-L2 run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - git clone https://github.com/matter-labs/local-setup.git - cd local-setup + . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ + git clone https://github.com/matter-labs/local-setup.git && \ + cd local-setup && \ ./start.sh & cd .. sleep 100 + . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ make zksync-test-integration # # Build Ethereum Contract From e7957adb52cc60896228f0508a3e3672c5c09774 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:30:57 -0300 Subject: [PATCH 023/111] fix: CI run Docker command --- .github/workflows/zksync-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 5d2cdbe7..dbe94505 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -45,7 +45,7 @@ jobs: export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ git clone https://github.com/matter-labs/local-setup.git && \ - cd local-setup && \ + cd local-setup ./start.sh & cd .. sleep 100 From 3ab88fa9e6ae962b9b390d5549faa7af4286ada0 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:34:38 -0300 Subject: [PATCH 024/111] feat: new CI.env to make source .env in CI --- .github/workflows/zksync-integration-test.yml | 7 +++- .../zksync-scripts/.ethereum.env.test | 29 -------------- .../workflows/zksync-scripts/.zksync.env.test | 10 ----- .github/workflows/zksync-scripts/ci.env.test | 38 +++++++++++++++++++ 4 files changed, 43 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/zksync-scripts/ci.env.test diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index dbe94505..916b209e 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -43,11 +43,14 @@ jobs: - name: Setup Dockerized L1-L2 run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ - git clone https://github.com/matter-labs/local-setup.git && \ + source ./github/workflows/zksync-scripts/ci.env.test + + git clone https://github.com/matter-labs/local-setup.git + cd local-setup ./start.sh & cd .. + sleep 100 . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ make zksync-test-integration diff --git a/.github/workflows/zksync-scripts/.ethereum.env.test b/.github/workflows/zksync-scripts/.ethereum.env.test index 5e8aa451..e69de29b 100644 --- a/.github/workflows/zksync-scripts/.ethereum.env.test +++ b/.github/workflows/zksync-scripts/.ethereum.env.test @@ -1,29 +0,0 @@ -SKIP_VERIFY=true #cant verify on local devnet - -ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url - -ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a - -ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 - -MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 -MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 - -USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds - - - -ZKSYNC_CLAIM_PAYMENT_SELECTOR=0xa5168739 -ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae -ZKSYNC_CHAIN_ID=300 - - -#irrelevant SN variables -STARKNET_CLAIM_PAYMENT_SELECTOR=0x03636c566f6409560d55d5f6d1eb4ee163b096b4698c503e69e210be79de2afa -STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=0x0354a01e49fe07e43306a97ed84dbd5de8238c7d8ff616caa3444630cfc559e6 -STARKNET_MESSAGING_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 -STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 - - - - diff --git a/.github/workflows/zksync-scripts/.zksync.env.test b/.github/workflows/zksync-scripts/.zksync.env.test index 4020dcc4..e69de29b 100644 --- a/.github/workflows/zksync-scripts/.zksync.env.test +++ b/.github/workflows/zksync-scripts/.zksync.env.test @@ -1,10 +0,0 @@ -TEST=true - - -WALLET_PRIVATE_KEY=0xe131bc3f481277a8f73d680d9ba404cc6f959e64296e0914dded403030d4f705 #prefunded 0 -MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 - -NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A - -USER_ZKSYNC_PRIVATE_ADDRESS=0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93 #prefunded 4 -USER_ZKSYNC_PUBLIC_ADDRESS=0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 #prefunded 4 diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test new file mode 100644 index 00000000..7e198ba1 --- /dev/null +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -0,0 +1,38 @@ +## ETH.env +SKIP_VERIFY=true #cant verify on local devnet + +ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url + +ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a + +ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 + +MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 + +USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds + +ZKSYNC_CLAIM_PAYMENT_SELECTOR=0xa5168739 +ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae +ZKSYNC_CHAIN_ID=300 + + +#irrelevant SN variables +STARKNET_CLAIM_PAYMENT_SELECTOR=0x03636c566f6409560d55d5f6d1eb4ee163b096b4698c503e69e210be79de2afa +STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=0x0354a01e49fe07e43306a97ed84dbd5de8238c7d8ff616caa3444630cfc559e6 +STARKNET_MESSAGING_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 +STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 + + +## ZKSYNC.env +TEST=true + +WALLET_PRIVATE_KEY=0xe131bc3f481277a8f73d680d9ba404cc6f959e64296e0914dded403030d4f705 #prefunded 0 +MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 + +NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A + +USER_ZKSYNC_PRIVATE_ADDRESS=0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93 #prefunded 4 +USER_ZKSYNC_PUBLIC_ADDRESS=0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 #prefunded 4 + + From a260ab5668d3be13f9accdc03173f1ec28568ada Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:37:17 -0300 Subject: [PATCH 025/111] fix: .env file path --- .github/workflows/zksync-integration-test.yml | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 916b209e..faae37ab 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,31 +20,33 @@ jobs: steps: - uses: actions/checkout@v4 + # Temporary comment during CI dev: + # # Ethereum Setup + # - name: Install Foundry + # uses: foundry-rs/foundry-toolchain@v1 - # Ethereum Setup - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - - - name: Install Forge - run: | - cd contracts/ethereum - forge install - - # - name: Install Ethereum foundry + # - name: Install Forge # run: | - # make install-ethereum-foundry + # cd contracts/ethereum + # forge install + + # # - name: Install Ethereum foundry + # # run: | + # # make install-ethereum-foundry - # ZKSync Setup - - name: Install ZKSync libraries - run: | - cd ./contracts/zksync/ && yarn install + # # ZKSync Setup + # - name: Install ZKSync libraries + # run: | + # cd ./contracts/zksync/ && yarn install # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - source ./github/workflows/zksync-scripts/ci.env.test - + pwd + ls -la + source ./.github/workflows/zksync-scripts/ci.env.test + git clone https://github.com/matter-labs/local-setup.git cd local-setup From 8bd8fbb5738c4c56ab636e97786402a2959a6818 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:40:52 -0300 Subject: [PATCH 026/111] refactor: echos during CI to visualize progress + removed extra . file sourcing --- .github/workflows/zksync-integration-test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index faae37ab..418ada85 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -43,18 +43,19 @@ jobs: - name: Setup Dockerized L1-L2 run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - pwd - ls -la source ./.github/workflows/zksync-scripts/ci.env.test + echo sourced git clone https://github.com/matter-labs/local-setup.git + echo git cloned, starting: cd local-setup ./start.sh & cd .. - + + echo starting sleep 100 sleep 100 - . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ + echo done sleep 100, running make-test-integration make zksync-test-integration # # Build Ethereum Contract From 802000178762a640efc12197ea06d4dbda002268 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:45:30 -0300 Subject: [PATCH 027/111] fix: make target refactored for CI --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 23038f0c..2f7b552c 100644 --- a/Makefile +++ b/Makefile @@ -102,8 +102,18 @@ zksync-test: zksync-build zksync-test-in-memory: zksync-build @cd ./contracts/zksync/ && yarn test-in-memory -#wip: +#wip CI: zksync-test-integration: + @echo building eth && make ethereum-build && \ + echo building zksync && make zksync-build && \ + echo deploying eth && . ./contracts/ethereum/deploy.sh && \ + echo deploying zksync && . ./contracts/zksync/deploy.sh && \ + . ./contracts/ethereum/set_zksync_escrow.sh && \ + . ./contracts/zksync/test/set_order.sh && \ + . ./contracts/zksync/test/transfer.sh && \ + . ./contracts/zksync/test/claim_payment.sh + +zksync-local-test-integration: @make ethereum-build && make zksync-build && \ . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ . ./contracts/ethereum/deploy.sh && \ From 2f2ada2774a2d58027c7c5b0fc789516eb7fe83e Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:46:41 -0300 Subject: [PATCH 028/111] remove: commented setup in CI --- .github/workflows/zksync-integration-test.yml | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 418ada85..5a713afb 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,24 +20,23 @@ jobs: steps: - uses: actions/checkout@v4 - # Temporary comment during CI dev: - # # Ethereum Setup - # - name: Install Foundry - # uses: foundry-rs/foundry-toolchain@v1 + # Ethereum Setup + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 - # - name: Install Forge - # run: | - # cd contracts/ethereum - # forge install + - name: Install Forge + run: | + cd contracts/ethereum + forge install - # # - name: Install Ethereum foundry - # # run: | - # # make install-ethereum-foundry - - # # ZKSync Setup - # - name: Install ZKSync libraries + # - name: Install Ethereum foundry # run: | - # cd ./contracts/zksync/ && yarn install + # make install-ethereum-foundry + + # ZKSync Setup + - name: Install ZKSync libraries + run: | + cd ./contracts/zksync/ && yarn install # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 From a02ecfc74456ee0ec71c5e8880cf35b57ba614cf Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:53:11 -0300 Subject: [PATCH 029/111] fix: viewing if ETH_RPC var is read correctly --- .github/workflows/zksync-integration-test.yml | 28 +++++++++---------- Makefile | 4 +-- contracts/ethereum/deploy.sh | 3 ++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 5a713afb..b97c5ac1 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,23 +20,23 @@ jobs: steps: - uses: actions/checkout@v4 - # Ethereum Setup - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + # # Ethereum Setup + # - name: Install Foundry + # uses: foundry-rs/foundry-toolchain@v1 - - name: Install Forge - run: | - cd contracts/ethereum - forge install - - # - name: Install Ethereum foundry + # - name: Install Forge # run: | - # make install-ethereum-foundry + # cd contracts/ethereum + # forge install + + # # - name: Install Ethereum foundry + # # run: | + # # make install-ethereum-foundry - # ZKSync Setup - - name: Install ZKSync libraries - run: | - cd ./contracts/zksync/ && yarn install + # # ZKSync Setup + # - name: Install ZKSync libraries + # run: | + # cd ./contracts/zksync/ && yarn install # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 diff --git a/Makefile b/Makefile index 2f7b552c..c9687a00 100644 --- a/Makefile +++ b/Makefile @@ -103,9 +103,9 @@ zksync-test-in-memory: zksync-build @cd ./contracts/zksync/ && yarn test-in-memory #wip CI: +# @echo building eth && make ethereum-build && \ +# echo building zksync && make zksync-build && zksync-test-integration: - @echo building eth && make ethereum-build && \ - echo building zksync && make zksync-build && \ echo deploying eth && . ./contracts/ethereum/deploy.sh && \ echo deploying zksync && . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 560ae32a..5ff59831 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -8,6 +8,9 @@ printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESE export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS export SKIP_VERIFY=$SKIP_VERIFY +echo $ETHEREUM_RPC +export ETHEREUM_RPC=$ETHEREUM_RPC +exit RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail From 8341057e8df8aa12545bae4ad6af22fbeae27711 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:57:55 -0300 Subject: [PATCH 030/111] fix: trying to correctly source .env in CI --- .github/workflows/zksync-integration-test.yml | 22 ++++++++++--------- Makefile | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index b97c5ac1..4953fcfd 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -44,18 +44,20 @@ jobs: export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} source ./.github/workflows/zksync-scripts/ci.env.test echo sourced + make zksync-test-integration - git clone https://github.com/matter-labs/local-setup.git - echo git cloned, starting: +# this goes in Setup Dockerized L1-L2, here temprorarily for dev +# git clone https://github.com/matter-labs/local-setup.git +# echo git cloned, starting: + +# cd local-setup +# ./start.sh & +# cd .. + +# echo starting sleep 100 +# sleep 100 +# echo done sleep 100, running make-test-integration - cd local-setup - ./start.sh & - cd .. - - echo starting sleep 100 - sleep 100 - echo done sleep 100, running make-test-integration - make zksync-test-integration # # Build Ethereum Contract # - name: Build Ethereum Contract diff --git a/Makefile b/Makefile index c9687a00..8fe16a2e 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,7 @@ zksync-test-in-memory: zksync-build # @echo building eth && make ethereum-build && \ # echo building zksync && make zksync-build && zksync-test-integration: + @source ./.github/workflows/zksync-scripts/ci.env.test && \ echo deploying eth && . ./contracts/ethereum/deploy.sh && \ echo deploying zksync && . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ From 6182acb606e15458c805684f5567666e096a1370 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:58:39 -0300 Subject: [PATCH 031/111] fix: change source to . --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8fe16a2e..ba87e18c 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ zksync-test-in-memory: zksync-build # @echo building eth && make ethereum-build && \ # echo building zksync && make zksync-build && zksync-test-integration: - @source ./.github/workflows/zksync-scripts/ci.env.test && \ + @. ./.github/workflows/zksync-scripts/ci.env.test && \ echo deploying eth && . ./contracts/ethereum/deploy.sh && \ echo deploying zksync && . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ From 4b871ede8533896988eacc3e97fe9bc0ab8d5b5d Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:02:39 -0300 Subject: [PATCH 032/111] fix: source .env worked, trying whole CI test again --- .github/workflows/zksync-integration-test.yml | 55 +++++++++---------- Makefile | 1 + contracts/ethereum/deploy.sh | 5 +- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 4953fcfd..5f848398 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,44 +20,43 @@ jobs: steps: - uses: actions/checkout@v4 - # # Ethereum Setup - # - name: Install Foundry - # uses: foundry-rs/foundry-toolchain@v1 + # Ethereum Setup + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 - # - name: Install Forge - # run: | - # cd contracts/ethereum - # forge install + - name: Install Forge + run: | + cd contracts/ethereum + forge install - # # - name: Install Ethereum foundry - # # run: | - # # make install-ethereum-foundry - - # # ZKSync Setup - # - name: Install ZKSync libraries + # - name: Install Ethereum foundry # run: | - # cd ./contracts/zksync/ && yarn install + # make install-ethereum-foundry + + # ZKSync Setup + - name: Install ZKSync libraries + run: | + cd ./contracts/zksync/ && yarn install # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 run: | - export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - source ./.github/workflows/zksync-scripts/ci.env.test - echo sourced - make zksync-test-integration + echo startung dockerized setup + git clone https://github.com/matter-labs/local-setup.git + echo git cloned, starting: -# this goes in Setup Dockerized L1-L2, here temprorarily for dev -# git clone https://github.com/matter-labs/local-setup.git -# echo git cloned, starting: + cd local-setup + ./start.sh & + cd .. -# cd local-setup -# ./start.sh & -# cd .. - -# echo starting sleep 100 -# sleep 100 -# echo done sleep 100, running make-test-integration + echo starting sleep 100 + sleep 100 + echo done sleep 100, running make-test-integration + make zksync-test-integration +# export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} +# source ./.github/workflows/zksync-scripts/ci.env.test +# echo sourced # # Build Ethereum Contract # - name: Build Ethereum Contract diff --git a/Makefile b/Makefile index ba87e18c..378af2e7 100644 --- a/Makefile +++ b/Makefile @@ -114,6 +114,7 @@ zksync-test-integration: . ./contracts/zksync/test/transfer.sh && \ . ./contracts/zksync/test/claim_payment.sh +#old version: zksync-local-test-integration: @make ethereum-build && make zksync-build && \ . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 5ff59831..e1892502 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -7,10 +7,7 @@ printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESE export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS -export SKIP_VERIFY=$SKIP_VERIFY -echo $ETHEREUM_RPC -export ETHEREUM_RPC=$ETHEREUM_RPC -exit + RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail From d93e9f561fb769f7ddc63ebd330d8a3d77ad5f93 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:06:16 -0300 Subject: [PATCH 033/111] fix: added ETHERSCAN_API_KEY in CI again --- .github/workflows/zksync-integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 5f848398..d9793e1c 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -41,6 +41,7 @@ jobs: # Run Dockerized L1-L2 - name: Setup Dockerized L1-L2 run: | + export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} echo startung dockerized setup git clone https://github.com/matter-labs/local-setup.git echo git cloned, starting: From 3cf05d6bd374e1b09f160317348b1ba6770daa84 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:12:58 -0300 Subject: [PATCH 034/111] feat: redirect docker output to /dev.null --- .github/workflows/zksync-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index d9793e1c..34a67bf5 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -47,7 +47,7 @@ jobs: echo git cloned, starting: cd local-setup - ./start.sh & + ./start.sh & > /dev/null cd .. echo starting sleep 100 From 832191fa67ef9d6e6c252ac606fcaf2da90a0ad2 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:13:52 -0300 Subject: [PATCH 035/111] fix: add . to deploy.s.sol to see if it gets its env vars as it should --- contracts/ethereum/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index e1892502..923cdffc 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -9,7 +9,7 @@ export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS -RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) +RESULT_LOG=$(. forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail # Getting result addresses From 038064c3f389554c884b11e9fcd0541803165669 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:22:59 -0300 Subject: [PATCH 036/111] fix: correctly redirect output to dev/null --- .github/workflows/zksync-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 34a67bf5..a3b911e6 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -47,7 +47,7 @@ jobs: echo git cloned, starting: cd local-setup - ./start.sh & > /dev/null + ./start.sh > /dev/null & cd .. echo starting sleep 100 From fe8051469871ed54387193427af256c2cb37a2ef Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:23:41 -0300 Subject: [PATCH 037/111] fix: exporting vars in deploy.sh to make seploy.s.sol get env vars --- contracts/ethereum/deploy.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 923cdffc..71b8504c 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -8,8 +8,20 @@ printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESE export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS +### +export STARKNET_MESSAGING_ADDRESS=$STARKNET_MESSAGING_ADDRESS +export STARKNET_CLAIM_PAYMENT_SELECTOR=$STARKNET_CLAIM_PAYMENT_SELECTOR +export STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=$STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR +export MM_ETHEREUM_WALLET_ADDRESS=$MM_ETHEREUM_WALLET_ADDRESS +export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS +export ZKSYNC_CLAIM_PAYMENT_SELECTOR=$ZKSYNC_CLAIM_PAYMENT_SELECTOR +export ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=$ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR +export STARKNET_CHAIN_ID=$STARKNET_CHAIN_ID +export ZKSYNC_CHAIN_ID=$ZKSYNC_CHAIN_ID +### + -RESULT_LOG=$(. forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) +RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail # Getting result addresses From 6f7964894293fdeb33d009a11e46b82c2c198433 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:33:20 -0300 Subject: [PATCH 038/111] fix: build in make-integration-ci --- .github/workflows/zksync-integration-test.yml | 4 ++-- Makefile | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index a3b911e6..2967fcbc 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -52,8 +52,8 @@ jobs: echo starting sleep 100 sleep 100 - echo done sleep 100, running make-test-integration - make zksync-test-integration + echo done sleep 100, running make-test-integration-ci + make zksync-test-integration-ci # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} # source ./.github/workflows/zksync-scripts/ci.env.test diff --git a/Makefile b/Makefile index 378af2e7..11ad1d94 100644 --- a/Makefile +++ b/Makefile @@ -103,10 +103,10 @@ zksync-test-in-memory: zksync-build @cd ./contracts/zksync/ && yarn test-in-memory #wip CI: -# @echo building eth && make ethereum-build && \ -# echo building zksync && make zksync-build && -zksync-test-integration: +zksync-test-integration-ci: @. ./.github/workflows/zksync-scripts/ci.env.test && \ + echo building eth && make ethereum-build && \ + echo building zksync && make zksync-build && echo deploying eth && . ./contracts/ethereum/deploy.sh && \ echo deploying zksync && . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ @@ -115,7 +115,7 @@ zksync-test-integration: . ./contracts/zksync/test/claim_payment.sh #old version: -zksync-local-test-integration: +zksync-test-integration-local: @make ethereum-build && make zksync-build && \ . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ . ./contracts/ethereum/deploy.sh && \ From 35ad4413f0c2277f5b95d68e6d256cf47bb3104b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:37:18 -0300 Subject: [PATCH 039/111] fix: zksync-integration-ci make target --- .github/workflows/zksync-scripts/.ethereum.env.test | 0 .github/workflows/zksync-scripts/.zksync.env.test | 0 Makefile | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .github/workflows/zksync-scripts/.ethereum.env.test delete mode 100644 .github/workflows/zksync-scripts/.zksync.env.test diff --git a/.github/workflows/zksync-scripts/.ethereum.env.test b/.github/workflows/zksync-scripts/.ethereum.env.test deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/zksync-scripts/.zksync.env.test b/.github/workflows/zksync-scripts/.zksync.env.test deleted file mode 100644 index e69de29b..00000000 diff --git a/Makefile b/Makefile index 11ad1d94..0ae7e514 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ zksync-test-in-memory: zksync-build zksync-test-integration-ci: @. ./.github/workflows/zksync-scripts/ci.env.test && \ echo building eth && make ethereum-build && \ - echo building zksync && make zksync-build && + echo building zksync && make zksync-build && \ echo deploying eth && . ./contracts/ethereum/deploy.sh && \ echo deploying zksync && . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ From 57b96e620b70b083d9f383a842010a77953078c8 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:43:28 -0300 Subject: [PATCH 040/111] fix: prefunded deployer ZKSync wallet private key in CI --- .github/workflows/zksync-scripts/ci.env.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index 7e198ba1..39485847 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -27,7 +27,7 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 ## ZKSYNC.env TEST=true -WALLET_PRIVATE_KEY=0xe131bc3f481277a8f73d680d9ba404cc6f959e64296e0914dded403030d4f705 #prefunded 0 +WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A From bad13986503a8cae969e806afb9e88062aa68bfa Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:48:25 -0300 Subject: [PATCH 041/111] fix: increment CI sleep to let docker setup correctly --- .github/workflows/zksync-integration-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 2967fcbc..23ba1fe3 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -47,12 +47,12 @@ jobs: echo git cloned, starting: cd local-setup - ./start.sh > /dev/null & + ./start.sh & cd .. - echo starting sleep 100 - sleep 100 - echo done sleep 100, running make-test-integration-ci + echo starting sleep 400 + sleep 400 + echo done sleep 400, running make-test-integration-ci make zksync-test-integration-ci # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} From 5b715fcc0d30dfdcd4424f6c7809557024c52c81 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:03:45 -0300 Subject: [PATCH 042/111] fix: more sleep in ZKSync CI --- .github/workflows/zksync-integration-test.yml | 6 +++--- contracts/ethereum/deploy.sh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 23ba1fe3..9bf141ce 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -50,9 +50,9 @@ jobs: ./start.sh & cd .. - echo starting sleep 400 - sleep 400 - echo done sleep 400, running make-test-integration-ci + echo starting sleep 600 + sleep 600 + echo done sleep 600, running make-test-integration-ci make zksync-test-integration-ci # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 71b8504c..f7c00f65 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -20,9 +20,10 @@ export STARKNET_CHAIN_ID=$STARKNET_CHAIN_ID export ZKSYNC_CHAIN_ID=$ZKSYNC_CHAIN_ID ### - +echo before running forge script RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail +echo after running forge script # Getting result addresses PAYMENT_REGISTRY_PROXY_ADDRESS=$(echo "$RESULT_LOG" | grep -Eo '0: address ([^\n]+)' | awk '{print $NF}') From 6d4c68e7dd50e97865210ed9f983ac298927e388 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:08:43 -0300 Subject: [PATCH 043/111] refactor: run docker at the beggining of CI --- .github/workflows/zksync-integration-test.yml | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 9bf141ce..3e39fafe 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,6 +20,18 @@ jobs: steps: - uses: actions/checkout@v4 + # Run Dockerized L1-L2, goes first because it takes a lot of time + - name: Setup Dockerized L1-L2 + run: | + export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} + echo startung dockerized setup + git clone https://github.com/matter-labs/local-setup.git + echo git cloned, starting: + + cd local-setup + ./start.sh & + cd .. + # Ethereum Setup - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 @@ -39,16 +51,9 @@ jobs: cd ./contracts/zksync/ && yarn install # Run Dockerized L1-L2 - - name: Setup Dockerized L1-L2 + - name: Running integration test run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - echo startung dockerized setup - git clone https://github.com/matter-labs/local-setup.git - echo git cloned, starting: - - cd local-setup - ./start.sh & - cd .. echo starting sleep 600 sleep 600 From 0f30ba55ac424539d3e56989bb1a342807a80be4 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:11:19 -0300 Subject: [PATCH 044/111] refactor: remove build from make target, added directly to ci --- .github/workflows/zksync-integration-test.yml | 10 ++++++++++ Makefile | 2 -- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 3e39fafe..10aab305 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -50,6 +50,16 @@ jobs: run: | cd ./contracts/zksync/ && yarn install + # Build Ethereum Contract + - name: Build Ethereum Contract + run: | + make ethereum-build + + # Build Starknet Contract + - name: Build Starknet Contract + run: | + make zksync-build + # Run Dockerized L1-L2 - name: Running integration test run: | diff --git a/Makefile b/Makefile index 0ae7e514..8e2dd8b5 100644 --- a/Makefile +++ b/Makefile @@ -105,8 +105,6 @@ zksync-test-in-memory: zksync-build #wip CI: zksync-test-integration-ci: @. ./.github/workflows/zksync-scripts/ci.env.test && \ - echo building eth && make ethereum-build && \ - echo building zksync && make zksync-build && \ echo deploying eth && . ./contracts/ethereum/deploy.sh && \ echo deploying zksync && . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ From 0c4d798f6e08ab18007add46201c26c5b38753c6 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:14:03 -0300 Subject: [PATCH 045/111] test(wip): CI cheching if docker runs parallely --- .github/workflows/zksync-integration-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 10aab305..a0d50ee4 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -30,7 +30,6 @@ jobs: cd local-setup ./start.sh & - cd .. # Ethereum Setup - name: Install Foundry @@ -65,9 +64,9 @@ jobs: run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - echo starting sleep 600 - sleep 600 - echo done sleep 600, running make-test-integration-ci + echo starting sleep 100 + sleep 100 + echo done sleep 100, running make-test-integration-ci make zksync-test-integration-ci # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} From f89794d44380919068f536a504aa7929010554c2 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:21:49 -0300 Subject: [PATCH 046/111] fix: fixing dockerized setup, geth is not starting --- .github/workflows/zksync-integration-test.yml | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index a0d50ee4..0f19f5f4 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -29,45 +29,50 @@ jobs: echo git cloned, starting: cd local-setup + echo clearing: + ./clear.sh + echo starting: ./start.sh & - # Ethereum Setup - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + sleep 100 - - name: Install Forge - run: | - cd contracts/ethereum - forge install - - # - name: Install Ethereum foundry + # # Ethereum Setup + # - name: Install Foundry + # uses: foundry-rs/foundry-toolchain@v1 + + # - name: Install Forge # run: | - # make install-ethereum-foundry + # cd contracts/ethereum + # forge install + + # # - name: Install Ethereum foundry + # # run: | + # # make install-ethereum-foundry - # ZKSync Setup - - name: Install ZKSync libraries - run: | - cd ./contracts/zksync/ && yarn install + # # ZKSync Setup + # - name: Install ZKSync libraries + # run: | + # cd ./contracts/zksync/ && yarn install - # Build Ethereum Contract - - name: Build Ethereum Contract - run: | - make ethereum-build + # # Build Ethereum Contract + # - name: Build Ethereum Contract + # run: | + # make ethereum-build - # Build Starknet Contract - - name: Build Starknet Contract - run: | - make zksync-build + # # Build ZKSync Contract + # - name: Build ZKSync Contract + # run: | + # make zksync-build - # Run Dockerized L1-L2 - - name: Running integration test - run: | - export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} + # # Run Dockerized L1-L2 + # - name: Running integration test + # run: | + # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - echo starting sleep 100 - sleep 100 - echo done sleep 100, running make-test-integration-ci - make zksync-test-integration-ci + # echo starting sleep 100 + # sleep 100 + # echo done sleep 100, running make-test-integration-ci + # make zksync-test-integration-ci # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} # source ./.github/workflows/zksync-scripts/ci.env.test From 5158918db3a3c6976f11110a4d8b57dd1bc0cce1 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:34:34 -0300 Subject: [PATCH 047/111] feat: read ZKSYNC_DIAMOND_PROXY_ADDRESS from docker ./start.sh output --- .github/workflows/zksync-integration-test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 0f19f5f4..fe1a9375 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -29,12 +29,13 @@ jobs: echo git cloned, starting: cd local-setup - echo clearing: - ./clear.sh echo starting: - ./start.sh & - + touch docker_output.log + ./start.sh &> docker_output.log & sleep 100 + export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' + echo hola + echo $ZKSYNC_DIAMOND_PROXY_ADDRESS # # Ethereum Setup # - name: Install Foundry From b239519f915e8850ba190da3619d67bc595b4bdc Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:36:59 -0300 Subject: [PATCH 048/111] fix: remove ZKSYNC_DIAMOND_PROXY_ADDRESS from .env --- .github/workflows/zksync-scripts/ci.env.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index 39485847..c0774651 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -3,7 +3,7 @@ SKIP_VERIFY=true #cant verify on local devnet ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url -ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a +# ZKSYNC_DIAMOND_PROXY_ADDRESS=xxx #variable on each setup ./start.sh ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 From eb80e0bde16afea6f2f8c48b39d1359bb6199f45 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:55:25 -0300 Subject: [PATCH 049/111] fix: re-trigger CI, github actions had an outage --- .github/workflows/zksync-integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index fe1a9375..85a9c2dd 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -33,8 +33,8 @@ jobs: touch docker_output.log ./start.sh &> docker_output.log & sleep 100 - export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' - echo hola + export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' + echo after cat docker_output echo $ZKSYNC_DIAMOND_PROXY_ADDRESS # # Ethereum Setup From 095adc50319db31cfe1eff6020632e9b20384092 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:01:54 -0300 Subject: [PATCH 050/111] fix: CI export diamond proxy from ./start.sh --- .github/workflows/zksync-integration-test.yml | 41 ++++--------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 85a9c2dd..ef0f015f 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -33,7 +33,7 @@ jobs: touch docker_output.log ./start.sh &> docker_output.log & sleep 100 - export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' + export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo after cat docker_output echo $ZKSYNC_DIAMOND_PROXY_ADDRESS @@ -65,41 +65,16 @@ jobs: # run: | # make zksync-build - # # Run Dockerized L1-L2 + # Run Dockerized L1-L2 # - name: Running integration test # run: | # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - # echo starting sleep 100 - # sleep 100 - # echo done sleep 100, running make-test-integration-ci - # make zksync-test-integration-ci - -# export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} -# source ./.github/workflows/zksync-scripts/ci.env.test -# echo sourced - -# # Build Ethereum Contract -# - name: Build Ethereum Contract -# run: | -# make ethereum-build + # export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' + # echo after cat docker_output + # echo $ZKSYNC_DIAMOND_PROXY_ADDRESS -# # Build Starknet Contract -# - name: Build ZKSync Contract -# run: | -# make zksync-build - -#zksync-test-integration: -# @make ethereum-build && make zksync-build && \ -# . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ -# . ./contracts/ethereum/deploy.sh && \ -# . ./contracts/zksync/deploy.sh && \ -# . ./contracts/ethereum/set_zksync_escrow.sh && \ -# . ./contracts/zksync/test/set_order.sh && \ -# . ./contracts/zksync/test/transfer.sh && \ -# . ./contracts/zksync/test/claim_payment.sh + # echo running make-test-integration-ci + # make zksync-test-integration-ci - # # Deploy PaymentRegistry, Escrow, set escrow, and test complete flow - # - name: Deploy and test complete flow - # run: | - # make zksync-test-integration + \ No newline at end of file From bf57a674e27a0cf54a388971634538ae1d1cbc98 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:07:30 -0300 Subject: [PATCH 051/111] fix: better prints in CI to view if new technique works --- .github/workflows/zksync-integration-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index ef0f015f..d70526cf 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -33,10 +33,15 @@ jobs: touch docker_output.log ./start.sh &> docker_output.log & sleep 100 + echo catting log + cat docker_output.log + echo catting sed: + cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo after cat docker_output echo $ZKSYNC_DIAMOND_PROXY_ADDRESS + # # Ethereum Setup # - name: Install Foundry # uses: foundry-rs/foundry-toolchain@v1 From 65b9524d58a8f234c4b55bd56c97c62f9fc7b267 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:11:12 -0300 Subject: [PATCH 052/111] fix: more sleep to give time to ./start to create diamond proxy --- .github/workflows/zksync-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index d70526cf..17b6fb1c 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -32,7 +32,7 @@ jobs: echo starting: touch docker_output.log ./start.sh &> docker_output.log & - sleep 100 + sleep 200 echo catting log cat docker_output.log echo catting sed: From bfb38e34790d365276e6675b7d9a0538ebb1df01 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:18:12 -0300 Subject: [PATCH 053/111] test: in CI if another step can read a previously generated step's file --- .github/workflows/zksync-integration-test.yml | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 17b6fb1c..aff942ac 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -32,14 +32,22 @@ jobs: echo starting: touch docker_output.log ./start.sh &> docker_output.log & - sleep 200 + + # test read file + - name: test read file + run: | + sleep 30 echo catting log cat docker_output.log - echo catting sed: - cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' - export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') - echo after cat docker_output - echo $ZKSYNC_DIAMOND_PROXY_ADDRESS + +# sleep 200 +# echo catting log +# cat docker_output.log +# echo catting sed: +# cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' +# export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') +# echo after cat docker_output +# echo $ZKSYNC_DIAMOND_PROXY_ADDRESS # # Ethereum Setup From c61174eed8ed6f1ca464858f300d19ee25bdce07 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:20:07 -0300 Subject: [PATCH 054/111] test: reading files in CI environment --- .github/workflows/zksync-integration-test.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index aff942ac..c1aafbb0 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -31,15 +31,20 @@ jobs: cd local-setup echo starting: touch docker_output.log + ls ./start.sh &> docker_output.log & # test read file - name: test read file run: | - sleep 30 + ls + sleep 10 + ls + sleep 10 + ls echo catting log cat docker_output.log - + # sleep 200 # echo catting log # cat docker_output.log From cf11ee09e9a7592c2831c879795db15196fa7666 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:22:45 -0300 Subject: [PATCH 055/111] fix: move to local-setup dir in the other target --- .github/workflows/zksync-integration-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index c1aafbb0..f8fba573 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -33,13 +33,13 @@ jobs: touch docker_output.log ls ./start.sh &> docker_output.log & + + sleep 20 # test read file - name: test read file run: | - ls - sleep 10 - ls + cd local-setup sleep 10 ls echo catting log From 1e7ce08e71ef601ee418a579add35a40dff0d47b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:26:56 -0300 Subject: [PATCH 056/111] feat: integration test runner reads ZKSYNC_DIAMOND_PROXY_ADDRESS from log file --- .github/workflows/zksync-integration-test.yml | 99 +++++++++---------- 1 file changed, 45 insertions(+), 54 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index f8fba573..3a57ebc1 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -30,69 +30,60 @@ jobs: cd local-setup echo starting: - touch docker_output.log + touch ../docker_output.log ls - ./start.sh &> docker_output.log & - - sleep 20 - - # test read file - - name: test read file - run: | - cd local-setup - sleep 10 - ls - echo catting log - cat docker_output.log - -# sleep 200 -# echo catting log -# cat docker_output.log -# echo catting sed: -# cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' -# export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') -# echo after cat docker_output -# echo $ZKSYNC_DIAMOND_PROXY_ADDRESS + ./start.sh &> ../docker_output.log & + # Ethereum Setup + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 - # # Ethereum Setup - # - name: Install Foundry - # uses: foundry-rs/foundry-toolchain@v1 - - # - name: Install Forge - # run: | - # cd contracts/ethereum - # forge install + - name: Install Forge + run: | + cd contracts/ethereum + forge install - # # - name: Install Ethereum foundry - # # run: | - # # make install-ethereum-foundry - - # # ZKSync Setup - # - name: Install ZKSync libraries + # - name: Install Ethereum foundry # run: | - # cd ./contracts/zksync/ && yarn install + # make install-ethereum-foundry - # # Build Ethereum Contract - # - name: Build Ethereum Contract - # run: | - # make ethereum-build + # ZKSync Setup + - name: Install ZKSync libraries + run: | + cd ./contracts/zksync/ && yarn install - # # Build ZKSync Contract - # - name: Build ZKSync Contract - # run: | - # make zksync-build + # Build Ethereum Contract + - name: Build Ethereum Contract + run: | + make ethereum-build + + # Build ZKSync Contract + - name: Build ZKSync Contract + run: | + make zksync-build # Run Dockerized L1-L2 - # - name: Running integration test - # run: | - # export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} + - name: Running integration test + run: | + export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} + ls + cat docker_output.log + echo sleeping 200 to wait for ./start to setup - # export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' - # echo after cat docker_output - # echo $ZKSYNC_DIAMOND_PROXY_ADDRESS + export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' + echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable: + echo $ZKSYNC_DIAMOND_PROXY_ADDRESS - # echo running make-test-integration-ci - # make zksync-test-integration-ci + echo running make-test-integration-ci + make zksync-test-integration-ci - \ No newline at end of file + + +# sleep 200 +# echo catting log +# cat docker_output.log +# echo catting sed: +# cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' +# export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') +# echo after cat docker_output +# echo $ZKSYNC_DIAMOND_PROXY_ADDRESS \ No newline at end of file From e88d127f0856e2d91697a7cb978bd8ae371d419b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:30:42 -0300 Subject: [PATCH 057/111] fix: tuning env var reading --- .github/workflows/zksync-integration-test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 3a57ebc1..87f04e0a 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -31,8 +31,8 @@ jobs: cd local-setup echo starting: touch ../docker_output.log - ls ./start.sh &> ../docker_output.log & + cat ../docker_output.log # Ethereum Setup - name: Install Foundry @@ -68,9 +68,14 @@ jobs: export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} ls cat docker_output.log - echo sleeping 200 to wait for ./start to setup + echo sleeping 150 to wait for ./start to setup + echo '' + sleep 150 + echo '' + cat docker_output.log + echo '' - export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' + export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable: echo $ZKSYNC_DIAMOND_PROXY_ADDRESS From 76fa868e09d2e58450e30652ba29bf752f8aee5f Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:40:25 -0300 Subject: [PATCH 058/111] refactor: changed prefunded account for deployments --- .github/workflows/zksync-integration-test.yml | 7 ++----- .github/workflows/zksync-scripts/ci.env.test | 6 +++--- contracts/zksync/test/.env.test | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 87f04e0a..1869c0e1 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -26,13 +26,13 @@ jobs: export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} echo startung dockerized setup git clone https://github.com/matter-labs/local-setup.git - echo git cloned, starting: + echo git cloned, starting: cd local-setup + echo starting: touch ../docker_output.log ./start.sh &> ../docker_output.log & - cat ../docker_output.log # Ethereum Setup - name: Install Foundry @@ -69,11 +69,8 @@ jobs: ls cat docker_output.log echo sleeping 150 to wait for ./start to setup - echo '' sleep 150 - echo '' cat docker_output.log - echo '' export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable: diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index c0774651..6235dca8 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -5,9 +5,9 @@ ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url # ZKSYNC_DIAMOND_PROXY_ADDRESS=xxx #variable on each setup ./start.sh -ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 -MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +MM_ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds @@ -27,7 +27,7 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 ## ZKSYNC.env TEST=true -WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +WALLET_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A diff --git a/contracts/zksync/test/.env.test b/contracts/zksync/test/.env.test index 103c8cbb..76cb502b 100644 --- a/contracts/zksync/test/.env.test +++ b/contracts/zksync/test/.env.test @@ -1,7 +1,7 @@ TEST=true -WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +WALLET_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A From a2c0b53e83f34c667ba6612ad58dc4e95e323510 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:42:55 -0300 Subject: [PATCH 059/111] refactor: uncomment line for debugging failed tx --- contracts/ethereum/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index f7c00f65..8fc6a300 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -22,7 +22,7 @@ export ZKSYNC_CHAIN_ID=$ZKSYNC_CHAIN_ID echo before running forge script RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) -# echo "$RESULT_LOG" #uncomment this line for debugging in detail +echo "$RESULT_LOG" #uncomment this line for debugging in detail echo after running forge script # Getting result addresses From 12c9e91466daf2ca91424a8391889d4796aae8ab Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:50:41 -0300 Subject: [PATCH 060/111] fix: more time so ./start funds initial wallets --- .github/workflows/zksync-integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 1869c0e1..d3663d6a 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -68,8 +68,8 @@ jobs: export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} ls cat docker_output.log - echo sleeping 150 to wait for ./start to setup - sleep 150 + echo sleeping 250 to wait for ./start to setup + sleep 250 cat docker_output.log export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') From 8e135874fc0644ff50d3dc2b593cd4a1d21d62be Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:05:49 -0300 Subject: [PATCH 061/111] refactor: debugging ZKSync deploy --- contracts/ethereum/deploy.sh | 5 ++++- contracts/zksync/deploy.sh | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 8fc6a300..3c114489 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -4,6 +4,7 @@ cd contracts/ethereum printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESET}\n" +echo 'Deploying ERC1967Proxy & PaymentRegistry' export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS @@ -20,9 +21,11 @@ export STARKNET_CHAIN_ID=$STARKNET_CHAIN_ID export ZKSYNC_CHAIN_ID=$ZKSYNC_CHAIN_ID ### +echo before before running forge script echo before running forge script + RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) -echo "$RESULT_LOG" #uncomment this line for debugging in detail +# echo "$RESULT_LOG" #uncomment this line for debugging in detail echo after running forge script # Getting result addresses diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index 246c9ac8..84e3d8be 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -18,7 +18,13 @@ export WALLET_PRIVATE_KEY=$WALLET_PRIVATE_KEY export PAYMENT_REGISTRY_PROXY_ADDRESS=$PAYMENT_REGISTRY_PROXY_ADDRESS export MM_ZKSYNC_WALLET=$MM_ZKSYNC_WALLET -ZKSYNC_ESCROW_CONTRACT_ADDRESS=$(yarn $DEPLOY | grep "Contract address:" | egrep -i -o '0x[a-zA-Z0-9]{40}') +# ZKSYNC_ESCROW_CONTRACT_ADDRESS=$(yarn $DEPLOY | grep "Contract address:" | egrep -i -o '0x[a-zA-Z0-9]{40}') +echo "deploying zksync escrow" + +RESULT_LOG=$(yarn $DEPLOY) +echo $RESULT_LOG + +ZKSYNC_ESCROW_CONTRACT_ADDRESS=$(echo "$RESULT_LOG" | grep "Contract address:" | egrep -i -o '0x[a-zA-Z0-9]{40}') if [ -z "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" ]; then printf "\n${RED}ERROR:${COLOR_RESET}\n" From 8f5ea3eaec0851984d590e1ba7963d9437b72238 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:14:42 -0300 Subject: [PATCH 062/111] fix: zksync netowkr deploying --- .github/workflows/zksync-integration-test.yml | 1 + contracts/zksync/deploy.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index d3663d6a..0193e7b3 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -66,6 +66,7 @@ jobs: - name: Running integration test run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} + export TEST=true ls cat docker_output.log echo sleeping 250 to wait for ./start to setup diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index 84e3d8be..440a8480 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -14,6 +14,12 @@ if [ "$TEST" == true ]; then DEPLOY="deploy-devnet" fi +echo test +echo $TEST + +echo deploy +echo $DEPLOY + export WALLET_PRIVATE_KEY=$WALLET_PRIVATE_KEY export PAYMENT_REGISTRY_PROXY_ADDRESS=$PAYMENT_REGISTRY_PROXY_ADDRESS export MM_ZKSYNC_WALLET=$MM_ZKSYNC_WALLET From fec116b6657bc7497bef5906d357bce6611b45c8 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:21:53 -0300 Subject: [PATCH 063/111] fix: if test==true in deploy.sh zksync --- contracts/zksync/deploy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index 440a8480..24f180c3 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -10,7 +10,7 @@ if [ -z "$PAYMENT_REGISTRY_PROXY_ADDRESS" ]; then fi DEPLOY="deploy" -if [ "$TEST" == true ]; then +if [ "$TEST" == "true" ]; then DEPLOY="deploy-devnet" fi @@ -20,6 +20,8 @@ echo $TEST echo deploy echo $DEPLOY +DEPLOY="deploy-devnet" + export WALLET_PRIVATE_KEY=$WALLET_PRIVATE_KEY export PAYMENT_REGISTRY_PROXY_ADDRESS=$PAYMENT_REGISTRY_PROXY_ADDRESS export MM_ZKSYNC_WALLET=$MM_ZKSYNC_WALLET From 83663df3c5b8ce233df65a56b7f3106557566c12 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:32:10 -0300 Subject: [PATCH 064/111] fix: use alternative operator that should work in CI --- contracts/zksync/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index 24f180c3..6b5a6b7b 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -10,7 +10,7 @@ if [ -z "$PAYMENT_REGISTRY_PROXY_ADDRESS" ]; then fi DEPLOY="deploy" -if [ "$TEST" == "true" ]; then +if [ "$TEST" = "true" ]; then DEPLOY="deploy-devnet" fi From db1286fd2387bde8e5f03eebc1788869890e76fb Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:37:18 -0300 Subject: [PATCH 065/111] fix: change --chain to --rpc in zksync-cli usage --- contracts/zksync/test/claim_payment.sh | 8 ++++---- contracts/zksync/test/set_order.sh | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 5b953584..560db004 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -9,10 +9,10 @@ echo "Initial MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" echo "Initial MM balance L2:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" echo "Initial Escrow balance:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" @@ -28,7 +28,7 @@ echo "After MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" echo "After MM balance L2:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" echo "After Escrow balance:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index 1c2c5d58..06605f17 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -14,15 +14,15 @@ BRIDGE_AMOUNT_ETH=$(echo "scale=18; $BRIDGE_AMOUNT_WEI / 10^18" | bc) printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" echo "\nEscrow ZKSync funds before setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" -npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --chain "dockerized-node" --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null +npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null echo "\nUser ZKSync funds after setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" echo "\nEscrow ZKSync funds after setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" From f6a8de302a730ed2ad417f30cb14739a8ee179e2 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:46:03 -0300 Subject: [PATCH 066/111] feat: add node in ci for zksync-cli --- .github/workflows/zksync-integration-test.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 0193e7b3..2d132082 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,6 +20,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '20.11.1' + cache: 'npm' + cache-dependency-path: '**/.github/workflows/*.yml' + + - name: npx test + run: | + npx zksync-cli --version + # Run Dockerized L1-L2, goes first because it takes a lot of time - name: Setup Dockerized L1-L2 run: | From a463a5e44a2c6357c14388bbedeecc396209136c Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:56:06 -0300 Subject: [PATCH 067/111] fix: debugging set_order.sh in ZKSync CI, npx having issued --- .github/workflows/zksync-integration-test.yml | 15 ++------------- contracts/zksync/test/set_order.sh | 10 +++++++++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 2d132082..a3b05d2d 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -27,7 +27,7 @@ jobs: cache: 'npm' cache-dependency-path: '**/.github/workflows/*.yml' - - name: npx test + - name: Download zksync-cli run: | npx zksync-cli --version @@ -35,7 +35,6 @@ jobs: - name: Setup Dockerized L1-L2 run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - echo startung dockerized setup git clone https://github.com/matter-labs/local-setup.git echo git cloned, starting: @@ -78,7 +77,6 @@ jobs: run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} export TEST=true - ls cat docker_output.log echo sleeping 250 to wait for ./start to setup sleep 250 @@ -91,13 +89,4 @@ jobs: echo running make-test-integration-ci make zksync-test-integration-ci - - -# sleep 200 -# echo catting log -# cat docker_output.log -# echo catting sed: -# cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p' -# export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') -# echo after cat docker_output -# echo $ZKSYNC_DIAMOND_PROXY_ADDRESS \ No newline at end of file + \ No newline at end of file diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index 06605f17..d77800b6 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -11,18 +11,26 @@ BRIDGE_AMOUNT_WEI=$(echo "scale=0; $VALUE_WEI - $FEE" | bc) BRIDGE_AMOUNT_ETH=$(echo "scale=18; $BRIDGE_AMOUNT_WEI / 10^18" | bc) # BRIDGE_AMOUNT_WEI=$(printf "%.0f" "$BRIDGE_AMOUNT_WEI") +echo USER_ZKSYNC_PUBLIC_ADDRESS +echo $USER_ZKSYNC_PUBLIC_ADDRESS +echo ZKSYNC_ESCROW_CONTRACT_ADDRESS +echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" echo "\nEscrow ZKSync funds before setOrder:" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" -npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null +npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" #>> /dev/null echo "\nUser ZKSync funds after setOrder:" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" echo "\nEscrow ZKSync funds after setOrder:" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" From f8d612f4903b66dcebeaf203455f3e03c7d5037f Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:14:46 -0300 Subject: [PATCH 068/111] fix: set --gas-price in L1 transfer --- contracts/zksync/deploy.sh | 12 ------------ contracts/zksync/test/set_order.sh | 4 ---- contracts/zksync/test/transfer.sh | 4 ++-- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index 6b5a6b7b..08caf601 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -14,24 +14,12 @@ if [ "$TEST" = "true" ]; then DEPLOY="deploy-devnet" fi -echo test -echo $TEST - -echo deploy -echo $DEPLOY - -DEPLOY="deploy-devnet" - export WALLET_PRIVATE_KEY=$WALLET_PRIVATE_KEY export PAYMENT_REGISTRY_PROXY_ADDRESS=$PAYMENT_REGISTRY_PROXY_ADDRESS export MM_ZKSYNC_WALLET=$MM_ZKSYNC_WALLET -# ZKSYNC_ESCROW_CONTRACT_ADDRESS=$(yarn $DEPLOY | grep "Contract address:" | egrep -i -o '0x[a-zA-Z0-9]{40}') -echo "deploying zksync escrow" - RESULT_LOG=$(yarn $DEPLOY) echo $RESULT_LOG - ZKSYNC_ESCROW_CONTRACT_ADDRESS=$(echo "$RESULT_LOG" | grep "Contract address:" | egrep -i -o '0x[a-zA-Z0-9]{40}') if [ -z "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" ]; then diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index d77800b6..a479a6f4 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -18,10 +18,8 @@ echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" echo "\nEscrow ZKSync funds before setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" @@ -29,8 +27,6 @@ npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc h echo "\nUser ZKSync funds after setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" echo "\nEscrow ZKSync funds after setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index 28a38f68..1698bb08 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -15,10 +15,10 @@ echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE" echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" -cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY \ +cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ - --value $BRIDGE_AMOUNT_WEI >> /dev/null + --value $BRIDGE_AMOUNT_WEI #>> /dev/null MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) From d545c6545c31872cfe0c6ac7f6a53c61a264ff24 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:22:49 -0300 Subject: [PATCH 069/111] fix: add --gas-price to claim_payment (worked on transfer) --- contracts/zksync/test/claim_payment.sh | 2 +- contracts/zksync/test/transfer.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 560db004..f0eef796 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -18,7 +18,7 @@ npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESC echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" -cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ +cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index 1698bb08..cb83b8be 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -7,6 +7,9 @@ printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" +echo ZKSYNC_CHAIN_ID +echo $ZKSYNC_CHAIN_ID + MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) echo "Initial MM balance: $MM_INITIAL_BALANCE" From 66a29407267ea90a3dec8963ebd8a6725e72fc02 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:31:56 -0300 Subject: [PATCH 070/111] feat: wrapping up claim_payment --- .github/workflows/zksync-integration-test.yml | 3 +++ contracts/zksync/test/claim_payment.sh | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index a3b05d2d..c5fbd921 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -88,5 +88,8 @@ jobs: echo running make-test-integration-ci make zksync-test-integration-ci + + echo done make target + exit 0 \ No newline at end of file diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index f0eef796..6f1fa343 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -9,10 +9,10 @@ echo "Initial MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" echo "Initial MM balance L2:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" echo "Initial Escrow balance:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" @@ -28,7 +28,7 @@ echo "After MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" echo "After MM balance L2:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" echo "After Escrow balance:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" +npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" From 30b2e8e1980885e3076812f6a8bbf6d9ccd9f4e6 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:09:22 -0300 Subject: [PATCH 071/111] feat: add assert.sh at the end of CI --- .github/workflows/zksync-integration-test.yml | 3 +- .github/workflows/zksync-scripts/assert.sh | 29 +++++++++++++++++++ contracts/zksync/test/claim_payment.sh | 6 ++-- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/zksync-scripts/assert.sh diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index c5fbd921..ad65c3bb 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -89,7 +89,8 @@ jobs: echo running make-test-integration-ci make zksync-test-integration-ci - echo done make target + ./.github/workflows/zksync-scripts/assert.sh + exit 0 \ No newline at end of file diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh new file mode 100644 index 00000000..4fa9a953 --- /dev/null +++ b/.github/workflows/zksync-scripts/assert.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +. contracts/utils/colors.sh #for ANSI colors + +assert() { + # Usage: assert + if eval "$1"; then + printf "${GREEN}✓ $2 passed.${RESET}\n" + else + printf "${RED}⨯ $2 assertion failed: Expected value: $3, Obtained value: $4.${RESET}\n" + exit 1 + fi +} + +echo "" +assert " [[ MM_INITIAL_BALANCE_L1 -eq 99999998999999999999.994843134499267961 ]]" "MM_INITIAL_BALANCE_L1" "99999998999999999999.994843134499267961" "MM_INITIAL_BALANCE_L1" +assert " [[ MM_AFTER_BALANCE_L1 -eq 99999998999999999999.994843134499267961 ]]" "MM_AFTER_BALANCE_L1" "99999998999999999999.994843134499267961" "MM_AFTER_BALANCE_L1" + +# DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC $DESTINATION_ADDRESS) +# EXPECTED_DESTINATION_FINAL_BALANCE=10001000000000000000000 +# assert "[[ $DESTINATION_FINAL_BALANCE -eq $EXPECTED_DESTINATION_FINAL_BALANCE ]]" "Destination balance" "$EXPECTED_DESTINATION_FINAL_BALANCE" "$DESTINATION_FINAL_BALANCE" + +# ESCROW_FINAL_BALANCE=$(starkli balance --raw $ESCROW_CONTRACT_ADDRESS) +# EXPECTED_ESCROW_FINAL_BALANCE=0 +# assert "[[ $ESCROW_FINAL_BALANCE -eq $EXPECTED_ESCROW_FINAL_BALANCE ]]" "Escrow balance" "$EXPECTED_ESCROW_FINAL_BALANCE" "$ESCROW_FINAL_BALANCE" + +# MM_FINAL_BALANCE=$(starkli balance --raw $MM_STARKNET_WALLET_ADDRESS) +# EXPECTED_MM_FINAL_BALANCE=1001000025000000000000 +# assert "[[ $MM_FINAL_BALANCE -eq $EXPECTED_MM_FINAL_BALANCE ]]" "MM balance" "$EXPECTED_MM_FINAL_BALANCE" "$MM_FINAL_BALANCE" diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 6f1fa343..8ba75695 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -4,7 +4,7 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +export MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) echo "Initial MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" @@ -23,9 +23,9 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +export MM_AFTER_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) echo "After MM balance L1:" -echo "$MM_INITIAL_BALANCE_L1" +echo "$MM_AFTER_BALANCE_L1" echo "After MM balance L2:" npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" From b8ce12270c57a40e45840b2368ce9053c83ba754 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:25:35 -0300 Subject: [PATCH 072/111] fix: assert.sh in CI --- .github/workflows/zksync-integration-test.yml | 2 -- .github/workflows/zksync-scripts/assert.sh | 4 ++-- Makefile | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 .github/workflows/zksync-scripts/assert.sh diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index ad65c3bb..473f7915 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -89,8 +89,6 @@ jobs: echo running make-test-integration-ci make zksync-test-integration-ci - ./.github/workflows/zksync-scripts/assert.sh - exit 0 \ No newline at end of file diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh old mode 100644 new mode 100755 index 4fa9a953..57ba36b6 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -13,8 +13,8 @@ assert() { } echo "" -assert " [[ MM_INITIAL_BALANCE_L1 -eq 99999998999999999999.994843134499267961 ]]" "MM_INITIAL_BALANCE_L1" "99999998999999999999.994843134499267961" "MM_INITIAL_BALANCE_L1" -assert " [[ MM_AFTER_BALANCE_L1 -eq 99999998999999999999.994843134499267961 ]]" "MM_AFTER_BALANCE_L1" "99999998999999999999.994843134499267961" "MM_AFTER_BALANCE_L1" +assert " [[ $MM_INITIAL_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_INITIAL_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_INITIAL_BALANCE_L1" +assert " [[ $MM_AFTER_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_AFTER_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_AFTER_BALANCE_L1" # DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC $DESTINATION_ADDRESS) # EXPECTED_DESTINATION_FINAL_BALANCE=10001000000000000000000 diff --git a/Makefile b/Makefile index 8e2dd8b5..6867364f 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,8 @@ zksync-test-integration-ci: . ./contracts/ethereum/set_zksync_escrow.sh && \ . ./contracts/zksync/test/set_order.sh && \ . ./contracts/zksync/test/transfer.sh && \ - . ./contracts/zksync/test/claim_payment.sh + . ./contracts/zksync/test/claim_payment.sh && \ + . ./.github/workflows/zksync-scripts/assert.sh #old version: zksync-test-integration-local: @@ -121,7 +122,8 @@ zksync-test-integration-local: . ./contracts/ethereum/set_zksync_escrow.sh && \ . ./contracts/zksync/test/set_order.sh && \ . ./contracts/zksync/test/transfer.sh && \ - . ./contracts/zksync/test/claim_payment.sh + . ./contracts/zksync/test/claim_payment.sh && \ + . ./.github/workflows/zksync-scripts/assert.sh # zksync-upgrade: WIP From eccee09a5bc2ec4cc6b40629aa58a9a1d450a513 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:35:28 -0300 Subject: [PATCH 073/111] fix: remove decimals from eth get balance --- .../workflows/zksync-scripts/claim_payment.sh | 34 ------------------- .github/workflows/zksync-scripts/set_order.sh | 28 --------------- .github/workflows/zksync-scripts/transfer.sh | 27 --------------- contracts/zksync/test/claim_payment.sh | 4 +-- 4 files changed, 2 insertions(+), 91 deletions(-) delete mode 100755 .github/workflows/zksync-scripts/claim_payment.sh delete mode 100755 .github/workflows/zksync-scripts/set_order.sh delete mode 100755 .github/workflows/zksync-scripts/transfer.sh diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh deleted file mode 100755 index 5b953584..00000000 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -. contracts/utils/colors.sh #for ANSI colors - -printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" - -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -echo "Initial MM balance L1:" -echo "$MM_INITIAL_BALANCE_L1" - -echo "Initial MM balance L2:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" - -echo "Initial Escrow balance:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" - - -echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" -echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" - -cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY \ - $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ - "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ - --value 5000000000000000000 - -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -echo "After MM balance L1:" -echo "$MM_INITIAL_BALANCE_L1" - -echo "After MM balance L2:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$MM_ZKSYNC_WALLET" | grep -E -o "\d+(\.\d+)? ETH" - -echo "After Escrow balance:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh deleted file mode 100755 index 1c2c5d58..00000000 --- a/.github/workflows/zksync-scripts/set_order.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# cast call 0x97589bcE7727f5D0C8082440681DB6092b6Dda1a "getNames()(string)" --rpc-url http://localhost:8545 -# exit - -. contracts/utils/colors.sh #for ANSI colors - -FEE=10000000000000000 #in WEI -VALUE=2 #in ETH -VALUE_WEI=$(echo "scale=0; $VALUE * 10^18" | bc) -BRIDGE_AMOUNT_WEI=$(echo "scale=0; $VALUE_WEI - $FEE" | bc) -BRIDGE_AMOUNT_ETH=$(echo "scale=18; $BRIDGE_AMOUNT_WEI / 10^18" | bc) -# BRIDGE_AMOUNT_WEI=$(printf "%.0f" "$BRIDGE_AMOUNT_WEI") - - -printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" -echo "\nUser ZKSync funds before setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" -echo "\nEscrow ZKSync funds before setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" - - -npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --chain "dockerized-node" --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null - - -echo "\nUser ZKSync funds after setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" -echo "\nEscrow ZKSync funds after setOrder:" -npx zksync-cli wallet balance --chain "dockerized-node" --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -E -o "\d+(\.\d+)? ETH" diff --git a/.github/workflows/zksync-scripts/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh deleted file mode 100755 index 28a38f68..00000000 --- a/.github/workflows/zksync-scripts/transfer.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -. contracts/utils/colors.sh #for ANSI colors - -# export DESTINATION_ADDRESS=0xceee57f2b700c2f37d1476a7974965e149fce2d4 -# export DESTINATION_ADDRESS_UINT=1181367337507422765615536123397692015769584198356 - -printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" - -MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "Initial MM balance: $MM_INITIAL_BALANCE" -echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE" - - -echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" - -cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY \ - $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ - "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ - --value $BRIDGE_AMOUNT_WEI >> /dev/null - - -MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "Final MM balance: $MM_FINAL_BALANCE" -echo "Final Destination balance: $DESTINATION_FINAL_BALANCE" diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 8ba75695..f9432c3d 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -4,7 +4,7 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" -export MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "Initial MM balance L1:" echo "$MM_INITIAL_BALANCE_L1" @@ -23,7 +23,7 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 -export MM_AFTER_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +MM_AFTER_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "After MM balance L1:" echo "$MM_AFTER_BALANCE_L1" From c5a70a3cedf0a493fa62c3a901b8fb3902e88d70 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 11:48:55 -0300 Subject: [PATCH 074/111] fix(wip): asseert.sh values at the end of CI --- .github/workflows/zksync-scripts/assert.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 57ba36b6..f60aeb6c 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -8,7 +8,7 @@ assert() { printf "${GREEN}✓ $2 passed.${RESET}\n" else printf "${RED}⨯ $2 assertion failed: Expected value: $3, Obtained value: $4.${RESET}\n" - exit 1 + # exit 1 fi } @@ -27,3 +27,8 @@ assert " [[ $MM_AFTER_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" # MM_FINAL_BALANCE=$(starkli balance --raw $MM_STARKNET_WALLET_ADDRESS) # EXPECTED_MM_FINAL_BALANCE=1001000025000000000000 # assert "[[ $MM_FINAL_BALANCE -eq $EXPECTED_MM_FINAL_BALANCE ]]" "MM balance" "$EXPECTED_MM_FINAL_BALANCE" "$MM_FINAL_BALANCE" + +if [ ! "$MM_INITIAL_BALANCE_L1" = "99999998999999999999994843134499267961" ]; then + echo Error in MM_INITIAL_BALANCE_L1 +fi + From d922b965355dba1041072bdecc07eb4d7cbb8416 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:25:37 -0300 Subject: [PATCH 075/111] feat: save all balances during zksync integration test process --- .github/workflows/zksync-scripts/assert.sh | 33 +++++++++++++++++----- contracts/zksync/test/claim_payment.sh | 20 +++++++------ contracts/zksync/test/set_order.sh | 15 ++++++---- contracts/zksync/test/transfer.sh | 23 ++++++--------- 4 files changed, 56 insertions(+), 35 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index f60aeb6c..9ab1792a 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -12,9 +12,9 @@ assert() { fi } -echo "" -assert " [[ $MM_INITIAL_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_INITIAL_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_INITIAL_BALANCE_L1" -assert " [[ $MM_AFTER_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_AFTER_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_AFTER_BALANCE_L1" +# echo "" +# assert " [[ $MM_INITIAL_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_INITIAL_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_INITIAL_BALANCE_L1" +# assert " [[ $MM_AFTER_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_AFTER_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_AFTER_BALANCE_L1" # DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC $DESTINATION_ADDRESS) # EXPECTED_DESTINATION_FINAL_BALANCE=10001000000000000000000 @@ -28,7 +28,26 @@ assert " [[ $MM_AFTER_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" # EXPECTED_MM_FINAL_BALANCE=1001000025000000000000 # assert "[[ $MM_FINAL_BALANCE -eq $EXPECTED_MM_FINAL_BALANCE ]]" "MM balance" "$EXPECTED_MM_FINAL_BALANCE" "$MM_FINAL_BALANCE" -if [ ! "$MM_INITIAL_BALANCE_L1" = "99999998999999999999994843134499267961" ]; then - echo Error in MM_INITIAL_BALANCE_L1 -fi - +# if [ ! "$MM_INITIAL_BALANCE_L1" = "99999998999999999999994843134499267961" ]; then +# echo Error in MM_INITIAL_BALANCE_L1 +# fi + +#setorder +echo $BALANCE_USER_L2_BEFORE_SETORDER +echo $BALANCE_ESCROW_L2_BEFORE_SETORDER +echo $BALANCE_USER_L2_AFTER_SETORDER +echo $BALANCE_ESCROW_L2_AFTER_SETORDER + +#transfer +echo $BALANCE_MM_L1_BEFORE_TRANSFER +echo $BALANCE_USER_L1_BEFORE_TRANSFER +echo $BALANCE_MM_L1_AFTER_TRANSFER +echo $BALANCE_USER_L1_AFTER_TRANSFER + +#claimpeyment +echo $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT +echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT +echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT +echo $BALANCE_MM_L1_AFTER_CLAIMPAYMENT +echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT +echo $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT \ No newline at end of file diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index f9432c3d..f1e94c0d 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -4,16 +4,17 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" -MM_INITIAL_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "Initial MM balance L1:" -echo "$MM_INITIAL_BALANCE_L1" +BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) +echo "$BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" echo "Initial MM balance L2:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT echo "Initial Escrow balance:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" - +BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" @@ -23,12 +24,13 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 -MM_AFTER_BALANCE_L1=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "After MM balance L1:" -echo "$MM_AFTER_BALANCE_L1" +BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) +echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" echo "After MM balance L2:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT echo "After Escrow balance:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index a479a6f4..579e75ad 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -18,15 +18,20 @@ echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" +BALANCE_USER_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo $BALANCE_USER_L2_BEFORE_SETORDER + echo "\nEscrow ZKSync funds before setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" +BALANCE_ESCROW_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo $BALANCE_ESCROW_L2_BEFORE_SETORDER -npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" #>> /dev/null +echo "\n Executing Set Order" +npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null echo "\nUser ZKSync funds after setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" +BALANCE_USER_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') + echo "\nEscrow ZKSync funds after setOrder:" -npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" +BALANCE_ESCROW_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index cb83b8be..c0429414 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -2,18 +2,13 @@ . contracts/utils/colors.sh #for ANSI colors -# export DESTINATION_ADDRESS=0xceee57f2b700c2f37d1476a7974965e149fce2d4 -# export DESTINATION_ADDRESS_UINT=1181367337507422765615536123397692015769584198356 - printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" -echo ZKSYNC_CHAIN_ID -echo $ZKSYNC_CHAIN_ID -MM_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -DESTINATION_INITIAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "Initial MM balance: $MM_INITIAL_BALANCE" -echo "Initial Destination balance: $DESTINATION_INITIAL_BALANCE" +BALANCE_MM_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +BALANCE_USER_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) +echo "Initial MM balance: $BALANCE_MM_L1_BEFORE_TRANSFER" +echo "Initial Destination balance: $BALANCE_USER_L1_BEFORE_TRANSFER" echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" @@ -21,10 +16,10 @@ echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ - --value $BRIDGE_AMOUNT_WEI #>> /dev/null + --value $BRIDGE_AMOUNT_WEI >> /dev/null -MM_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "Final MM balance: $MM_FINAL_BALANCE" -echo "Final Destination balance: $DESTINATION_FINAL_BALANCE" +BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) +BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) +echo "Final MM balance: $BALANCE_MM_L1_AFTER_TRANSFER" +echo "Final Destination balance: $BALANCE_USER_L1_AFTER_TRANSFER" From 424ed54978df3cb5ec1b84957d466c795eadf063 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:26:02 -0300 Subject: [PATCH 076/111] refactor: format of saved variables --- .github/workflows/zksync-scripts/assert.sh | 5 +++++ contracts/zksync/test/claim_payment.sh | 23 +++++++++++----------- contracts/zksync/test/set_order.sh | 12 ++++++----- contracts/zksync/test/transfer.sh | 20 +++++++++++-------- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 9ab1792a..cc863261 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -32,19 +32,24 @@ assert() { # echo Error in MM_INITIAL_BALANCE_L1 # fi +echo "in assert.sh\n" + #setorder +echo setOrder echo $BALANCE_USER_L2_BEFORE_SETORDER echo $BALANCE_ESCROW_L2_BEFORE_SETORDER echo $BALANCE_USER_L2_AFTER_SETORDER echo $BALANCE_ESCROW_L2_AFTER_SETORDER #transfer +echo transfer echo $BALANCE_MM_L1_BEFORE_TRANSFER echo $BALANCE_USER_L1_BEFORE_TRANSFER echo $BALANCE_MM_L1_AFTER_TRANSFER echo $BALANCE_USER_L1_AFTER_TRANSFER #claimpeyment +echo claimPayment echo $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index f1e94c0d..9820a7e4 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -4,33 +4,32 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" -echo "Initial MM balance L1:" +echo "\nMM L1 funds before Claim Payment" BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "$BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" -echo "Initial MM balance L2:" -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo "\nMM L2 funds before Claim Payment" +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT -echo "Initial Escrow balance:" -BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo "\nEscrow L2 funds before Claim Payment" +BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT -echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" -echo "Withdrawing $BRIDGE_AMOUNT_WEI WEI" +echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH == $BRIDGE_AMOUNT_WEI WEI" cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 -echo "After MM balance L1:" +echo "\nMM L1 funds after Claim Payment" BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" -echo "After MM balance L2:" -BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo "\nMM L2 funds after Claim Payment" +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT -echo "After Escrow balance:" -BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +echo "\nEscrow L2 funds after Claim Payment" +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index 579e75ad..76de536c 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -18,20 +18,22 @@ echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" -BALANCE_USER_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +BALANCE_USER_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') echo $BALANCE_USER_L2_BEFORE_SETORDER echo "\nEscrow ZKSync funds before setOrder:" -BALANCE_ESCROW_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +BALANCE_ESCROW_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') echo $BALANCE_ESCROW_L2_BEFORE_SETORDER -echo "\n Executing Set Order" +echo "\nExecuting Set Order" npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null echo "\nUser ZKSync funds after setOrder:" -BALANCE_USER_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +BALANCE_USER_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +echo $BALANCE_USER_L2_AFTER_SETORDER echo "\nEscrow ZKSync funds after setOrder:" -BALANCE_ESCROW_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//g') +BALANCE_ESCROW_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +echo $BALANCE_ESCROW_L2_AFTER_SETORDER \ No newline at end of file diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index c0429414..1b03d78a 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -4,11 +4,13 @@ printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" +echo "\nMM L1 funds before transfer:" +BALANCE_MM_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) +echo $BALANCE_MM_L1_BEFORE_TRANSFER -BALANCE_MM_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -BALANCE_USER_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "Initial MM balance: $BALANCE_MM_L1_BEFORE_TRANSFER" -echo "Initial Destination balance: $BALANCE_USER_L1_BEFORE_TRANSFER" +echo "\nUser L1 funds before transfer:" +BALANCE_USER_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) +echo $BALANCE_USER_L1_BEFORE_TRANSFER echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" @@ -18,8 +20,10 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-p "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ --value $BRIDGE_AMOUNT_WEI >> /dev/null +echo "\nMM L1 funds after transfer:" +BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) +echo $BALANCE_MM_L1_AFTER_TRANSFER -BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $MM_ETHEREUM_WALLET_ADDRESS) -BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "Final MM balance: $BALANCE_MM_L1_AFTER_TRANSFER" -echo "Final Destination balance: $BALANCE_USER_L1_AFTER_TRANSFER" +echo "\nUser L1 funds after transfer:" +BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) +echo $BALANCE_MM_L1_AFTER_TRANSFER From 175c4b4473928aaf3b99a8fb28761122f147f8f0 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:52:26 -0300 Subject: [PATCH 077/111] feat: set assert values --- .github/workflows/zksync-scripts/assert.sh | 61 +++++++--------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index cc863261..a570b00a 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -2,57 +2,36 @@ . contracts/utils/colors.sh #for ANSI colors +echo "Asserting values" + assert() { - # Usage: assert - if eval "$1"; then - printf "${GREEN}✓ $2 passed.${RESET}\n" + #Usage: assert + if [ $2 = $3 ] ; then + printf "${GREEN}✓ $1 passed.${RESET}\n" else - printf "${RED}⨯ $2 assertion failed: Expected value: $3, Obtained value: $4.${RESET}\n" - # exit 1 + printf "${RED}x $1 assertion failed: Expected value: $2, Obtained value: $3.${RESET}\n" fi } -# echo "" -# assert " [[ $MM_INITIAL_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_INITIAL_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_INITIAL_BALANCE_L1" -# assert " [[ $MM_AFTER_BALANCE_L1 -eq 99999998999999999999994843134499267961 ]]" "MM_AFTER_BALANCE_L1" "99999998999999999999994843134499267961" "$MM_AFTER_BALANCE_L1" - -# DESTINATION_FINAL_BALANCE=$(cast balance --rpc-url $ETHEREUM_RPC $DESTINATION_ADDRESS) -# EXPECTED_DESTINATION_FINAL_BALANCE=10001000000000000000000 -# assert "[[ $DESTINATION_FINAL_BALANCE -eq $EXPECTED_DESTINATION_FINAL_BALANCE ]]" "Destination balance" "$EXPECTED_DESTINATION_FINAL_BALANCE" "$DESTINATION_FINAL_BALANCE" - -# ESCROW_FINAL_BALANCE=$(starkli balance --raw $ESCROW_CONTRACT_ADDRESS) -# EXPECTED_ESCROW_FINAL_BALANCE=0 -# assert "[[ $ESCROW_FINAL_BALANCE -eq $EXPECTED_ESCROW_FINAL_BALANCE ]]" "Escrow balance" "$EXPECTED_ESCROW_FINAL_BALANCE" "$ESCROW_FINAL_BALANCE" - -# MM_FINAL_BALANCE=$(starkli balance --raw $MM_STARKNET_WALLET_ADDRESS) -# EXPECTED_MM_FINAL_BALANCE=1001000025000000000000 -# assert "[[ $MM_FINAL_BALANCE -eq $EXPECTED_MM_FINAL_BALANCE ]]" "MM balance" "$EXPECTED_MM_FINAL_BALANCE" "$MM_FINAL_BALANCE" - -# if [ ! "$MM_INITIAL_BALANCE_L1" = "99999998999999999999994843134499267961" ]; then -# echo Error in MM_INITIAL_BALANCE_L1 -# fi - -echo "in assert.sh\n" - #setorder echo setOrder -echo $BALANCE_USER_L2_BEFORE_SETORDER -echo $BALANCE_ESCROW_L2_BEFORE_SETORDER -echo $BALANCE_USER_L2_AFTER_SETORDER -echo $BALANCE_ESCROW_L2_AFTER_SETORDER +assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607 +assert BALANCE_ESCROW_L2_BEFORE_SETORDER $BALANCE_ESCROW_L2_BEFORE_SETORDER 0 +assert BALANCE_USER_L2_AFTER_SETORDER $BALANCE_USER_L2_AFTER_SETORDER 99999999999800292778275 +assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2 #transfer echo transfer -echo $BALANCE_MM_L1_BEFORE_TRANSFER -echo $BALANCE_USER_L1_BEFORE_TRANSFER -echo $BALANCE_MM_L1_AFTER_TRANSFER -echo $BALANCE_USER_L1_AFTER_TRANSFER +assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843134499267961 +assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 +assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999999994843134499267961 +assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 #claimpeyment echo claimPayment -echo $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT -echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT -echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT -echo $BALANCE_MM_L1_AFTER_CLAIMPAYMENT -echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT -echo $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT \ No newline at end of file +assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT 99999998999999999999994843134499267961 +assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 1000000000000002977607 +assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 +assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999999994843134499267961 +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002002977607 +assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 From e9e95cda8d718269315deacf9da650af4676dcd1 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:05:52 -0300 Subject: [PATCH 078/111] refactor: tidy .yml --- .github/workflows/zksync-integration-test.yml | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 473f7915..fdcfe0ba 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,16 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: actions/setup-node@v2 - with: - node-version: '20.11.1' - cache: 'npm' - cache-dependency-path: '**/.github/workflows/*.yml' - - - name: Download zksync-cli - run: | - npx zksync-cli --version + # Run Dockerized L1-L2, goes first because it takes a lot of time - name: Setup Dockerized L1-L2 @@ -52,16 +43,23 @@ jobs: run: | cd contracts/ethereum forge install - - # - name: Install Ethereum foundry - # run: | - # make install-ethereum-foundry # ZKSync Setup - name: Install ZKSync libraries run: | cd ./contracts/zksync/ && yarn install + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '20.11.1' + cache: 'npm' + cache-dependency-path: '**/.github/workflows/*.yml' + + - name: Download zksync-cli + run: | + npx zksync-cli --version + # Build Ethereum Contract - name: Build Ethereum Contract run: | @@ -77,9 +75,10 @@ jobs: run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} export TEST=true - cat docker_output.log + echo sleeping 250 to wait for ./start to setup sleep 250 + cat docker_output.log export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') From d5e5ef8a639fc1b988690903e3a59ef2dfcc91e9 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:18:49 -0300 Subject: [PATCH 079/111] refactor: tidy up comments and prints for PR --- .github/workflows/zksync-scripts/ci.env.test | 2 +- Makefile | 4 ++-- contracts/ethereum/deploy.sh | 8 +++----- contracts/zksync/deploy.sh | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index 6235dca8..e5307e86 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -17,7 +17,7 @@ ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae ZKSYNC_CHAIN_ID=300 -#irrelevant SN variables +#irrelevant but required SN variables STARKNET_CLAIM_PAYMENT_SELECTOR=0x03636c566f6409560d55d5f6d1eb4ee163b096b4698c503e69e210be79de2afa STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=0x0354a01e49fe07e43306a97ed84dbd5de8238c7d8ff616caa3444630cfc559e6 STARKNET_MESSAGING_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 diff --git a/Makefile b/Makefile index 6867364f..e7dc15bc 100644 --- a/Makefile +++ b/Makefile @@ -105,8 +105,8 @@ zksync-test-in-memory: zksync-build #wip CI: zksync-test-integration-ci: @. ./.github/workflows/zksync-scripts/ci.env.test && \ - echo deploying eth && . ./contracts/ethereum/deploy.sh && \ - echo deploying zksync && . ./contracts/zksync/deploy.sh && \ + . ./contracts/ethereum/deploy.sh && \ + . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ . ./contracts/zksync/test/set_order.sh && \ . ./contracts/zksync/test/transfer.sh && \ diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index 3c114489..ca4016be 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -6,10 +6,10 @@ cd contracts/ethereum printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESET}\n" echo 'Deploying ERC1967Proxy & PaymentRegistry' +### These values are not correctly interpreted by the CI environment otherwise. +### Locally, this has no effect export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS - -### export STARKNET_MESSAGING_ADDRESS=$STARKNET_MESSAGING_ADDRESS export STARKNET_CLAIM_PAYMENT_SELECTOR=$STARKNET_CLAIM_PAYMENT_SELECTOR export STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=$STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR @@ -21,12 +21,10 @@ export STARKNET_CHAIN_ID=$STARKNET_CHAIN_ID export ZKSYNC_CHAIN_ID=$ZKSYNC_CHAIN_ID ### -echo before before running forge script -echo before running forge script RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail -echo after running forge script + # Getting result addresses PAYMENT_REGISTRY_PROXY_ADDRESS=$(echo "$RESULT_LOG" | grep -Eo '0: address ([^\n]+)' | awk '{print $NF}') diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index 08caf601..ac6d5373 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -19,7 +19,7 @@ export PAYMENT_REGISTRY_PROXY_ADDRESS=$PAYMENT_REGISTRY_PROXY_ADDRESS export MM_ZKSYNC_WALLET=$MM_ZKSYNC_WALLET RESULT_LOG=$(yarn $DEPLOY) -echo $RESULT_LOG +# echo $RESULT_LOG #uncomment this line for debugging ZKSYNC_ESCROW_CONTRACT_ADDRESS=$(echo "$RESULT_LOG" | grep "Contract address:" | egrep -i -o '0x[a-zA-Z0-9]{40}') if [ -z "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" ]; then From 703e52d34f8b829650229504c114a234ded89c58 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:23:08 -0300 Subject: [PATCH 080/111] refactor: clean up code --- Makefile | 2 -- contracts/ethereum/deploy.sh | 1 - contracts/zksync/test/claim_payment.sh | 1 - contracts/zksync/test/transfer.sh | 2 -- 4 files changed, 6 deletions(-) diff --git a/Makefile b/Makefile index e7dc15bc..64b77d1f 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,6 @@ zksync-test: zksync-build zksync-test-in-memory: zksync-build @cd ./contracts/zksync/ && yarn test-in-memory -#wip CI: zksync-test-integration-ci: @. ./.github/workflows/zksync-scripts/ci.env.test && \ . ./contracts/ethereum/deploy.sh && \ @@ -113,7 +112,6 @@ zksync-test-integration-ci: . ./contracts/zksync/test/claim_payment.sh && \ . ./.github/workflows/zksync-scripts/assert.sh -#old version: zksync-test-integration-local: @make ethereum-build && make zksync-build && \ . ./contracts/ethereum/test/.env.test && . ./contracts/zksync/test/.env.test && \ diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index ca4016be..edb313cc 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -4,7 +4,6 @@ cd contracts/ethereum printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESET}\n" -echo 'Deploying ERC1967Proxy & PaymentRegistry' ### These values are not correctly interpreted by the CI environment otherwise. ### Locally, this has no effect diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 9820a7e4..8104cbda 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -17,7 +17,6 @@ BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH == $BRIDGE_AMOUNT_WEI WEI" - cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index 1b03d78a..c5a7cc30 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -12,9 +12,7 @@ echo "\nUser L1 funds before transfer:" BALANCE_USER_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) echo $BALANCE_USER_L1_BEFORE_TRANSFER - echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" - cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ From 0803452e055c70cf9334ce373147d448e415a70d Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:47:16 -0300 Subject: [PATCH 081/111] refactor: assert tidy + .env pub key of MM L1 --- .github/workflows/zksync-scripts/assert.sh | 11 +++++++++-- .github/workflows/zksync-scripts/ci.env.test | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index a570b00a..7f77cd9f 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -3,13 +3,15 @@ . contracts/utils/colors.sh #for ANSI colors echo "Asserting values" +FAILED=false assert() { - #Usage: assert + #Usage: assert if [ $2 = $3 ] ; then printf "${GREEN}✓ $1 passed.${RESET}\n" else - printf "${RED}x $1 assertion failed: Expected value: $2, Obtained value: $3.${RESET}\n" + printf "${RED}x $1 assertion failed: Obtained value: $2, Expected value: $3.${RESET}\n" + FAILED=true fi } @@ -34,4 +36,9 @@ assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 1000 assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999999994843134499267961 assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002002977607 +assert BALANCE_MM_L2_CHANGE_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT-$BALANCE_MM_L2_BEFORE_CLAIMPAYMENT)) 2000000000 assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 + +if $FAILED; then + exit 1 +fi \ No newline at end of file diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index e5307e86..f27eb764 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -8,7 +8,7 @@ ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 MM_ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 -MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 +MM_ETHEREUM_WALLET_ADDRESS=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds From 3c0fd4746ddfc534bbdacfc305966ec3b9afee62 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 14:08:22 -0300 Subject: [PATCH 082/111] fix: new correct expected assert values --- .github/workflows/zksync-scripts/assert.sh | 6 +++--- .github/workflows/zksync-scripts/ci.env.test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 7f77cd9f..0c4f91d3 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -24,14 +24,14 @@ assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2 #transfer echo transfer -assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843134499267961 +assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843170481493316 assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999999994843134499267961 +assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999998004754423480872087 assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 #claimpeyment echo claimPayment -assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT 99999998999999999999994843134499267961 +assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT 99999998999999999998004754423480872087 assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 1000000000000002977607 assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999999994843134499267961 diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index f27eb764..475818ba 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -28,7 +28,7 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 TEST=true WALLET_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 -MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 +MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 1 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A From bc948bd0bf781161f6e68e990993c1f688b7be91 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:10:34 -0300 Subject: [PATCH 083/111] refactor: tuning assert.sh values --- .github/workflows/zksync-scripts/assert.sh | 18 +++++++++--------- .github/workflows/zksync-scripts/ci.env.test | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 0c4f91d3..92010e35 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -17,28 +17,28 @@ assert() { #setorder echo setOrder -assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607 +assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607 # assert BALANCE_ESCROW_L2_BEFORE_SETORDER $BALANCE_ESCROW_L2_BEFORE_SETORDER 0 -assert BALANCE_USER_L2_AFTER_SETORDER $BALANCE_USER_L2_AFTER_SETORDER 99999999999800292778275 +assert BALANCE_USER_L2_AFTER_SETORDER $BALANCE_USER_L2_AFTER_SETORDER 99999999999800292778275 # assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2 #transfer echo transfer -assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843170481493316 +assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843170481493316 # assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999998004754423480872087 +assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999998004754423480872087 # assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 #claimpeyment echo claimPayment -assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT 99999998999999999998004754423480872087 -assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 1000000000000002977607 +assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_TRANSFER +assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 1000000000000002977607 # assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 -assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999999994843134499267961 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002002977607 +assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999999994843134499267961 # +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002002977607 # assert BALANCE_MM_L2_CHANGE_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT-$BALANCE_MM_L2_BEFORE_CLAIMPAYMENT)) 2000000000 assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 if $FAILED; then exit 1 -fi \ No newline at end of file +fi diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index 475818ba..f63828e7 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -28,7 +28,7 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 TEST=true WALLET_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 -MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 1 +MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A From bba9949d1f5efeda8a1c1b47f1b8ba0bfe78e932 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:28:50 -0300 Subject: [PATCH 084/111] fix: tuning assert.sh --- .github/workflows/zksync-scripts/assert.sh | 10 +++++----- contracts/zksync/test/claim_payment.sh | 1 + contracts/zksync/test/transfer.sh | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 92010e35..4a48f879 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -24,18 +24,18 @@ assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2 #transfer echo transfer -assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843170481493316 # +assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843170481493400 # assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999998004754423480872087 # +assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999998004754423480872171 # assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 #claimpeyment echo claimPayment assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_TRANSFER -assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 1000000000000002977607 # +assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 100000000000000268251975 # assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 -assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999999994843134499267961 # -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002002977607 # +assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999993004619721479929257 # +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 100000000000700216110175 # assert BALANCE_MM_L2_CHANGE_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT-$BALANCE_MM_L2_BEFORE_CLAIMPAYMENT)) 2000000000 assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 8104cbda..11c7de4f 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -32,3 +32,4 @@ echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT echo "\nEscrow L2 funds after Claim Payment" BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +echo $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT diff --git a/contracts/zksync/test/transfer.sh b/contracts/zksync/test/transfer.sh index c5a7cc30..6fdf7166 100755 --- a/contracts/zksync/test/transfer.sh +++ b/contracts/zksync/test/transfer.sh @@ -24,4 +24,4 @@ echo $BALANCE_MM_L1_AFTER_TRANSFER echo "\nUser L1 funds after transfer:" BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) -echo $BALANCE_MM_L1_AFTER_TRANSFER +echo $BALANCE_USER_L1_AFTER_TRANSFER From ce7f32f6222eb7b85aa05181b78c2243d827fe39 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:08:58 -0300 Subject: [PATCH 085/111] fix: zksync values in wei --- .github/workflows/zksync-scripts/assert.sh | 16 ++++++++++++++++ contracts/zksync/test/claim_payment.sh | 8 ++++---- contracts/zksync/test/set_order.sh | 8 ++++---- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 4a48f879..f16ef791 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -15,6 +15,22 @@ assert() { fi } +# assert_aprox() { +# #Usage: assert +# lower_bound=$(echo "$3 - $4)" | bc) +# upper_bound=$(echo "$3 + $4)" | bc) + +# echo $lower_bound +# echo $upper_bound + +# if (( $2 >= lower_bound && $2 <= upper_bound )); then +# printf "${GREEN}✓ $1 passed.${RESET}\n" +# else +# printf "${RED}x $1 assertion failed: Obtained value: $2, Expected value: $3.${RESET}\n" +# FAILED=true +# fi +# } + #setorder echo setOrder assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607 # diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index 11c7de4f..a88cf730 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -9,11 +9,11 @@ BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETH echo "$BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" echo "\nMM L2 funds before Claim Payment" -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT echo "\nEscrow L2 funds before Claim Payment" -BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH == $BRIDGE_AMOUNT_WEI WEI" @@ -27,9 +27,9 @@ BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHE echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" echo "\nMM L2 funds after Claim Payment" -BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT echo "\nEscrow L2 funds after Claim Payment" -BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index 76de536c..790c5e3c 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -18,11 +18,11 @@ echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" -BALANCE_USER_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_USER_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_USER_L2_BEFORE_SETORDER echo "\nEscrow ZKSync funds before setOrder:" -BALANCE_ESCROW_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_ESCROW_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_ESCROW_L2_BEFORE_SETORDER @@ -31,9 +31,9 @@ npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc h echo "\nUser ZKSync funds after setOrder:" -BALANCE_USER_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_USER_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_USER_L2_AFTER_SETORDER echo "\nEscrow ZKSync funds after setOrder:" -BALANCE_ESCROW_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | sed 's/\.//g') +BALANCE_ESCROW_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') echo $BALANCE_ESCROW_L2_AFTER_SETORDER \ No newline at end of file From 50810c9d2a607e4a69171582ddbe5b732f83762b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:58:38 -0300 Subject: [PATCH 086/111] fix: separated deployer from user/mm addresses --- .github/workflows/zksync-scripts/assert.sh | 68 +++++++++----------- .github/workflows/zksync-scripts/ci.env.test | 4 +- contracts/ethereum/test/.env.test | 7 +- contracts/zksync/test/.env.test | 5 +- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index f16ef791..ee8ab54a 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -15,45 +15,41 @@ assert() { fi } -# assert_aprox() { -# #Usage: assert -# lower_bound=$(echo "$3 - $4)" | bc) -# upper_bound=$(echo "$3 + $4)" | bc) - -# echo $lower_bound -# echo $upper_bound - -# if (( $2 >= lower_bound && $2 <= upper_bound )); then -# printf "${GREEN}✓ $1 passed.${RESET}\n" -# else -# printf "${RED}x $1 assertion failed: Obtained value: $2, Expected value: $3.${RESET}\n" -# FAILED=true -# fi -# } - -#setorder -echo setOrder -assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607 # -assert BALANCE_ESCROW_L2_BEFORE_SETORDER $BALANCE_ESCROW_L2_BEFORE_SETORDER 0 -assert BALANCE_USER_L2_AFTER_SETORDER $BALANCE_USER_L2_AFTER_SETORDER 99999999999800292778275 # -assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2 - -#transfer -echo transfer -assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999994843170481493400 # +# #setorder +# echo setOrder +# assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607000000000 # +# assert BALANCE_ESCROW_L2_BEFORE_SETORDER $BALANCE_ESCROW_L2_BEFORE_SETORDER 0 +# assert BALANCE_USER_L2_AFTER_SETORDER $BALANCE_USER_L2_AFTER_SETORDER 999999999998002930766250000000 # +# assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2000000000000000000 + +# #transfer +# echo transfer +# assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999987225321481493064 # +# assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 +# assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999997997047827481493064 # +# assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 + +# #claimpeyment +# echo claimPayment +# assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_TRANSFER +# assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 100000000000000268251975 #not yet updated +# assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 +# assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999993004619721479929257 # +# assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 100000000000700216110175 # +# assert BALANCE_MM_L2_CHANGE_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT-$BALANCE_MM_L2_BEFORE_CLAIMPAYMENT)) 2000000000 +# assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 + + +#solo hace falta validar: +echo "solo hace falta validar:" + +assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2000000000000000000 +assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 + assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999998004754423480872171 # assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 -#claimpeyment -echo claimPayment -assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_TRANSFER -assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 100000000000000268251975 # -assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 -assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999993004619721479929257 # -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 100000000000700216110175 # -assert BALANCE_MM_L2_CHANGE_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT-$BALANCE_MM_L2_BEFORE_CLAIMPAYMENT)) 2000000000 -assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002102977607000000000 # if $FAILED; then exit 1 diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index f63828e7..ee5a6551 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -5,7 +5,7 @@ ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url # ZKSYNC_DIAMOND_PROXY_ADDRESS=xxx #variable on each setup ./start.sh -ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 +ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 MM_ETHEREUM_WALLET_ADDRESS=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 @@ -27,7 +27,7 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 ## ZKSYNC.env TEST=true -WALLET_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 +WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A diff --git a/contracts/ethereum/test/.env.test b/contracts/ethereum/test/.env.test index e687c817..f9ba42af 100644 --- a/contracts/ethereum/test/.env.test +++ b/contracts/ethereum/test/.env.test @@ -2,12 +2,12 @@ SKIP_VERIFY=true #cant verify on local devnet ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url -ZKSYNC_DIAMOND_PROXY_ADDRESS=0x97589bcE7727f5D0C8082440681DB6092b6Dda1a +ZKSYNC_DIAMOND_PROXY_ADDRESS=0xc4F34411EDceA068DaAf7eb42EC59280f4d2f714 #old: 0x97589bcE7727f5D0C8082440681DB6092b6Dda1a ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 -MM_ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 -MM_ETHEREUM_WALLET_ADDRESS=0x36615Cf349d7F6344891B1e7CA7C72883F5dc049 #prefunded 0 +MM_ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 +MM_ETHEREUM_WALLET_ADDRESS=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 USER_ETHEREUM_PUBLIC_ADDRESS=0xCEEe57f2B700c2f37D1476A7974965E149Fce2D4 #random address with no funds @@ -27,3 +27,4 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 + diff --git a/contracts/zksync/test/.env.test b/contracts/zksync/test/.env.test index 76cb502b..09640bed 100644 --- a/contracts/zksync/test/.env.test +++ b/contracts/zksync/test/.env.test @@ -1,10 +1,11 @@ TEST=true -WALLET_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 -MM_ZKSYNC_WALLET=0xa61464658AfeAf65CccaaFD3a512b69A83B77618 #prefunded 1 +WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 +MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A USER_ZKSYNC_PRIVATE_ADDRESS=0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93 #prefunded 4 USER_ZKSYNC_PUBLIC_ADDRESS=0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 #prefunded 4 + From 747697e6447ea1c2511c70edcdf7f93a74cd0996 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:03:31 -0300 Subject: [PATCH 087/111] fix: BALANCE_MM_L2_AFTER_CLAIMPAYMENT takes logical value --- .github/workflows/zksync-scripts/assert.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index ee8ab54a..704bef49 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -49,7 +49,7 @@ assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMEN assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 1000000000002102977607000000000 # +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $BALANCE_ESCROW_L2_AFTER_SETORDER)) # if $FAILED; then exit 1 From cb450bd4f4c0a527a4437a5931c59c496c1823cc Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:23:38 -0300 Subject: [PATCH 088/111] refactor: change npx wallet balance to cast balance --- .github/workflows/zksync-integration-test.yml | 2 -- contracts/zksync/test/claim_payment.sh | 8 ++++---- contracts/zksync/test/set_order.sh | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index fdcfe0ba..9ae2ae16 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -78,8 +78,6 @@ jobs: echo sleeping 250 to wait for ./start to setup sleep 250 - - cat docker_output.log export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable: diff --git a/contracts/zksync/test/claim_payment.sh b/contracts/zksync/test/claim_payment.sh index a88cf730..ebc3f644 100755 --- a/contracts/zksync/test/claim_payment.sh +++ b/contracts/zksync/test/claim_payment.sh @@ -9,11 +9,11 @@ BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETH echo "$BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" echo "\nMM L2 funds before Claim Payment" -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT echo "\nEscrow L2 funds before Claim Payment" -BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH == $BRIDGE_AMOUNT_WEI WEI" @@ -27,9 +27,9 @@ BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHE echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" echo "\nMM L2 funds after Claim Payment" -BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$MM_ZKSYNC_WALLET" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT echo "\nEscrow L2 funds after Claim Payment" -BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) echo $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index 790c5e3c..67d4f673 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -18,11 +18,11 @@ echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "\nUser ZKSync funds before setOrder:" -BALANCE_USER_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_USER_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) echo $BALANCE_USER_L2_BEFORE_SETORDER echo "\nEscrow ZKSync funds before setOrder:" -BALANCE_ESCROW_L2_BEFORE_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_ESCROW_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) echo $BALANCE_ESCROW_L2_BEFORE_SETORDER @@ -31,9 +31,9 @@ npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc h echo "\nUser ZKSync funds after setOrder:" -BALANCE_USER_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$USER_ZKSYNC_PUBLIC_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_USER_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) echo $BALANCE_USER_L2_AFTER_SETORDER echo "\nEscrow ZKSync funds after setOrder:" -BALANCE_ESCROW_L2_AFTER_SETORDER=$(npx zksync-cli wallet balance --rpc http://localhost:3050 --address "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" | grep -oE '[0-9]+(\.[0-9]+)?' | xargs -I {} echo "scale=0; {} * 1e18" | bc -l | sed 's/\.0*$//') +BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) echo $BALANCE_ESCROW_L2_AFTER_SETORDER \ No newline at end of file From b3efee5fa48c223e2d6db0c6ad5ef05f78bfa930 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:37:38 -0300 Subject: [PATCH 089/111] fix: overflow on BALANCE_MM_L2_AFTER_CLAIMPAYMENT in assert --- .github/workflows/zksync-scripts/assert.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 704bef49..02e7c298 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -49,7 +49,7 @@ assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMEN assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $BALANCE_ESCROW_L2_AFTER_SETORDER)) # +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT/100)) $((($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT/100) + ($BALANCE_ESCROW_L2_AFTER_SETORDER/100))) #/100 because it has overflow if $FAILED; then exit 1 From 699ee937240490941f1c769ed53639e255a1c83f Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:48:12 -0300 Subject: [PATCH 090/111] refactor: use vars in assert --- .github/workflows/zksync-scripts/assert.sh | 31 +++------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 02e7c298..7bba3264 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -15,41 +15,16 @@ assert() { fi } -# #setorder -# echo setOrder -# assert BALANCE_USER_L2_BEFORE_SETORDER $BALANCE_USER_L2_BEFORE_SETORDER 1000000000000002977607000000000 # -# assert BALANCE_ESCROW_L2_BEFORE_SETORDER $BALANCE_ESCROW_L2_BEFORE_SETORDER 0 -# assert BALANCE_USER_L2_AFTER_SETORDER $BALANCE_USER_L2_AFTER_SETORDER 999999999998002930766250000000 # -# assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2000000000000000000 - -# #transfer -# echo transfer -# assert BALANCE_MM_L1_BEFORE_TRANSFER $BALANCE_MM_L1_BEFORE_TRANSFER 99999998999999999999987225321481493064 # -# assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -# assert BALANCE_MM_L1_AFTER_TRANSFER $BALANCE_MM_L1_AFTER_TRANSFER 99999998999999999997997047827481493064 # -# assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 - -# #claimpeyment -# echo claimPayment -# assert BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_TRANSFER -# assert BALANCE_MM_L2_BEFORE_CLAIMPAYMENT $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT 100000000000000268251975 #not yet updated -# assert BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT 2 -# assert BALANCE_MM_L1_AFTER_CLAIMPAYMENT $BALANCE_MM_L1_AFTER_CLAIMPAYMENT 99999998999999999993004619721479929257 # -# assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $BALANCE_MM_L2_AFTER_CLAIMPAYMENT 100000000000700216110175 # -# assert BALANCE_MM_L2_CHANGE_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT-$BALANCE_MM_L2_BEFORE_CLAIMPAYMENT)) 2000000000 -# assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 - - #solo hace falta validar: echo "solo hace falta validar:" -assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER 2000000000000000000 +assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER $VALUE_WEI #2000000000000000000 assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER 1990000000000000000 +assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT/100)) $((($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT/100) + ($BALANCE_ESCROW_L2_AFTER_SETORDER/100))) #/100 because it has overflow +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT) $((($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT) + ($VALUE_WEI)) #/100 because it has overflow if $FAILED; then exit 1 From 8bd9e12b2d3d4e3c9c08a666a9c55c3d2760214a Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:52:36 -0300 Subject: [PATCH 091/111] refactor: mm zksync has no initial funds --- .github/workflows/zksync-scripts/ci.env.test | 2 +- contracts/zksync/test/.env.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index ee5a6551..d22fe441 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -28,7 +28,7 @@ STARKNET_CHAIN_ID=0x534e5f5345504f4c4941 TEST=true WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 -MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 +MM_ZKSYNC_WALLET=0xbE85c9531BE760B6964cdA4A8826b9Cb0391E32C #random address with no funds NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A diff --git a/contracts/zksync/test/.env.test b/contracts/zksync/test/.env.test index 09640bed..013dbd92 100644 --- a/contracts/zksync/test/.env.test +++ b/contracts/zksync/test/.env.test @@ -2,7 +2,7 @@ TEST=true WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 -MM_ZKSYNC_WALLET=0x0D43eB5B8a47bA8900d84AA36656c92024e9772e #prefunded 2 +MM_ZKSYNC_WALLET=0xbE85c9531BE760B6964cdA4A8826b9Cb0391E32C #random address with no funds NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A From dc01d04c2e29e67a30faf7a2942bb297c5bb6e3b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:12:04 -0300 Subject: [PATCH 092/111] refactor: remove () in BALANCE_MM_L2_AFTER_CLAIMPAYMENT in assert --- .github/workflows/zksync-scripts/assert.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 7bba3264..cffb2c4f 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -24,7 +24,7 @@ assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMEN assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT) $((($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT) + ($VALUE_WEI)) #/100 because it has overflow +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) #/100 because it has overflow if $FAILED; then exit 1 From 976ffe998fbeb287c62ad876ba1d0de21108a928 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:58:51 -0300 Subject: [PATCH 093/111] fix: exit 0 at the end of assert --- .github/workflows/zksync-scripts/assert.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index cffb2c4f..38c28367 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -24,8 +24,10 @@ assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMEN assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) #/100 because it has overflow +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) #/100 because it has overflow if $FAILED; then + echo A test failed exit 1 fi +exit 0 \ No newline at end of file From 7a1f1360ef3c49d443b85ac1c67cfbec1ac76f0e Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 12:59:34 -0300 Subject: [PATCH 094/111] refactor: small clean un code and comments --- .github/workflows/zksync-integration-test.yml | 4 ---- .github/workflows/zksync-scripts/assert.sh | 7 ++----- .github/workflows/zksync-scripts/ci.env.test | 4 +--- contracts/ethereum/test/.env.test | 3 ++- contracts/zksync/deploy.sh | 2 +- contracts/zksync/test/.env.test | 1 - contracts/zksync/test/set_order.sh | 1 - 7 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 9ae2ae16..6f6b1dc9 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -20,8 +20,6 @@ jobs: steps: - uses: actions/checkout@v4 - - # Run Dockerized L1-L2, goes first because it takes a lot of time - name: Setup Dockerized L1-L2 run: | @@ -87,5 +85,3 @@ jobs: make zksync-test-integration-ci exit 0 - - \ No newline at end of file diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 38c28367..107d30cb 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -15,19 +15,16 @@ assert() { fi } -#solo hace falta validar: -echo "solo hace falta validar:" - assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER $VALUE_WEI #2000000000000000000 assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) #/100 because it has overflow +assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) if $FAILED; then echo A test failed exit 1 fi -exit 0 \ No newline at end of file +exit 0 diff --git a/.github/workflows/zksync-scripts/ci.env.test b/.github/workflows/zksync-scripts/ci.env.test index d22fe441..bbfeedc4 100644 --- a/.github/workflows/zksync-scripts/ci.env.test +++ b/.github/workflows/zksync-scripts/ci.env.test @@ -3,8 +3,6 @@ SKIP_VERIFY=true #cant verify on local devnet ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url -# ZKSYNC_DIAMOND_PROXY_ADDRESS=xxx #variable on each setup ./start.sh - ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 MM_ETHEREUM_PRIVATE_KEY=0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e #prefunded 2 @@ -17,7 +15,7 @@ ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=0x156be1ae ZKSYNC_CHAIN_ID=300 -#irrelevant but required SN variables +# These SN variables don't affect this test, but are necessary for deploy STARKNET_CLAIM_PAYMENT_SELECTOR=0x03636c566f6409560d55d5f6d1eb4ee163b096b4698c503e69e210be79de2afa STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=0x0354a01e49fe07e43306a97ed84dbd5de8238c7d8ff616caa3444630cfc559e6 STARKNET_MESSAGING_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 diff --git a/contracts/ethereum/test/.env.test b/contracts/ethereum/test/.env.test index f9ba42af..c7471239 100644 --- a/contracts/ethereum/test/.env.test +++ b/contracts/ethereum/test/.env.test @@ -2,7 +2,8 @@ SKIP_VERIFY=true #cant verify on local devnet ETHEREUM_RPC=http://localhost:8545 #local devnet L1 rpc url -ZKSYNC_DIAMOND_PROXY_ADDRESS=0xc4F34411EDceA068DaAf7eb42EC59280f4d2f714 #old: 0x97589bcE7727f5D0C8082440681DB6092b6Dda1a +ZKSYNC_DIAMOND_PROXY_ADDRESS=0xdA7aA6e28eD3164bF5383eCe38868ADc7686A2F0 + ETHEREUM_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 #prefunded 0 diff --git a/contracts/zksync/deploy.sh b/contracts/zksync/deploy.sh index ac6d5373..6f5a6666 100755 --- a/contracts/zksync/deploy.sh +++ b/contracts/zksync/deploy.sh @@ -10,7 +10,7 @@ if [ -z "$PAYMENT_REGISTRY_PROXY_ADDRESS" ]; then fi DEPLOY="deploy" -if [ "$TEST" = "true" ]; then +if [ "$TEST" = true ]; then DEPLOY="deploy-devnet" fi diff --git a/contracts/zksync/test/.env.test b/contracts/zksync/test/.env.test index 013dbd92..28afb666 100644 --- a/contracts/zksync/test/.env.test +++ b/contracts/zksync/test/.env.test @@ -8,4 +8,3 @@ NATIVE_TOKEN_ETH_IN_ZKSYNC=0x000000000000000000000000000000000000800A USER_ZKSYNC_PRIVATE_ADDRESS=0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93 #prefunded 4 USER_ZKSYNC_PUBLIC_ADDRESS=0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 #prefunded 4 - diff --git a/contracts/zksync/test/set_order.sh b/contracts/zksync/test/set_order.sh index 67d4f673..c8776e9b 100755 --- a/contracts/zksync/test/set_order.sh +++ b/contracts/zksync/test/set_order.sh @@ -9,7 +9,6 @@ VALUE=2 #in ETH VALUE_WEI=$(echo "scale=0; $VALUE * 10^18" | bc) BRIDGE_AMOUNT_WEI=$(echo "scale=0; $VALUE_WEI - $FEE" | bc) BRIDGE_AMOUNT_ETH=$(echo "scale=18; $BRIDGE_AMOUNT_WEI / 10^18" | bc) -# BRIDGE_AMOUNT_WEI=$(printf "%.0f" "$BRIDGE_AMOUNT_WEI") echo USER_ZKSYNC_PUBLIC_ADDRESS echo $USER_ZKSYNC_PUBLIC_ADDRESS From 77670db1c531c1f15110da12ea14cddaa5f01139 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:02:28 -0300 Subject: [PATCH 095/111] refactor: move integratio test executor files to .githubb/workflows folder --- .../workflows/zksync-scripts}/claim_payment.sh | 0 .../workflows/zksync-scripts}/set_order.sh | 0 .../workflows/zksync-scripts}/transfer.sh | 0 Makefile | 12 ++++++------ 4 files changed, 6 insertions(+), 6 deletions(-) rename {contracts/zksync/test => .github/workflows/zksync-scripts}/claim_payment.sh (100%) rename {contracts/zksync/test => .github/workflows/zksync-scripts}/set_order.sh (100%) rename {contracts/zksync/test => .github/workflows/zksync-scripts}/transfer.sh (100%) diff --git a/contracts/zksync/test/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh similarity index 100% rename from contracts/zksync/test/claim_payment.sh rename to .github/workflows/zksync-scripts/claim_payment.sh diff --git a/contracts/zksync/test/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh similarity index 100% rename from contracts/zksync/test/set_order.sh rename to .github/workflows/zksync-scripts/set_order.sh diff --git a/contracts/zksync/test/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh similarity index 100% rename from contracts/zksync/test/transfer.sh rename to .github/workflows/zksync-scripts/transfer.sh diff --git a/Makefile b/Makefile index 64b77d1f..432e7920 100644 --- a/Makefile +++ b/Makefile @@ -107,9 +107,9 @@ zksync-test-integration-ci: . ./contracts/ethereum/deploy.sh && \ . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ - . ./contracts/zksync/test/set_order.sh && \ - . ./contracts/zksync/test/transfer.sh && \ - . ./contracts/zksync/test/claim_payment.sh && \ + . ./.github/workflows/zksync-scripts/set_order.sh && \ + . ./.github/workflows/zksync-scripts/transfer.sh && \ + . ./.github/workflows/zksync-scripts/claim_payment.sh && \ . ./.github/workflows/zksync-scripts/assert.sh zksync-test-integration-local: @@ -118,9 +118,9 @@ zksync-test-integration-local: . ./contracts/ethereum/deploy.sh && \ . ./contracts/zksync/deploy.sh && \ . ./contracts/ethereum/set_zksync_escrow.sh && \ - . ./contracts/zksync/test/set_order.sh && \ - . ./contracts/zksync/test/transfer.sh && \ - . ./contracts/zksync/test/claim_payment.sh && \ + . ./.github/workflows/zksync-scripts/set_order.sh && \ + . ./.github/workflows/zksync-scripts/transfer.sh && \ + . ./.github/workflows/zksync-scripts/claim_payment.sh && \ . ./.github/workflows/zksync-scripts/assert.sh # zksync-upgrade: WIP From b5a5d24b90b9d0e6c8db93a674533b1945b1f6fa Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:02:52 -0300 Subject: [PATCH 096/111] refactor: removed comment --- .github/workflows/zksync-scripts/set_order.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh index c8776e9b..99561d4d 100755 --- a/.github/workflows/zksync-scripts/set_order.sh +++ b/.github/workflows/zksync-scripts/set_order.sh @@ -1,6 +1,4 @@ #!/bin/bash -# cast call 0x97589bcE7727f5D0C8082440681DB6092b6Dda1a "getNames()(string)" --rpc-url http://localhost:8545 -# exit . contracts/utils/colors.sh #for ANSI colors From cdd595dc80afb7ba216296f7c36d2e8ed68750b7 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:50:02 -0300 Subject: [PATCH 097/111] refactor: change log formats --- .github/workflows/zksync-scripts/assert.sh | 12 +++---- .../workflows/zksync-scripts/claim_payment.sh | 33 ++++++++----------- .github/workflows/zksync-scripts/set_order.sh | 26 ++++++++------- .github/workflows/zksync-scripts/transfer.sh | 13 +++----- 4 files changed, 39 insertions(+), 45 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 107d30cb..6133dea7 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -15,16 +15,16 @@ assert() { fi } -assert BALANCE_ESCROW_L2_AFTER_SETORDER $BALANCE_ESCROW_L2_AFTER_SETORDER $VALUE_WEI #2000000000000000000 -assert BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 +assert "Escrow balance after SetOrder" $BALANCE_ESCROW_L2_AFTER_SETORDER $VALUE_WEI #2000000000000000000 +assert "Escrow balance after Claim Payment" $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 -assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert BALANCE_USER_L1_AFTER_TRANSFER $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 +# assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 +assert "User balance" $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 -assert BALANCE_MM_L2_AFTER_CLAIMPAYMENT $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) +assert "MM balance" $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) if $FAILED; then - echo A test failed + echo "One of the previous tests failed, all should pass for Integration Test to be successful" exit 1 fi exit 0 diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index ebc3f644..3cbd38a7 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -4,32 +4,27 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" -echo "\nMM L1 funds before Claim Payment" -BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -echo "$BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" +BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +echo "\nInitial Escrow balance: $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT" -echo "\nMM L2 funds before Claim Payment" -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) -echo $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT +# BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) +# echo "\nInitial MM balance: $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" -echo "\nEscrow L2 funds before Claim Payment" -BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -echo $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) +echo "\nInitial MM balance: $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT" -echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH == $BRIDGE_AMOUNT_WEI WEI" +echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" # == $BRIDGE_AMOUNT_WEI WEI" cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 -echo "\nMM L1 funds after Claim Payment" -BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" +# echo "\nMM L1 funds after Claim Payment" +# BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) +# echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" -echo "\nMM L2 funds after Claim Payment" -BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) -echo $BALANCE_MM_L2_AFTER_CLAIMPAYMENT - -echo "\nEscrow L2 funds after Claim Payment" BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -echo $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT +echo "\nFinal Escrow balance: $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT" + +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) +echo "\nFinal MM balance:$BALANCE_MM_L2_AFTER_CLAIMPAYMENT" diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh index 99561d4d..92754882 100755 --- a/.github/workflows/zksync-scripts/set_order.sh +++ b/.github/workflows/zksync-scripts/set_order.sh @@ -14,23 +14,25 @@ echo ZKSYNC_ESCROW_CONTRACT_ADDRESS echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" -echo "\nUser ZKSync funds before setOrder:" -BALANCE_USER_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) -echo $BALANCE_USER_L2_BEFORE_SETORDER +echo "$ZKSYNC_ESCROW_CONTRACT_ADDRESS\n" -echo "\nEscrow ZKSync funds before setOrder:" -BALANCE_ESCROW_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -echo $BALANCE_ESCROW_L2_BEFORE_SETORDER +# echo "\nUser ZKSync funds before setOrder:" +# BALANCE_USER_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) +# echo $BALANCE_USER_L2_BEFORE_SETORDER +# echo "\nEscrow ZKSync funds before setOrder:" +# BALANCE_ESCROW_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +# echo $BALANCE_ESCROW_L2_BEFORE_SETORDER -echo "\nExecuting Set Order" + +# echo "\nExecuting Set Order" npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null -echo "\nUser ZKSync funds after setOrder:" -BALANCE_USER_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) -echo $BALANCE_USER_L2_AFTER_SETORDER +# echo "\nUser ZKSync funds after setOrder:" +# BALANCE_USER_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) +# echo $BALANCE_USER_L2_AFTER_SETORDER -echo "\nEscrow ZKSync funds after setOrder:" +# echo "\nEscrow ZKSync funds after setOrder:" BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -echo $BALANCE_ESCROW_L2_AFTER_SETORDER \ No newline at end of file +# echo $BALANCE_ESCROW_L2_AFTER_SETORDER diff --git a/.github/workflows/zksync-scripts/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh index 6fdf7166..f89c9c98 100755 --- a/.github/workflows/zksync-scripts/transfer.sh +++ b/.github/workflows/zksync-scripts/transfer.sh @@ -4,24 +4,21 @@ printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" -echo "\nMM L1 funds before transfer:" BALANCE_MM_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -echo $BALANCE_MM_L1_BEFORE_TRANSFER +echo "\nInitial MM Balance: $BALANCE_MM_L1_BEFORE_TRANSFER" -echo "\nUser L1 funds before transfer:" BALANCE_USER_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) -echo $BALANCE_USER_L1_BEFORE_TRANSFER +echo "\nInitial User Balance: $BALANCE_USER_L1_BEFORE_TRANSFER" -echo "Transferring $BRIDGE_AMOUNT_WEI WEI to $USER_ETHEREUM_PUBLIC_ADDRESS" +echo "Transferring $BRIDGE_AMOUNT_ETH ETH to $USER_ETHEREUM_PUBLIC_ADDRESS" cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "transfer(uint256, address, uint128)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $ZKSYNC_CHAIN_ID \ --value $BRIDGE_AMOUNT_WEI >> /dev/null -echo "\nMM L1 funds after transfer:" BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -echo $BALANCE_MM_L1_AFTER_TRANSFER +echo "\nFinal MM Balance: $BALANCE_MM_L1_AFTER_TRANSFER" -echo "\nUser L1 funds after transfer:" +echo "\nFinal User Balance" BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) echo $BALANCE_USER_L1_AFTER_TRANSFER From fb14483577d4e4e631b598a77ffbdaca76f29b81 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:50:23 -0300 Subject: [PATCH 098/111] refactor: eth for logs, wei for asserts --- .github/workflows/zksync-scripts/assert.sh | 8 ++++---- .github/workflows/zksync-scripts/claim_payment.sh | 9 ++++++--- .github/workflows/zksync-scripts/set_order.sh | 3 ++- .github/workflows/zksync-scripts/transfer.sh | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index 6133dea7..cad4b55c 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -15,13 +15,13 @@ assert() { fi } -assert "Escrow balance after SetOrder" $BALANCE_ESCROW_L2_AFTER_SETORDER $VALUE_WEI #2000000000000000000 -assert "Escrow balance after Claim Payment" $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT 0 +assert "Escrow balance after SetOrder" $BALANCE_ESCROW_L2_AFTER_SETORDER_WEI $VALUE_WEI #2000000000000000000 +assert "Escrow balance after Claim Payment" $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI 0 # assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 -assert "User balance" $BALANCE_USER_L1_AFTER_TRANSFER $BRIDGE_AMOUNT_WEI #1990000000000000000 +assert "User balance" $BALANCE_USER_L1_AFTER_TRANSFER_WEI $BRIDGE_AMOUNT_WEI #1990000000000000000 -assert "MM balance" $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT + $VALUE_WEI)) +assert "MM balance" $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT_WEI)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI + $VALUE_WEI)) if $FAILED; then echo "One of the previous tests failed, all should pass for Integration Test to be successful" diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index 3cbd38a7..99be2ed7 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -10,7 +10,8 @@ echo "\nInitial Escrow balance: $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT" # BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) # echo "\nInitial MM balance: $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) echo "\nInitial MM balance: $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT" echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" # == $BRIDGE_AMOUNT_WEI WEI" @@ -23,8 +24,10 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric # BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) # echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" -BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) echo "\nFinal Escrow balance: $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT" -BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) +BALANCE_MM_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) echo "\nFinal MM balance:$BALANCE_MM_L2_AFTER_CLAIMPAYMENT" diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh index 92754882..04eac37e 100755 --- a/.github/workflows/zksync-scripts/set_order.sh +++ b/.github/workflows/zksync-scripts/set_order.sh @@ -34,5 +34,6 @@ npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc h # echo $BALANCE_USER_L2_AFTER_SETORDER # echo "\nEscrow ZKSync funds after setOrder:" -BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +# BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +BALANCE_ESCROW_L2_AFTER_SETORDER_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) # echo $BALANCE_ESCROW_L2_AFTER_SETORDER diff --git a/.github/workflows/zksync-scripts/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh index f89c9c98..1eb69943 100755 --- a/.github/workflows/zksync-scripts/transfer.sh +++ b/.github/workflows/zksync-scripts/transfer.sh @@ -19,6 +19,6 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-p BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "\nFinal MM Balance: $BALANCE_MM_L1_AFTER_TRANSFER" -echo "\nFinal User Balance" -BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) -echo $BALANCE_USER_L1_AFTER_TRANSFER +BALANCE_USER_L1_AFTER_TRANSFER_WEI=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) +BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) +echo "\nFinal User Balance: $BALANCE_USER_L1_AFTER_TRANSFER" From 05b98370a843df06348f6fd2b23089a60d1e8661 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:50:20 -0300 Subject: [PATCH 099/111] refactor: remove claimPayment tx logs --- .github/workflows/zksync-scripts/claim_payment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index 99be2ed7..ab3bb752 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -18,7 +18,7 @@ echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" # == $BRIDGE_AMOUNT_WEI WEI" cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ $PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \ "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ - --value 5000000000000000000 + --value 5000000000000000000 > /dev/null # echo "\nMM L1 funds after Claim Payment" # BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) From c44cbdfae5296e7c7409f2188b0ddc8dc5346c6b Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:57:12 -0300 Subject: [PATCH 100/111] refactor: wei or eth comments + set_order logging --- .github/workflows/zksync-scripts/assert.sh | 1 - .../workflows/zksync-scripts/claim_payment.sh | 12 +++++----- .github/workflows/zksync-scripts/set_order.sh | 24 +++++++------------ .github/workflows/zksync-scripts/transfer.sh | 4 ++-- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index cad4b55c..f23e9c90 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -18,7 +18,6 @@ assert() { assert "Escrow balance after SetOrder" $BALANCE_ESCROW_L2_AFTER_SETORDER_WEI $VALUE_WEI #2000000000000000000 assert "Escrow balance after Claim Payment" $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI 0 -# assert BALANCE_USER_L1_BEFORE_TRANSFER $BALANCE_USER_L1_BEFORE_TRANSFER 0 assert "User balance" $BALANCE_USER_L1_AFTER_TRANSFER_WEI $BRIDGE_AMOUNT_WEI #1990000000000000000 assert "MM balance" $(($BALANCE_MM_L2_AFTER_CLAIMPAYMENT_WEI)) $(($BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI + $VALUE_WEI)) diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index ab3bb752..6a979ee7 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -10,8 +10,8 @@ echo "\nInitial Escrow balance: $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT" # BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) # echo "\nInitial MM balance: $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) -BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) #for assert.sh +BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) #for logging echo "\nInitial MM balance: $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT" echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" # == $BRIDGE_AMOUNT_WEI WEI" @@ -24,10 +24,10 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric # BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) # echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" -BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh +BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging echo "\nFinal Escrow balance: $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT" -BALANCE_MM_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) -BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) +BALANCE_MM_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) #for assert.sh +BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) #for logging echo "\nFinal MM balance:$BALANCE_MM_L2_AFTER_CLAIMPAYMENT" diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh index 04eac37e..446f58ba 100755 --- a/.github/workflows/zksync-scripts/set_order.sh +++ b/.github/workflows/zksync-scripts/set_order.sh @@ -16,24 +16,18 @@ echo $ZKSYNC_ESCROW_CONTRACT_ADDRESS printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "$ZKSYNC_ESCROW_CONTRACT_ADDRESS\n" -# echo "\nUser ZKSync funds before setOrder:" -# BALANCE_USER_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) -# echo $BALANCE_USER_L2_BEFORE_SETORDER +BALANCE_USER_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) +echo "\nInitial User funds: $BALANCE_USER_L2_BEFORE_SETORDER" -# echo "\nEscrow ZKSync funds before setOrder:" -# BALANCE_ESCROW_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -# echo $BALANCE_ESCROW_L2_BEFORE_SETORDER +BALANCE_ESCROW_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) +echo "\nInitial Escrow funds: $BALANCE_ESCROW_L2_BEFORE_SETORDER" - -# echo "\nExecuting Set Order" npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null +BALANCE_USER_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) +echo "\nFinal User funds: $BALANCE_USER_L2_AFTER_SETORDER" -# echo "\nUser ZKSync funds after setOrder:" -# BALANCE_USER_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) -# echo $BALANCE_USER_L2_AFTER_SETORDER -# echo "\nEscrow ZKSync funds after setOrder:" -# BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -BALANCE_ESCROW_L2_AFTER_SETORDER_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -# echo $BALANCE_ESCROW_L2_AFTER_SETORDER +BALANCE_ESCROW_L2_AFTER_SETORDER_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh +BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging +echo "\nFinal Escrow funds:$BALANCE_ESCROW_L2_AFTER_SETORDER" diff --git a/.github/workflows/zksync-scripts/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh index 1eb69943..533bb149 100755 --- a/.github/workflows/zksync-scripts/transfer.sh +++ b/.github/workflows/zksync-scripts/transfer.sh @@ -19,6 +19,6 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-p BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) echo "\nFinal MM Balance: $BALANCE_MM_L1_AFTER_TRANSFER" -BALANCE_USER_L1_AFTER_TRANSFER_WEI=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) -BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) +BALANCE_USER_L1_AFTER_TRANSFER_WEI=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) #for assert.sh +BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) #for logging echo "\nFinal User Balance: $BALANCE_USER_L1_AFTER_TRANSFER" From ddbcb6190fc588bf08e3f8386bc2ba56ce6033e6 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:06:45 -0300 Subject: [PATCH 101/111] refactor: CI logs with less \n --- .github/workflows/zksync-scripts/claim_payment.sh | 8 ++++---- .github/workflows/zksync-scripts/set_order.sh | 8 ++++---- .github/workflows/zksync-scripts/transfer.sh | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index 6a979ee7..1d895273 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -5,14 +5,14 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -echo "\nInitial Escrow balance: $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT" +echo "Initial Escrow balance: $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT" # BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) # echo "\nInitial MM balance: $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) #for assert.sh BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) #for logging -echo "\nInitial MM balance: $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT" +echo "Initial MM balance: $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT" echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" # == $BRIDGE_AMOUNT_WEI WEI" cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ @@ -26,8 +26,8 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging -echo "\nFinal Escrow balance: $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT" +echo "Final Escrow balance: $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT" BALANCE_MM_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) #for assert.sh BALANCE_MM_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) #for logging -echo "\nFinal MM balance:$BALANCE_MM_L2_AFTER_CLAIMPAYMENT" +echo "Final MM balance:$BALANCE_MM_L2_AFTER_CLAIMPAYMENT" diff --git a/.github/workflows/zksync-scripts/set_order.sh b/.github/workflows/zksync-scripts/set_order.sh index 446f58ba..436bfa6c 100755 --- a/.github/workflows/zksync-scripts/set_order.sh +++ b/.github/workflows/zksync-scripts/set_order.sh @@ -17,17 +17,17 @@ printf "${GREEN}\n=> [SN] Making Set Order on Escrow${COLOR_RESET}\n" echo "$ZKSYNC_ESCROW_CONTRACT_ADDRESS\n" BALANCE_USER_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) -echo "\nInitial User funds: $BALANCE_USER_L2_BEFORE_SETORDER" +echo "Initial User funds: $BALANCE_USER_L2_BEFORE_SETORDER" BALANCE_ESCROW_L2_BEFORE_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) -echo "\nInitial Escrow funds: $BALANCE_ESCROW_L2_BEFORE_SETORDER" +echo "Initial Escrow funds: $BALANCE_ESCROW_L2_BEFORE_SETORDER" npx zksync-cli contract write --private-key $USER_ZKSYNC_PRIVATE_ADDRESS --rpc http://localhost:3050 --contract "$ZKSYNC_ESCROW_CONTRACT_ADDRESS" --method "set_order(address recipient_address, uint256 fee)" --args "$USER_ETHEREUM_PUBLIC_ADDRESS" "$FEE" --value "$VALUE" >> /dev/null BALANCE_USER_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $USER_ZKSYNC_PUBLIC_ADDRESS) -echo "\nFinal User funds: $BALANCE_USER_L2_AFTER_SETORDER" +echo "Final User funds: $BALANCE_USER_L2_AFTER_SETORDER" BALANCE_ESCROW_L2_AFTER_SETORDER_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh BALANCE_ESCROW_L2_AFTER_SETORDER=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging -echo "\nFinal Escrow funds:$BALANCE_ESCROW_L2_AFTER_SETORDER" +echo "Final Escrow funds:$BALANCE_ESCROW_L2_AFTER_SETORDER" diff --git a/.github/workflows/zksync-scripts/transfer.sh b/.github/workflows/zksync-scripts/transfer.sh index 533bb149..102389de 100755 --- a/.github/workflows/zksync-scripts/transfer.sh +++ b/.github/workflows/zksync-scripts/transfer.sh @@ -5,10 +5,10 @@ printf "${GREEN}\n=> [ETH] Making transfer to Destination account${COLOR_RESET}\n" BALANCE_MM_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -echo "\nInitial MM Balance: $BALANCE_MM_L1_BEFORE_TRANSFER" +echo "Initial MM Balance: $BALANCE_MM_L1_BEFORE_TRANSFER" BALANCE_USER_L1_BEFORE_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) -echo "\nInitial User Balance: $BALANCE_USER_L1_BEFORE_TRANSFER" +echo "Initial User Balance: $BALANCE_USER_L1_BEFORE_TRANSFER" echo "Transferring $BRIDGE_AMOUNT_ETH ETH to $USER_ETHEREUM_PUBLIC_ADDRESS" cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \ @@ -17,8 +17,8 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $MM_ETHEREUM_PRIVATE_KEY --gas-p --value $BRIDGE_AMOUNT_WEI >> /dev/null BALANCE_MM_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -echo "\nFinal MM Balance: $BALANCE_MM_L1_AFTER_TRANSFER" +echo "Final MM Balance: $BALANCE_MM_L1_AFTER_TRANSFER" BALANCE_USER_L1_AFTER_TRANSFER_WEI=$(cast balance --rpc-url $ETHEREUM_RPC $USER_ETHEREUM_PUBLIC_ADDRESS) #for assert.sh BALANCE_USER_L1_AFTER_TRANSFER=$(cast balance --rpc-url $ETHEREUM_RPC --ether $USER_ETHEREUM_PUBLIC_ADDRESS) #for logging -echo "\nFinal User Balance: $BALANCE_USER_L1_AFTER_TRANSFER" +echo "Final User Balance: $BALANCE_USER_L1_AFTER_TRANSFER" From f1955019c1d232e445bdf4b6babd7c253d288233 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:16:26 -0300 Subject: [PATCH 102/111] refactor: remove 'asserting values' echo in integration ci --- .github/workflows/zksync-scripts/assert.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-scripts/assert.sh b/.github/workflows/zksync-scripts/assert.sh index f23e9c90..464e4b3d 100755 --- a/.github/workflows/zksync-scripts/assert.sh +++ b/.github/workflows/zksync-scripts/assert.sh @@ -2,7 +2,7 @@ . contracts/utils/colors.sh #for ANSI colors -echo "Asserting values" +echo "\n" FAILED=false assert() { From c853854cbd78094e845eeb7e4b684bb50512bdcd Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:59:29 -0300 Subject: [PATCH 103/111] refactor: move some export vars from deploy.sh to zksync-integration.yml --- .github/workflows/zksync-integration-test.yml | 8 ++++++++ contracts/ethereum/deploy.sh | 14 -------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 6f6b1dc9..27e7d1da 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -72,6 +72,14 @@ jobs: - name: Running integration test run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} + + export STARKNET_MESSAGING_ADDRESS=${{vars.STARKNET_MESSAGING_ADDRESS}} + export STARKNET_CLAIM_PAYMENT_SELECTOR=${{vars.STARKNET_CLAIM_PAYMENT_SELECTOR}} + export STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=${{vars.STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR}} + export ZKSYNC_CLAIM_PAYMENT_SELECTOR=${{vars.ZKSYNC_CLAIM_PAYMENT_SELECTOR}} + export ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=${{vars.ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR}} + export STARKNET_CHAIN_ID=${{vars.STARKNET_CHAIN_ID}} + export ZKSYNC_CHAIN_ID=${{vars.ZKSYNC_CHAIN_ID}} export TEST=true echo sleeping 250 to wait for ./start to setup diff --git a/contracts/ethereum/deploy.sh b/contracts/ethereum/deploy.sh index edb313cc..6031543e 100755 --- a/contracts/ethereum/deploy.sh +++ b/contracts/ethereum/deploy.sh @@ -5,21 +5,7 @@ cd contracts/ethereum printf "${GREEN}\n=> [ETH] Deploying ERC1967Proxy & PaymentRegistry ${COLOR_RESET}\n" -### These values are not correctly interpreted by the CI environment otherwise. -### Locally, this has no effect export ETHEREUM_PRIVATE_KEY=$ETHEREUM_PRIVATE_KEY -export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS -export STARKNET_MESSAGING_ADDRESS=$STARKNET_MESSAGING_ADDRESS -export STARKNET_CLAIM_PAYMENT_SELECTOR=$STARKNET_CLAIM_PAYMENT_SELECTOR -export STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR=$STARKNET_CLAIM_PAYMENT_BATCH_SELECTOR -export MM_ETHEREUM_WALLET_ADDRESS=$MM_ETHEREUM_WALLET_ADDRESS -export ZKSYNC_DIAMOND_PROXY_ADDRESS=$ZKSYNC_DIAMOND_PROXY_ADDRESS -export ZKSYNC_CLAIM_PAYMENT_SELECTOR=$ZKSYNC_CLAIM_PAYMENT_SELECTOR -export ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=$ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR -export STARKNET_CHAIN_ID=$STARKNET_CHAIN_ID -export ZKSYNC_CHAIN_ID=$ZKSYNC_CHAIN_ID -### - RESULT_LOG=$(forge script ./script/Deploy.s.sol --rpc-url $ETHEREUM_RPC --broadcast ${SKIP_VERIFY:---verify}) # echo "$RESULT_LOG" #uncomment this line for debugging in detail From 27208e750dd631d555301ed5244ed977d3adad46 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:43:28 -0300 Subject: [PATCH 104/111] fix: checking if current CI declaration of MM_ETHEREUM_WALLET_ADDRESS is compatible with this CI test --- .github/workflows/zksync-integration-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 27e7d1da..9d0e0f8b 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -80,6 +80,8 @@ jobs: export ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR=${{vars.ZKSYNC_CLAIM_PAYMENT_BATCH_SELECTOR}} export STARKNET_CHAIN_ID=${{vars.STARKNET_CHAIN_ID}} export ZKSYNC_CHAIN_ID=${{vars.ZKSYNC_CHAIN_ID}} + + export MM_ETHEREUM_WALLET_ADDRESS=${{vars.MM_ETHEREUM_WALLET_ADDRESS}} export TEST=true echo sleeping 250 to wait for ./start to setup From 59888eb911508e5a833658c303fed1eb51a800c0 Mon Sep 17 00:00:00 2001 From: Uriel Mihura <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:52:33 -0300 Subject: [PATCH 105/111] refactor: Update .github/workflows/zksync-scripts/claim_payment.sh Co-authored-by: Santos Rosati <65305492+srosati@users.noreply.github.com> --- .github/workflows/zksync-scripts/claim_payment.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index 1d895273..16b28eb7 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -20,9 +20,6 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 > /dev/null -# echo "\nMM L1 funds after Claim Payment" -# BALANCE_MM_L1_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -# echo "$BALANCE_MM_L1_AFTER_CLAIMPAYMENT" BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging From ac7864e7a2ad39a9b5ad6fe33faa7ee56999fc25 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:54:30 -0300 Subject: [PATCH 106/111] refactor: removed commented lines --- .github/workflows/zksync-scripts/claim_payment.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index 16b28eb7..ef03b4ec 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -7,9 +7,6 @@ printf "${GREEN}\n=> [ETH] Making Claim Payment${COLOR_RESET}\n" BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) echo "Initial Escrow balance: $BALANCE_ESCROW_L2_BEFORE_CLAIMPAYMENT" -# BALANCE_MM_L1_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url $ETHEREUM_RPC $MM_ETHEREUM_WALLET_ADDRESS) -# echo "\nInitial MM balance: $BALANCE_MM_L1_BEFORE_CLAIMPAYMENT" - BALANCE_MM_L2_BEFORE_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $MM_ZKSYNC_WALLET) #for assert.sh BALANCE_MM_L2_BEFORE_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $MM_ZKSYNC_WALLET) #for logging echo "Initial MM balance: $BALANCE_MM_L2_BEFORE_CLAIMPAYMENT" From 8117902515ac967b6037593f1ff8e57a94806bbb Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:51:28 -0300 Subject: [PATCH 107/111] fix(wip): print docker output to check why CI has broken --- .github/workflows/zksync-integration-test.yml | 2 ++ .github/workflows/zksync-scripts/claim_payment.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 9d0e0f8b..6174f1fb 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -87,6 +87,8 @@ jobs: echo sleeping 250 to wait for ./start to setup sleep 250 + cat docker_output.log + export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable: echo $ZKSYNC_DIAMOND_PROXY_ADDRESS diff --git a/.github/workflows/zksync-scripts/claim_payment.sh b/.github/workflows/zksync-scripts/claim_payment.sh index ef03b4ec..696a916a 100755 --- a/.github/workflows/zksync-scripts/claim_payment.sh +++ b/.github/workflows/zksync-scripts/claim_payment.sh @@ -17,7 +17,6 @@ cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-pric "0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \ --value 5000000000000000000 > /dev/null - BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging echo "Final Escrow balance: $BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT" From 1b6cf18eb333436d63d9ce88c89c981eb8c464ce Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:08:58 -0300 Subject: [PATCH 108/111] fix: git clone a specific stable commit of local-setup.git --- .github/workflows/zksync-integration-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 6174f1fb..9a7d4f89 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -26,8 +26,9 @@ jobs: export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} git clone https://github.com/matter-labs/local-setup.git - echo git cloned, starting: + echo git cloned, moving to a stable commit: cd local-setup + git checkout f16f1843b5740ca8456432123badafa137daaa02 echo starting: touch ../docker_output.log From 6be7a61912f13e73c5db47fc0b4e3179e9662248 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:54:56 -0300 Subject: [PATCH 109/111] fix: use stable version of dockerized local-node --- .github/workflows/zksync-integration-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 9a7d4f89..b438939e 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -24,13 +24,12 @@ jobs: - name: Setup Dockerized L1-L2 run: | export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} - git clone https://github.com/matter-labs/local-setup.git + git clone https://github.com/uri-99/zksync-local-setup.git - echo git cloned, moving to a stable commit: + echo git cloned cd local-setup - git checkout f16f1843b5740ca8456432123badafa137daaa02 - echo starting: + echo starting:\n touch ../docker_output.log ./start.sh &> ../docker_output.log & From 250fee0534786c574a4489822a7d90bcc19a6dfb Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:56:10 -0300 Subject: [PATCH 110/111] fix: changed folder name to cd after git clone --- .github/workflows/zksync-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index b438939e..3b052684 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -27,7 +27,7 @@ jobs: git clone https://github.com/uri-99/zksync-local-setup.git echo git cloned - cd local-setup + cd zksync-local-setup echo starting:\n touch ../docker_output.log From 3f92b7c6d457045dac3925834cc2becf7091bc13 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:11:56 -0300 Subject: [PATCH 111/111] refactor: finished, removing debug prints --- .github/workflows/zksync-integration-test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/zksync-integration-test.yml b/.github/workflows/zksync-integration-test.yml index 3b052684..7f82456d 100644 --- a/.github/workflows/zksync-integration-test.yml +++ b/.github/workflows/zksync-integration-test.yml @@ -29,7 +29,7 @@ jobs: echo git cloned cd zksync-local-setup - echo starting:\n + echo starting Dockerized L1-L2 touch ../docker_output.log ./start.sh &> ../docker_output.log & @@ -87,8 +87,6 @@ jobs: echo sleeping 250 to wait for ./start to setup sleep 250 - cat docker_output.log - export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p') echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable: echo $ZKSYNC_DIAMOND_PROXY_ADDRESS