diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index 7eca4ed5a1..db309df13c 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -348,7 +348,7 @@ jobs: - name: 'testnet: Wait for node socket' run: | - while [ ! -e /tmp/oasis-net-runner-sdk-rt/net-runner/network/client-0/internal.sock ]; do + while [[ ! -e /tmp/oasis-net-runner-sdk-rt/net-runner/network/client-0/internal.sock && ! -e /tmp/cfg_ready ]]; do sleep 1 done @@ -370,6 +370,9 @@ jobs: name: e2e-ts-web-rt-logs path: | /tmp/oasis-net-runner-sdk-rt/**/*.log + /tmp/oasis-net-runner-sdk-rt/**/*.json + /tmp/genesis.json + /tmp/fixture.json e2e-rt: # NOTE: This name appears in GitHub's Checks API. diff --git a/client-sdk/ts-web/rt/playground/sample-run-network.sh b/client-sdk/ts-web/rt/playground/sample-run-network.sh index a817921a67..3c782190f3 100755 --- a/client-sdk/ts-web/rt/playground/sample-run-network.sh +++ b/client-sdk/ts-web/rt/playground/sample-run-network.sh @@ -4,9 +4,10 @@ TESTS_DIR=../../../../tests . "$TESTS_DIR/consts.sh" . "$TESTS_DIR/paths.sh" -mkdir -p /tmp/oasis-net-runner-sdk-rt +WORKDIR=/tmp/oasis-net-runner-sdk-rt +mkdir -p "$WORKDIR" -FIXTURE_FILE="/tmp/oasis-net-runner-sdk-rt/fixture.json" +FIXTURE_FILE="$WORKDIR/fixture.json" "$TEST_NET_RUNNER" \ dump-fixture \ @@ -21,7 +22,8 @@ FIXTURE_FILE="/tmp/oasis-net-runner-sdk-rt/fixture.json" --fixture.default.halt_epoch 100000 \ --fixture.default.runtime.version 0.1.0 \ --fixture.default.runtime.version 0.1.0 \ - --fixture.default.staking_genesis ./staking.json >"$FIXTURE_FILE" + --fixture.default.staking_genesis ./staking.json >"$FIXTURE_FILE" \ + --fixture.default.deterministic_entities # Use mock SGX. jq ' @@ -38,9 +40,46 @@ jq ' ' "$FIXTURE_FILE" >"$FIXTURE_FILE.tmp" mv "$FIXTURE_FILE.tmp" "$FIXTURE_FILE" +# Run test runner to generate genesis document. "$TEST_NET_RUNNER" \ --fixture.file "$FIXTURE_FILE" \ - --basedir /tmp/oasis-net-runner-sdk-rt \ + --basedir "$WORKDIR" \ + --basedir.no_temp_dir & +RUNNER_PID=$! + +# Below is a workaround for there being no way to change the default max tx size which +# prevents the compute nodes from registering. +# +# Wait for genesis file to be created so we can patch it. +GENESIS_FILE="$WORKDIR/net-runner/network/genesis.json" +OUTPUT_GENESIS_FILE=/tmp/genesis.json +while [ ! -e "$GENESIS_FILE" ]; do + sleep 1 +done +# Stop the runner. +kill -9 $RUNNER_PID +# Patch the genesis file. +jq ' + .consensus.params.max_tx_size = 131072 | + .consensus.params.max_block_size = 4194304 +' "$GENESIS_FILE" >"$OUTPUT_GENESIS_FILE" +# Update the fixture to use the patched genesis. +mv "$FIXTURE_FILE" /tmp/fixture.json +jq ' + .network.genesis_file = "'$OUTPUT_GENESIS_FILE'" | + .network.restore_identities = true | + .entities[1].Restore = true +' /tmp/fixture.json > "$FIXTURE_FILE" +# Reset state. +rm -rf "$WORKDIR/net-runner/network/*/{consensus,runtime,persistent-store.badger.db}" +rm -rf "$WORKDIR/net-runner/network/*/internal.sock" +# Signal that we can continue. +touch /tmp/cfg_ready + +# Run the test runner again. +"$TEST_NET_RUNNER" \ + --fixture.file "$FIXTURE_FILE" \ + --basedir "$WORKDIR" \ --basedir.no_temp_dir \ --log.format json \ --log.level debug