This repository has been archived by the owner on Oct 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathgateway.sh
executable file
·62 lines (53 loc) · 2.08 KB
/
gateway.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -euo pipefail
oasis_node="${OASIS_CORE_ROOT_PATH}/go/oasis-node/oasis-node"
oasis_runner="${OASIS_CORE_ROOT_PATH}/go/oasis-net-runner/oasis-net-runner"
runtime_binary="${RUNTIME_CARGO_TARGET_DIR}/debug/oasis-ethwasi-runtime"
runtime_loader="${OASIS_CORE_ROOT_PATH}/target/default/debug/oasis-core-runtime-loader"
runtime_genesis="${GENESIS_ROOT_PATH}/oasis_genesis_testing.json"
keymanager_binary="${RUNTIME_CARGO_TARGET_DIR}/debug/oasis-ethwasi-runtime-keymanager"
web3_gateway="${RUNTIME_CARGO_TARGET_DIR}/debug/gateway"
# Prepare an empty data directory.
data_dir="/var/tmp/oasis-ethwasi-runtime-runner"
rm -rf "${data_dir}"
mkdir -p "${data_dir}"
chmod -R go-rwx "${data_dir}"
client_socket="${data_dir}/net-runner/network/client-0/internal.sock"
# Run the network.
echo "Starting the test network."
${oasis_runner} \
--fixture.default.node.binary ${oasis_node} \
--fixture.default.runtime.binary ${runtime_binary} \
--fixture.default.runtime.loader ${runtime_loader} \
--fixture.default.runtime.genesis_state ${runtime_genesis} \
--fixture.default.keymanager.binary ${keymanager_binary} \
--fixture.default.epochtime_mock \
--basedir.no_temp_dir \
--basedir ${data_dir} &
# Wait for the validator and keymanager nodes to be registered.
echo "Waiting for the validator and keymanager to be registered."
${oasis_node} debug control wait-nodes \
--address unix:${client_socket} \
--nodes 2 \
--wait
# Advance epoch.
echo "Advancing epoch."
${oasis_node} debug control set-epoch \
--address unix:${client_socket} \
--epoch 1
# Wait for all nodes to be registered.
echo "Waiting for all nodes to be registered."
${oasis_node} debug control wait-nodes \
--address unix:${client_socket} \
--nodes 6 \
--wait
# Advance epoch.
echo "Advancing epoch."
${oasis_node} debug control set-epoch \
--address unix:${client_socket} \
--epoch 2
# Start the gateway.
echo "Starting the web3 gateway."
${web3_gateway} \
--node-address unix:${client_socket} \
--runtime-id 8000000000000000000000000000000000000000000000000000000000000000