Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: upgrade upgrade.sh #1444

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ usage() {
echo " test Run tests"
echo " deploy Run deployments"
echo "Options:"
echo " --sepolia Use sepolia environment for command"
echo " --staging Use staging environment for command"
greged93 marked this conversation as resolved.
Show resolved Hide resolved
echo " --production Use production environment for command"
exit 1
}

Expand All @@ -33,9 +33,9 @@ for arg in "$@"; do
run_deploy=true
;;
--staging)
ENV="staging"
ENV="kakarot-staging"
;;
--production)
--sepolia)
ENV="sepolia"
;;
*)
Expand All @@ -53,10 +53,29 @@ fi

cd ../lib/kakarot || exit
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION="python"
export STARKNET_NETWORK="kakarot-${ENV}"
export STARKNET_NETWORK="${ENV}"

# Set the environment variables based on the provided environment
if [ "${ENV}" = "staging" ]; then
if [ "${ENV}" = "sepolia" ]; then
# 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"
exit 1
fi
if [ -z "${STARKNET_SEPOLIA_PRIVATE_KEY}" ]; then
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"
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}" = "kakarot-staging" ]; then
export EVM_PRIVATE_KEY="0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
export KAKAROT_STAGING_RPC_URL="https://juno-kakarot-testnet-stage.karnot.xyz"
export KAKAROT_STAGING_ACCOUNT_ADDRESS="0x7ecf6cd45c32ce84812e660cc176cb8b4de2e7a6d5916fe326bf871466fbe02"
Expand All @@ -67,28 +86,14 @@ if [ "${ENV}" = "staging" ]; then
fi

SKIP="--ignore tests/end_to_end/L1L2Messaging"
elif [ "${ENV}" = "sepolia" ]; then
export KAKAROT_SEPOLIA_RPC_URL="https://juno-kakarot-dev.karnot.xyz/"
export KAKAROT_SEPOLIA_ACCOUNT_ADDRESS="0x43ABAA073C768EBF039C0C4F46DB9ACC39E9EC165690418060A652AAB39E7D8"
export WEB3_HTTP_PROVIDER_URI="https://sepolia-rpc.kakarot.org"
if [ -z "${EVM_PRIVATE_KEY}" ]; then
echo "Please provide the EVM_PRIVATE_KEY environment variable"
exit 1
fi
if [ -z "${KAKAROT_SEPOLIA_PRIVATE_KEY}" ]; then
echo "Please provide the KAKAROT_SEPOLIA_PRIVATE_KEY environment variable. The private key should be loaded using gpg: gpg -r [email protected] --decrypt path/to/encrypted/key.gpg"
exit 1
fi

SKIP="--ignore tests/end_to_end/L1L2Messaging --ignore tests/end_to_end/test_kakarot.py --ignore tests/end_to_end/CairoPrecompiles -k 'not test_should_return_starknet_timestamp'"
fi

# Deploy the contracts if the deploy command is provided
if ${run_deploy}; then
echo "Deploying the contracts to the ${ENV} environment"

make setup && make build-sol && make build && make fetch-ssj-artifacts && make build-cairo1
poetry run python ./kakarot_scripts/deploy_kakarot.py
uv run python ./kakarot_scripts/deploy_kakarot.py
fi

# Run the tests if the test command is provided
Expand All @@ -103,5 +108,5 @@ if ${run_test}; then
export UNINITIALIZED_ACCOUNT_CLASS_HASH="${UNINITIALIZED_ACCOUNT_CLASS_HASH}"
export ACCOUNT_CONTRACT_CLASS_HASH="${ACCOUNT_CONTRACT_CLASS_HASH}"

eval "poetry run pytest -s tests/end_to_end ${SKIP}"
eval "uv run pytest -s tests/end_to_end ${SKIP}"
fi
Loading