-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·67 lines (51 loc) · 3.4 KB
/
entrypoint.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
63
64
65
66
67
#!/bin/sh
set -eux -o pipefail
if [ -f ~/.initia/config/bootstrapped ]; then
exec "$@"
fi
rm -rf ~/.initia 2>/dev/null || true
initiad init test --chain-id $INITIA_CHAIN_ID >/dev/null 2>&1
dasel put -f ~/.initia/config/config.toml -t string '.rpc.laddr' -v 'tcp://0.0.0.0:26657'
dasel put -f ~/.initia/config/app.toml -t bool '.api.enable' -v true
dasel put -f ~/.initia/config/app.toml -t string '.api.address' -v 'tcp://0.0.0.0:1317'
dasel put -f ~/.initia/config/client.toml -t string 'chain-id' -v $INITIA_CHAIN_ID
dasel put -f ~/.initia/config/client.toml -t string 'keyring-backend' -v 'test'
dasel put -f ~/.initia/config/client.toml -t string 'output' -v 'json'
# Set minimum gas price to zero
dasel put -f ~/.initia/config/genesis.json -t string '.app_state.move.params.base_min_gas_price' -v '0.000000000000000000'
echo $INITIA_VALIDATOR_MNEMONIC | initiad keys add validator --recover >/dev/null 2>&1
initiad genesis add-genesis-account validator 1000000000000uinit --keyring-backend test
echo $MINITIA_OUTPUT_SUBMITTER_MNEMONIC | initiad keys add minitia_output_submitter --recover >/dev/null 2>&1
echo $MINITIA_BATCH_SUBMITTER_MNEMONIC | initiad keys add minitia_batch_submitter --recover >/dev/null 2>&1
# We're adding these accounts in genesis for simplicity of setup.
initiad genesis add-genesis-account $MILKYWAY_BRIDGE_EXECUTOR 1000000000000uinit
initiad genesis add-genesis-account $MINITIA_BRIDGE_EXECUTOR 1000000000000uinit
initiad genesis add-genesis-account $MINITIA_OUTPUT_SUBMITTER 1000000000000uinit
initiad genesis add-genesis-account $MINITIA_BATCH_SUBMITTER 1000000000000uinit
initiad genesis add-genesis-account $MINITIA_CHALLENGER 1000000000000uinit
initiad genesis add-genesis-account $OPERATOR1_EXECUTOR 1000000000000uinit
initiad genesis add-genesis-account $OPERATOR2_EXECUTOR 1000000000000uinit
initiad genesis add-genesis-account $OPERATOR3_EXECUTOR 1000000000000uinit
initiad genesis add-genesis-account $OPERATOR1_BATCH_SUBMITTER 1000000000000uinit
initiad genesis add-genesis-account $OPERATOR2_BATCH_SUBMITTER 1000000000000uinit
initiad genesis add-genesis-account $OPERATOR3_BATCH_SUBMITTER 1000000000000uinit
initiad genesis gentx validator 1000000000uinit 2>/dev/null
initiad genesis collect-gentxs 2>/dev/null
initiad start &
sleep 5
function wait_tx() {
while ! initiad q tx $1 >/dev/null 2>&1; do
sleep 0.1
done
}
export INITIAD_GAS="auto"
export INITIAD_YES="1"
wait_tx $(initiad tx authz grant $OPERATOR1_EXECUTOR generic --msg-type "/opinit.ophost.v1.MsgProposeOutput" --from $MINITIA_OUTPUT_SUBMITTER | jq -r '.txhash')
wait_tx $(initiad tx authz grant $OPERATOR2_EXECUTOR generic --msg-type "/opinit.ophost.v1.MsgProposeOutput" --from $MINITIA_OUTPUT_SUBMITTER | jq -r '.txhash')
wait_tx $(initiad tx authz grant $OPERATOR3_EXECUTOR generic --msg-type "/opinit.ophost.v1.MsgProposeOutput" --from $MINITIA_OUTPUT_SUBMITTER | jq -r '.txhash')
wait_tx $(initiad tx authz grant $OPERATOR1_BATCH_SUBMITTER generic --msg-type "/opinit.ophost.v1.MsgRecordBatch" --from $MINITIA_BATCH_SUBMITTER | jq -r '.txhash')
wait_tx $(initiad tx authz grant $OPERATOR2_BATCH_SUBMITTER generic --msg-type "/opinit.ophost.v1.MsgRecordBatch" --from $MINITIA_BATCH_SUBMITTER | jq -r '.txhash')
wait_tx $(initiad tx authz grant $OPERATOR3_BATCH_SUBMITTER generic --msg-type "/opinit.ophost.v1.MsgRecordBatch" --from $MINITIA_BATCH_SUBMITTER | jq -r '.txhash')
kill %1; wait %1
touch ~/.initia/config/bootstrapped
exec "$@"