@@ -4,9 +4,10 @@ TESTS_DIR=../../../../tests
44. " $TESTS_DIR /consts.sh"
55. " $TESTS_DIR /paths.sh"
66
7- mkdir -p /tmp/oasis-net-runner-sdk-rt
7+ WORKDIR=/tmp/oasis-net-runner-sdk-rt
8+ mkdir -p " $WORKDIR "
89
9- FIXTURE_FILE=" /tmp/oasis-net-runner-sdk-rt /fixture.json"
10+ FIXTURE_FILE=" $WORKDIR /fixture.json"
1011
1112" $TEST_NET_RUNNER " \
1213 dump-fixture \
@@ -21,7 +22,8 @@ FIXTURE_FILE="/tmp/oasis-net-runner-sdk-rt/fixture.json"
2122 --fixture.default.halt_epoch 100000 \
2223 --fixture.default.runtime.version 0.1.0 \
2324 --fixture.default.runtime.version 0.1.0 \
24- --fixture.default.staking_genesis ./staking.json > " $FIXTURE_FILE "
25+ --fixture.default.staking_genesis ./staking.json > " $FIXTURE_FILE " \
26+ --fixture.default.deterministic_entities
2527
2628# Use mock SGX.
2729jq '
3840' " $FIXTURE_FILE " > " $FIXTURE_FILE .tmp"
3941mv " $FIXTURE_FILE .tmp" " $FIXTURE_FILE "
4042
43+ # Run test runner to generate genesis document.
4144" $TEST_NET_RUNNER " \
4245 --fixture.file " $FIXTURE_FILE " \
43- --basedir /tmp/oasis-net-runner-sdk-rt \
44- --basedir.no_temp_dir
46+ --basedir " $WORKDIR " \
47+ --basedir.no_temp_dir &
48+ RUNNER_PID=$!
49+
50+ # Below is a workaround for there being no way to change the default max tx size which
51+ # prevents the compute nodes from registering.
52+ #
53+ # Wait for genesis file to be created so we can patch it.
54+ GENESIS_FILE=" $WORKDIR /net-runner/network/genesis.json"
55+ OUTPUT_GENESIS_FILE=/tmp/genesis.json
56+ while [ ! -e " $GENESIS_FILE " ]; do
57+ sleep 1
58+ done
59+ # Stop the runner.
60+ kill $RUNNER_PID
61+ killall oasis-node
62+ wait
63+ # Wait for all the nodes to stop before proceeding.
64+ while [ $( pgrep oasis-node) ]; do
65+ sleep 1
66+ done
67+ # Patch the genesis file.
68+ jq '
69+ .consensus.params.max_tx_size = 131072 |
70+ .consensus.params.max_block_size = 4194304
71+ ' " $GENESIS_FILE " > " $OUTPUT_GENESIS_FILE "
72+ # Update the fixture to use the patched genesis.
73+ mv " $FIXTURE_FILE " /tmp/fixture.json
74+ jq '
75+ .network.genesis_file = "' $OUTPUT_GENESIS_FILE ' " |
76+ .network.restore_identities = true |
77+ .entities[1].Restore = true
78+ ' /tmp/fixture.json > " $FIXTURE_FILE "
79+ # Reset state.
80+ rm -rf $WORKDIR /net-runner/network/client-* /{consensus,runtime,persistent-store.badger.db}
81+ rm -rf $WORKDIR /net-runner/network/compute-* /{consensus,runtime,persistent-store.badger.db}
82+ rm -rf $WORKDIR /net-runner/network/keymanager-* /{consensus,runtime,persistent-store.badger.db}
83+ rm -rf $WORKDIR /net-runner/network/seed-* /seed
84+ rm -rf $WORKDIR /net-runner/network/validator-* /consensus
85+ # Signal that we can continue.
86+ touch /tmp/cfg_ready
87+
88+ # Run the test runner again.
89+ " $TEST_NET_RUNNER " \
90+ --fixture.file " $FIXTURE_FILE " \
91+ --basedir " $WORKDIR " \
92+ --basedir.no_temp_dir \
93+ --log.format json \
94+ --log.level debug
0 commit comments