Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Edison <gregory.edison1993@gmail.com>
  • Loading branch information
greged93 committed Oct 24, 2024
1 parent 672ed94 commit ce43690
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
---
name: e2e pipeline
name: staging

on:
workflow_dispatch:
inputs:
environment:
description: Environment to use
required: true
type: choice
options:
- sepolia
- staging
action:
description: Action to perform on the selected environment
required: true
type: choice
options:
- deploy
- test
on: workflow_dispatch

jobs:
stage:
Expand All @@ -28,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GH_TOKEN }}
- name: install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand All @@ -50,19 +34,19 @@ jobs:
${{ secrets.KAKAROT_STAGING_PRIVATE_KEY }}
run: |
cd scripts
sh e2e_pipeline.sh ${{ github.event.inputs.action }} --${{ github.event.inputs.environment }}
sh upgrade.sh deploy test --staging
- name: Check diff in deployments
run: |
cd lib/kakarot
set +e
git diff --no-patch --exit-code -- deployments/
git diff --no-patch --exit-code -- deployments/kakarot-staging/
has_diff=$?
set -e
echo "has_diff=$has_diff" >> $GITHUB_ENV
- name: Create PR for deployment updates
if: ${{ env.has_diff == 1 }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
set +e
cd lib/kakarot
Expand Down
56 changes: 23 additions & 33 deletions scripts/e2e_pipeline.sh → scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ for arg in "$@"; do
deploy)
run_deploy=true
;;
--staging)
ENV="kakarot-staging"
;;
--sepolia)
ENV="sepolia"
;;
--staging)
ENV="sepolia-staging"
;;
*)
echo "Unknown argument: ${arg}"
usage
Expand All @@ -50,48 +50,38 @@ if [ -z "${ENV}" ]; then
echo "Please provide the environment to test against"
exit 1
fi
if [ -z "${INFURA_KEY}" ]; then
echo "Please provide the INFURA_KEY environment variable"
exit 1
fi

cd ../lib/kakarot || exit
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION="python"
export L1_RPC_URL="https://sepolia.infura.io/v3/${INFURA_KEY}"
export STARKNET_NETWORK="${ENV}"

