Skip to content

Commit

Permalink
fix script + karnot config
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 e60bb4f commit 7a23049
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
4 changes: 2 additions & 2 deletions deployments/karnot/deployment-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environments:
- project: "sepolia prod"
- project: "sepolia"
id: b429998b-67d1-4866-927e-bc0d432d59d7
repos:
kakarot-rpc:
Expand All @@ -25,7 +25,7 @@ environments:
MONGO_REPLACE_DATA_INSIDE_TRANSACTION: "true"
STARTING_BLOCK: "0"

- project: "sepolia staging"
- project: "sepolia"
id: 4912672c-533c-4198-9834-a8999c0b2db0
repos:
kakarot-rpc:
Expand Down
48 changes: 29 additions & 19 deletions scripts/e2e_pipeline.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,17 +50,21 @@ 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 STARKNET_NETWORK="${ENV}"
export L1_RPC_URL="https://sepolia.infura.io/v3/${INFURA_KEY}"

# Set the environment variables based on the provided environment
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 RPC_URL="https://juno-kakarot-sepolia.karnot.xyz"
export RPC_NAME="starknet-sepolia"
export CHECK_INTERVAL=1
export MAX_WAIT=50
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"
Expand All @@ -75,13 +79,19 @@ if [ "${ENV}" = "sepolia" ]; then
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
elif [ "${ENV}" = "sepolia-staging" ]; then
export EVM_PRIVATE_KEY="0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
export KAKAROT_STAGING_RPC_URL="https://juno-kakarot-sepolia.karnot.xyz/"
export KAKAROT_STAGING_ACCOUNT_ADDRESS="0x06b23fc7c18611614fef21f11620bf033888ae9eae2316af44100debc9faa01a"
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 "${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"
if [ -z "${STARKNET_SEPOLIA_STAGING_ACCOUNT_ADDRESS}" ]; then
echo "Please provide the STARKNET_SEPOLIA_STAGING_ACCOUNT_ADDRESS environment variable. The private key should be loaded using gpg: gpg -r recipient@kakarot.org --decrypt path/to/encrypted/key.gpg"
exit 1
fi
if [ -z "${STARKNET_SEPOLIA_STAGING_PRIVATE_KEY}" ]; then
echo "Please provide the STARKNET_SEPOLIA_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 @@ -92,21 +102,21 @@ fi
if ${run_deploy}; then
echo "Deploying the contracts to the ${ENV} environment"

uv sync --all-extras --dev && make build-sol && make build && make fetch-ssj-artifacts && make build-cairo1
uv run python ./kakarot_scripts/deploy_kakarot.py
uv sync --all-extras --dev && make build-sol && make build
uv run deploy
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.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)
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)

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 ${SKIP}"
eval "uv run pytest -s tests/end_to_end -k 'test_should_return_data_median_for_query' ${SKIP}"
fi

0 comments on commit 7a23049

Please sign in to comment.