forked from solana-foundation/stake-o-matic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stake-o-matic.sh
executable file
·92 lines (83 loc) · 2.49 KB
/
stake-o-matic.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
#
# Downloads and runs the latest stake-o-matic binary
#
set -ex
"$(dirname "$0")"/fetch-release.sh "$STAKE_O_MATIC_RELEASE"
if [[ -n $FOLLOWER ]]; then
REQUIRE_CLASSIFICATION="--require-classification"
else
MARKDOWN="--markdown first"
fi
if [[ ! -d db ]]; then
git clone git@github.com:solana-labs/stake-o-matic.wiki.git db
fi
# shellcheck disable=SC2206
TESTNET_ARGS=(
--url ${URL:?}
--cluster testnet
--quality-block-producer-percentage 30
--max-poor-block-producer-percentage 20
--max-infrastructure-concentration 25
--min-epoch-credit-percentage-of-average 35
--infrastructure-concentration-affects destake-new
--min-release-version 1.7.3
)
# shellcheck disable=SC2206
MAINNET_BETA_ARGS=(
--url ${URL:?}
--cluster mainnet-beta
--quality-block-producer-percentage 30
--max-poor-block-producer-percentage 20
--min-epoch-credit-percentage-of-average 35
--max-active-stake 3000000
--max-commission 10
--min-release-version 1.6.20
--max-infrastructure-concentration 10
--infrastructure-concentration-affects destake-new
--min-self-stake 100
--min-testnet-participation 5 10
)
# shellcheck disable=SC2206
NOT_A_STAKE_POOL_ARGS=(
$MARKDOWN
$CONFIRM
$REQUIRE_CLASSIFICATION
stake-pool-v0
--min-reserve-stake-balance ${MIN_RESERVE_STAKE_BALANCE:?}
${RESERVE_ACCOUNT_ADDRESS:?}
${STAKE_AUTHORITY_KEYPAIR:?}
${BASELINE_STAKE_AMOUNT:?}
)
# shellcheck disable=SC2206
STAKE_POOL_ARGS=(
$CONFIRM
$REQUIRE_CLASSIFICATION
--db-suffix stake-pool
stake-pool
${STAKE_POOL_ADDRESS:?}
${STAKE_AUTHORITY_KEYPAIR:?}
${BASELINE_STAKE_AMOUNT:?}
)
if [[ $CLUSTER = "testnet-stake-pool" ]]; then
./solana-stake-o-matic "${TESTNET_ARGS[@]}" "${STAKE_POOL_ARGS[@]}"
elif [[ $CLUSTER = "mainnet-beta-stake-pool" ]]; then
./solana-stake-o-matic "${MAINNET_BETA_ARGS[@]}" "${STAKE_POOL_ARGS[@]}"
elif [[ $CLUSTER == "testnet" ]]; then
./solana-stake-o-matic "${TESTNET_ARGS[@]}" "${NOT_A_STAKE_POOL_ARGS[@]}"
elif [[ $CLUSTER == "mainnet-beta" ]]; then
./solana-stake-o-matic "${MAINNET_BETA_ARGS[@]}" "${NOT_A_STAKE_POOL_ARGS[@]}"
else
echo "CLUSTER must be set to testnet-stake-pool, mainnet-beta-stake-pool, testnet, or mainnet-beta"
exit 1
fi
if [[ -z $FOLLOWER && $BUILDKITE = true ]]; then
git config --global user.email maintainers@solana.foundation
git config --global user.name "Solana Maintainers"
cd db
git add ./*
if ! git diff-index --quiet HEAD; then
git commit -m "Automated update by $BUILDKITE_BUILD_ID"
git push origin
fi
fi