Skip to content

Commit

Permalink
client-sdk/ts-web: Workaround max tx size issue in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Nov 25, 2024
1 parent faecfd7 commit e9eb6b6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -370,6 +370,10 @@ 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
/tmp/envoy.log
e2e-rt:
# NOTE: This name appears in GitHub's Checks API.
Expand Down
2 changes: 1 addition & 1 deletion client-sdk/ts-web/rt/playground/sample-run-envoy.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh -eux
envoy -c sample-envoy.yaml
envoy -c sample-envoy.yaml --log-path /tmp/envoy.log
47 changes: 43 additions & 4 deletions client-sdk/ts-web/rt/playground/sample-run-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 '
Expand All @@ -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

0 comments on commit e9eb6b6

Please sign in to comment.