# Set the environment variables based on the provided environment
if [ "${ENV}" = "sepolia" ]; then
export RPC_URL="https://juno-kakarot-sepolia.karnot.xyz"
export RPC_NAME="starknet-sepolia"
export CHECK_INTERVAL=1
export MAX_WAIT=50
# Note: you might need to modify the following values in `lib/kakarot/kakarot_scripts/constants.py`:
# - NETWORKS["sepolia"].rpc_url = https://juno-kakarot-sepolia.karnot.xyz
# - NETWORKS["sepolia"].max_wait = 40
export STARKNET_SEPOLIA_RPC_URL="https://juno-kakarot-sepolia.karnot.xyz"
export WEB3_HTTP_PROVIDER_URI="https://rpc-kakarot-sepolia.karnot.xyz/"
if [ -z "${STARKNET_SEPOLIA_ACCOUNT_ADDRESS}" ]; then
echo "Please provide the STARKNET_SEPOLIA_ACCOUNT_ADDRESS environment variable."
echo "Please provide the STARKNET_SEPOLIA_ACCOUNT_ADDRESS environment variable"
exit 1
fi
if [ -z "${STARKNET_SEPOLIA_PRIVATE_KEY}" ]; then
echo "Please provide the STARKNET_SEPOLIA_PRIVATE_KEY environment variable."
echo "Please provide the STARKNET_SEPOLIA_PRIVATE_KEY environment variable"
exit 1
fi
if [ -z "${EVM_PRIVATE_KEY}" ]; then
echo "Please provide the EVM_PRIVATE_KEY environment variable."
echo "Please provide the EVM_PRIVATE_KEY environment variable"
exit 1
fi
SKIP="--ignore tests/end_to_end/L1L2Messaging --ignore tests/end_to_end/CairoPrecompiles --ignore tests/end_to_end/EvmPrecompiles --ignore tests/end_to_end/test_kakarot.py"
elif [ "${ENV}" = "sepolia-staging" ]; then
elif [ "${ENV}" = "kakarot-staging" ]; then
export EVM_PRIVATE_KEY="0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
export RPC_URL="https://juno-kakarot-sepolia.karnot.xyz/"
export RPC_NAME="starknet-sepolia-staging"
export CHECK_INTERVAL=1
export MAX_WAIT=50
export WEB3_HTTP_PROVIDER_URI="https://rpc-kakarot-sepolia-staging.karnot.xyz/"
if [ -z "${STARKNET_SEPOLIA_STAGING_ACCOUNT_ADDRESS}" ]; then
echo "Please provide the STARKNET_SEPOLIA_STAGING_ACCOUNT_ADDRESS environment variable."
exit 1
fi
if [ -z "${STARKNET_SEPOLIA_STAGING_PRIVATE_KEY}" ]; then
echo "Please provide the STARKNET_SEPOLIA_STAGING_PRIVATE_KEY environment variable."
export KAKAROT_STAGING_RPC_URL="https://juno-kakarot-testnet-stage.karnot.xyz"
export KAKAROT_STAGING_ACCOUNT_ADDRESS="0x7ecf6cd45c32ce84812e660cc176cb8b4de2e7a6d5916fe326bf871466fbe02"
export WEB3_HTTP_PROVIDER_URI="https://kkrt-rpc-kakarot-testnet-stage.karnot.xyz"
if [ -z "${KAKAROT_STAGING_PRIVATE_KEY}" ]; then
echo "Please provide the KAKAROT_STAGING_PRIVATE_KEY environment variable. The private key should be loaded using gpg: gpg -r recipient@kakarot.org --decrypt path/to/encrypted/key.gpg"
exit 1
fi

Expand All @@ -102,21 +92,21 @@ fi
if ${run_deploy}; then
echo "Deploying the contracts to the ${ENV} environment"

uv sync --all-extras --dev && make build-sol && make build
uv run deploy
make setup && make build-sol && make build && make fetch-ssj-artifacts && make build-cairo1
uv run python ./kakarot_scripts/deploy_kakarot.py
fi

# Run the tests if the test command is provided
if ${run_test}; then
echo "Running tests for the ${ENV} environment. Skipping: ${SKIP}"

KAKAROT_ADDRESS=$(jq -r '.kakarot' ./deployments/starknet-"${ENV}"/deployments.json)
UNINITIALIZED_ACCOUNT_CLASS_HASH=$(jq -r '.uninitialized_account' ./deployments/starknet-"${ENV}"/declarations.json)
ACCOUNT_CONTRACT_CLASS_HASH=$(jq -r '.account_contract' ./deployments/starknet-"${ENV}"/declarations.json)
KAKAROT_ADDRESS=$(jq -r '.kakarot.address' ./deployments/kakarot-"${ENV}"/deployments.json)
UNINITIALIZED_ACCOUNT_CLASS_HASH=$(jq -r '.uninitialized_account' ./deployments/kakarot-"${ENV}"/declarations.json)
ACCOUNT_CONTRACT_CLASS_HASH=$(jq -r '.account_contract' ./deployments/kakarot-"${ENV}"/declarations.json)

export KAKAROT_ADDRESS="${KAKAROT_ADDRESS}"
export UNINITIALIZED_ACCOUNT_CLASS_HASH="${UNINITIALIZED_ACCOUNT_CLASS_HASH}"
export ACCOUNT_CONTRACT_CLASS_HASH="${ACCOUNT_CONTRACT_CLASS_HASH}"

eval "uv run pytest -s tests/end_to_end -k 'test_should_return_data_median_for_query' ${SKIP}"
eval "uv run pytest -s tests/end_to_end ${SKIP}"
fi

0 comments on commit ce43690

Please sign in to comment.