diff --git a/Makefile b/Makefile index b697853..4a7d091 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ tendermint-images: .PHONY: e2e-test e2e-test: yrly lcp - ./scripts/run_e2e_test.sh + ./scripts/run_e2e_test.sh $(E2E_OPTIONS) .PHONY: proto-gen proto-update-deps proto-gen: diff --git a/scripts/run_e2e_test.sh b/scripts/run_e2e_test.sh index ef38cc3..2d21de3 100755 --- a/scripts/run_e2e_test.sh +++ b/scripts/run_e2e_test.sh @@ -1,6 +1,15 @@ #!/bin/sh set -ex +# Usage: run_e2e_test.sh <--operators_enabled> + +export OPERATORS_ENABLED=false +if [ "$1" = "--operators_enabled" ]; then + OPERATORS_ENABLED=true +fi + +echo "OPERATORS_ENABLED: $OPERATORS_ENABLED" + LCP_BIN=./bin/lcp ENCLAVE_PATH=./bin/enclave.signed.so CERTS_DIR=./lcp/tests/certs @@ -31,6 +40,8 @@ make -C tests/e2e/cases/tm2tm restore make -C tests/e2e/cases/tm2tm test-relay make -C tests/e2e/cases/tm2tm test-elc-cmd -make -C tests/e2e/cases/tm2tm test-operators +if [ "$OPERATORS_ENABLED" = true ]; then + make -C tests/e2e/cases/tm2tm test-operators +fi make -C tests/e2e/cases/tm2tm network-down kill $LCP_PID diff --git a/tests/e2e/cases/tm2tm/configs/templates/ibc-0-operators.json.tpl b/tests/e2e/cases/tm2tm/configs/templates/ibc-0-operators.json.tpl new file mode 100644 index 0000000..28e1668 --- /dev/null +++ b/tests/e2e/cases/tm2tm/configs/templates/ibc-0-operators.json.tpl @@ -0,0 +1,39 @@ +{ + "chain": { + "@type": "/relayer.chains.tendermint.config.ChainConfig", + "key": "testkey", + "chain_id": "ibc0", + "rpc_addr": "http://localhost:26657", + "account_prefix": "cosmos", + "gas_adjustment": 1.5, + "gas_prices": "0.025stake", + "average_block_time_msec": 1000, + "max_retry_for_commit": 5 + }, + "prover": { + "@type": "/relayer.provers.lcp.config.ProverConfig", + "origin_prover": { + "@type": "/relayer.chains.tendermint.config.ProverConfig", + "trusting_period": "336h", + "refresh_threshold_rate": { + "numerator": 1, + "denominator": 2 + } + }, + "lcp_service_address": "localhost:50051", + "mrenclave": "$MRENCLAVE", + "allowed_quote_statuses": ["GROUP_OUT_OF_DATE"], + "allowed_advisory_ids": ["INTEL-SA-00219","INTEL-SA-00289","INTEL-SA-00334","INTEL-SA-00477","INTEL-SA-00614","INTEL-SA-00615","INTEL-SA-00617"], + "key_expiration": 604800, + "elc_client_id": "07-tendermint-1", + "is_debug_enclave": true, + "operators": [ + "0xcb96F8d6C2d543102184d679D7829b39434E4EEc" + ], + "operator_private_key": "0x99b107441d0bce8e5b0078450f10f309910d8c0a2cc91671bd6cc1a284809642", + "cosmos_chain_eip712_salt": { + "chain_id": "ibc1", + "prefix": "ibc" + } + } +} diff --git a/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl b/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl index 28e1668..e1bc5cd 100644 --- a/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl +++ b/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl @@ -26,14 +26,6 @@ "allowed_advisory_ids": ["INTEL-SA-00219","INTEL-SA-00289","INTEL-SA-00334","INTEL-SA-00477","INTEL-SA-00614","INTEL-SA-00615","INTEL-SA-00617"], "key_expiration": 604800, "elc_client_id": "07-tendermint-1", - "is_debug_enclave": true, - "operators": [ - "0xcb96F8d6C2d543102184d679D7829b39434E4EEc" - ], - "operator_private_key": "0x99b107441d0bce8e5b0078450f10f309910d8c0a2cc91671bd6cc1a284809642", - "cosmos_chain_eip712_salt": { - "chain_id": "ibc1", - "prefix": "ibc" - } + "is_debug_enclave": true } } diff --git a/tests/e2e/cases/tm2tm/configs/templates/ibc-1-operators.json.tpl b/tests/e2e/cases/tm2tm/configs/templates/ibc-1-operators.json.tpl new file mode 100644 index 0000000..74bee5d --- /dev/null +++ b/tests/e2e/cases/tm2tm/configs/templates/ibc-1-operators.json.tpl @@ -0,0 +1,39 @@ +{ + "chain": { + "@type": "/relayer.chains.tendermint.config.ChainConfig", + "key": "testkey", + "chain_id": "ibc1", + "rpc_addr": "http://localhost:26557", + "account_prefix": "cosmos", + "gas_adjustment": 1.5, + "gas_prices": "0.025stake", + "average_block_time_msec": 1000, + "max_retry_for_commit": 5 + }, + "prover": { + "@type": "/relayer.provers.lcp.config.ProverConfig", + "origin_prover": { + "@type": "/relayer.chains.tendermint.config.ProverConfig", + "trusting_period": "336h", + "refresh_threshold_rate": { + "numerator": 1, + "denominator": 2 + } + }, + "lcp_service_address": "localhost:50051", + "mrenclave": "$MRENCLAVE", + "allowed_quote_statuses": ["GROUP_OUT_OF_DATE"], + "allowed_advisory_ids": ["INTEL-SA-00219","INTEL-SA-00289","INTEL-SA-00334","INTEL-SA-00477","INTEL-SA-00614","INTEL-SA-00615","INTEL-SA-00617"], + "key_expiration": 604800, + "elc_client_id": "07-tendermint-0", + "is_debug_enclave": true, + "operators": [ + "0x9722414d09f43fb02235d739B50F4C027F43e657" + ], + "operator_private_key": "0x8a94e9f944a297c402a997aa9a60026ce47a6e018192d111c1703176bbc26651", + "cosmos_chain_eip712_salt": { + "chain_id": "ibc0", + "prefix": "ibc" + } + } +} diff --git a/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl b/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl index 74bee5d..b52be04 100644 --- a/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl +++ b/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl @@ -26,14 +26,6 @@ "allowed_advisory_ids": ["INTEL-SA-00219","INTEL-SA-00289","INTEL-SA-00334","INTEL-SA-00477","INTEL-SA-00614","INTEL-SA-00615","INTEL-SA-00617"], "key_expiration": 604800, "elc_client_id": "07-tendermint-0", - "is_debug_enclave": true, - "operators": [ - "0x9722414d09f43fb02235d739B50F4C027F43e657" - ], - "operator_private_key": "0x8a94e9f944a297c402a997aa9a60026ce47a6e018192d111c1703176bbc26651", - "cosmos_chain_eip712_salt": { - "chain_id": "ibc0", - "prefix": "ibc" - } + "is_debug_enclave": true } } diff --git a/tests/e2e/cases/tm2tm/scripts/restore b/tests/e2e/cases/tm2tm/scripts/restore index ea37127..e751445 100755 --- a/tests/e2e/cases/tm2tm/scripts/restore +++ b/tests/e2e/cases/tm2tm/scripts/restore @@ -3,8 +3,8 @@ set -eux RLY="${RLY_BIN} --debug" -${RLY} lcp restore-elc ibc01 --src=false ${RLY} lcp restore-elc ibc01 --src=true +${RLY} lcp restore-elc ibc01 --src=false -${RLY} lcp remove-eki ibc01 --src=false ${RLY} lcp remove-eki ibc01 --src=true +${RLY} lcp remove-eki ibc01 --src=false diff --git a/tests/e2e/scripts/gen_rly_config.sh b/tests/e2e/scripts/gen_rly_config.sh index c723851..cf44644 100755 --- a/tests/e2e/scripts/gen_rly_config.sh +++ b/tests/e2e/scripts/gen_rly_config.sh @@ -2,7 +2,16 @@ set -eux TEMPLATE_DIR=./tests/e2e/cases/tm2tm/configs/templates CONFIG_DIR=./tests/e2e/cases/tm2tm/configs/demo + +if [ "$OPERATORS_ENABLED" = true ]; then + IBC_0_TEMPLATE=ibc-0-operators.json.tpl + IBC_1_TEMPLATE=ibc-1-operators.json.tpl +else + IBC_0_TEMPLATE=ibc-0.json.tpl + IBC_1_TEMPLATE=ibc-1.json.tpl +fi + mkdir -p $CONFIG_DIR MRENCLAVE=$(./bin/lcp enclave metadata --enclave=./bin/enclave.signed.so | jq -r .mrenclave) -jq --arg MRENCLAVE ${MRENCLAVE} -r '.prover.mrenclave = $MRENCLAVE' ${TEMPLATE_DIR}/ibc-0.json.tpl > ${CONFIG_DIR}/ibc-0.json -jq --arg MRENCLAVE ${MRENCLAVE} -r '.prover.mrenclave = $MRENCLAVE' ${TEMPLATE_DIR}/ibc-1.json.tpl > ${CONFIG_DIR}/ibc-1.json +jq --arg MRENCLAVE ${MRENCLAVE} -r '.prover.mrenclave = $MRENCLAVE' ${TEMPLATE_DIR}/$IBC_0_TEMPLATE > ${CONFIG_DIR}/ibc-0.json +jq --arg MRENCLAVE ${MRENCLAVE} -r '.prover.mrenclave = $MRENCLAVE' ${TEMPLATE_DIR}/$IBC_1_TEMPLATE > ${CONFIG_DIR}/ibc-1.json