Skip to content

Commit

Permalink
add permissioned and permissionless operators modes to e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Kimura <[email protected]>
  • Loading branch information
bluele committed Jun 17, 2024
1 parent 6dd6fa5 commit 89f443f
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 12 additions & 1 deletion scripts/run_e2e_test.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
39 changes: 39 additions & 0 deletions tests/e2e/cases/tm2tm/configs/templates/ibc-0-operators.json.tpl
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
10 changes: 1 addition & 9 deletions tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
39 changes: 39 additions & 0 deletions tests/e2e/cases/tm2tm/configs/templates/ibc-1-operators.json.tpl
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
10 changes: 1 addition & 9 deletions tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
4 changes: 2 additions & 2 deletions tests/e2e/cases/tm2tm/scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions tests/e2e/scripts/gen_rly_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 89f443f

Please sign in to comment.