-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patches to SEEDS and PEERS + Uses Snapshot Sync as default (#2)
* Broken Genesys, seed and peers on Evmos/tesnet evmos/testnets#2862 - Switch to Genesys file from qubelabs - Add -s flag to sync from Polkadot Snapshot - Fetch last Polkadot snapshot's URL Current setup fails (even with snapshot sync) setup `panic: leveldb` * Removes deprecated README notes
- Loading branch information
Showing
6 changed files
with
102 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,8 @@ command -v wget >/dev/null 2>&1 || { | |
set -e | ||
|
||
# Parse input flags | ||
install=true | ||
overwrite="" | ||
snapshotsync=0 | ||
|
||
while [[ $# -gt 0 ]]; do | ||
key="$1" | ||
|
@@ -49,10 +49,15 @@ while [[ $# -gt 0 ]]; do | |
shift # Move past the flag | ||
;; | ||
-n) | ||
echo "Flag -n passed -> Not overwriting the previous chain data." | ||
echo "Flag -n passed -> Not overwriting the previous config " | ||
overwrite="n" | ||
shift # Move past the argument | ||
;; | ||
-s) | ||
echo "Flag -s passed -> Overwriting data with latest testnet snapshot" | ||
snapshotsync=1 | ||
shift # Move past the argument | ||
;; | ||
*) | ||
echo "Unknown flag passed: $key -> Exiting script!" | ||
exit 1 | ||
|
@@ -75,11 +80,12 @@ fi | |
# Setup local node if overwrite is set to Yes, otherwise skip setup | ||
if [[ $overwrite == "y" || $overwrite == "Y" ]]; then | ||
# Remove the previous folder | ||
rm -rf "$HOMEDIR" | ||
rm -rf "$HOMEDIR/*" | ||
evmosd init $MONIKER --chain-id "$CHAINID" --home "$HOMEDIR" | ||
evmosd config keyring-backend "$KEYRING" --home "$HOMEDIR" | ||
|
||
# Set client config | ||
echo "client config" | ||
evmosd config keyring-backend "$KEYRING" --home "$HOMEDIR" | ||
evmosd config chain-id "$CHAINID" --home "$HOMEDIR" | ||
|
||
# myKey address 0x7cb61d4117ae31a12e393a1cfa3bac666481d02e | evmos10jmp6sgh4cc6zt3e8gw05wavvejgr5pwjnpcky | ||
|
@@ -94,61 +100,69 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then | |
node_address=$(evmosd keys show -a "$VAL_KEY" --keyring-backend "$KEYRING" --home "$HOMEDIR") | ||
|
||
# Set moniker and chain-id for Evmos (Moniker can be anything, chain-id must be an integer) | ||
evmosd tendermint unsafe-reset-all --home "$HOMEDIR" | ||
evmosd init $MONIKER --chain-id "$CHAINID" --home "$HOMEDIR" | ||
|
||
# Download Genesis file for testnet evmos_9000-4 | ||
# wget -O ${GENESIS} https://archive.evmos.dev/evmos_9000-4/genesis.json | ||
wget -O ${GENESIS} https://snapshots.polkachu.com/testnet-genesis/evmos/genesis.json | ||
#evmosd tendermint unsafe-reset-all --home "$HOMEDIR" | ||
|
||
# Download Genesis file for testnet evmos_9000-4, not needed with snapshot sync | ||
if [ "$snapshotsync" -eq 0 ]; then | ||
if [ -f ${GENESIS}] ; then | ||
rm -f ${GENESIS} | ||
fi | ||
# wget -O ${GENESIS} https://archive.evmos.dev/evmos_9000-4/genesis.json | ||
# wget -O ${GENESIS} https://snapshots.polkachu.com/testnet-genesis/evmos/genesis.json | ||
wget -O ${GENESIS} https://qubelabs.io/evmos/genesis.json | ||
fi | ||
|
||
# Update persistent_peers and seeds for testnet setup | ||
PEERS=`curl -sL https://raw.githubusercontent.com/evmos/testnets/main/evmos_9000-4/peers.txt | sort -r | head -n 10 | awk '{print $1}' | paste -s -d, -` | ||
# https://github.com/evmos/testnets/issues/2862 | ||
# PEERS=`curl -sL https://raw.githubusercontent.com/evmos/testnets/main/evmos_9000-4/peers.txt | sort -r | head -n 10 | awk '{print $1}' | paste -s -d, -` | ||
# sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" ${CONFIG} | ||
|
||
PEERS="[email protected]:26661,[email protected]:33656,[email protected]:16758,[email protected]:15656,[email protected]:17056" | ||
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" ${CONFIG} | ||
|
||
SEEDS=`curl -sL https://raw.githubusercontent.com/evmos/testnets/main/evmos_9000-4/seeds.txt | awk '{print $1}' | paste -s -d, -` | ||
SEEDS="[email protected].com:13456" | ||
sed -i '/^seeds =/s/^/#/; /^#seeds =/a seeds = "'"$SEEDS"'"' ${CONFIG} | ||
|
||
# enable prometheus metrics and all APIs for dev node | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
sed -i '' 's/prometheus = false/prometheus = true/' "$CONFIG" | ||
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML" | ||
sed -i '' 's/enabled = false/enabled = true/g' "$APP_TOML" | ||
sed -i '' 's/enable = false/enable = true/g' "$APP_TOML" | ||
# Don't enable memiavl by default | ||
grep -q -F '[memiavl]' "$APP_TOML" && sed -i '' '/\[memiavl\]/,/^\[/ s/enable = true/enable = false/' "$APP_TOML" | ||
else | ||
sed -i 's/prometheus = false/prometheus = true/' "$CONFIG" | ||
sed -i 's/prometheus-retention-time = "0"/prometheus-retention-time = "1000000000000"/g' "$APP_TOML" | ||
sed -i 's/enabled = false/enabled = true/g' "$APP_TOML" | ||
sed -i 's/enable = false/enable = true/g' "$APP_TOML" | ||
# Don't enable memiavl by default | ||
grep -q -F '[memiavl]' "$APP_TOML" && sed -i '/\[memiavl\]/,/^\[/ s/enable = true/enable = false/' "$APP_TOML" | ||
fi | ||
|
||
sed -i 's/prometheus = false/prometheus = true/' "$CONFIG" | ||
sed -i 's/prometheus-retention-time = "0"/prometheus-retention-time = "1000000000000"/g' "$APP_TOML" | ||
sed -i 's/enabled = false/enabled = true/g' "$APP_TOML" | ||
sed -i 's/enable = false/enable = true/g' "$APP_TOML" | ||
# Don't enable memiavl by default | ||
grep -q -F '[memiavl]' "$APP_TOML" && sed -i '/\[memiavl\]/,/^\[/ s/enable = true/enable = false/' "$APP_TOML" | ||
|
||
|
||
# Edit genesys file in python to parse the JSON file in a streaming manner | ||
# Less memory intensive | ||
# echo "editing genesis" | ||
# /usr/bin/genesis_edit.py $GENESIS | ||
|
||
# Run this to ensure everything worked and that the genesis file is setup correctly | ||
echo "validating genesis" | ||
evmosd validate-genesis --home "$HOMEDIR" | ||
# echo "validating genesis" | ||
# evmosd validate-genesis --home "$HOMEDIR" | ||
fi | ||
|
||
# Download Snapshot | ||
if [ "$snapshotsync" -eq 1 ]; then | ||
echo "Fetching snapshot and overwriting ${HOMEDIR}/data" | ||
(/usr/bin/snapshot.sh) | ||
fi | ||
|
||
echo "evmosd tx staking create-validator ..." | ||
evmosd tx staking create-validator \ | ||
--amount=1000000atevmos \ | ||
--pubkey=$(evmosd tendermint show-validator) \ | ||
--moniker="${MONIKER}" \ | ||
--chain-id='evmos_9000-4' \ | ||
--commission-rate="0.05" \ | ||
--commission-max-rate="0.10" \ | ||
--commission-max-change-rate="0.01" \ | ||
--min-self-delegation="1000000" \ | ||
--gas="auto" \ | ||
--gas-prices="0.025atevmos" \ | ||
--from='mykey' \ | ||
--home="${HOMEDIR}" | ||
# echo "evmosd tx staking create-validator ..." | ||
# evmosd tx staking create-validator \ | ||
# --amount=1000000atevmos \ | ||
# --pubkey=$(evmosd tendermint show-validator) \ | ||
# --moniker="${MONIKER}" \ | ||
# --chain-id='evmos_9000-4' \ | ||
# --commission-rate="0.05" \ | ||
# --commission-max-rate="0.10" \ | ||
# --commission-max-change-rate="0.01" \ | ||
# --min-self-delegation="1000000" \ | ||
# --gas="auto" \ | ||
# --gas-prices="0.025atevmos" \ | ||
# --from='mykey' \ | ||
# --home="${HOMEDIR}" | ||
|
||
# evmosd tx staking create-validator \ | ||
# --amount=1000000000atevmos \ | ||
|
@@ -163,6 +177,8 @@ fi | |
# --gas-prices="0.025atevmos" \ | ||
# --from='mykey' | ||
|
||
|
||
|
||
# Start the node | ||
evmosd start \ | ||
--metrics "$TRACE" \ | ||
|
@@ -171,8 +187,8 @@ evmosd start \ | |
--home "$HOMEDIR" | ||
|
||
|
||
evmosd start \ | ||
--metrics "" \ | ||
--log_level info \ | ||
--json-rpc.api eth,txpool,personal,net,debug,web3 \ | ||
--home "/evmos/evmosd" | ||
# evmosd start \ | ||
# --metrics "" \ | ||
# --log_level info \ | ||
# --json-rpc.api eth,txpool,personal,net,debug,web3 \ | ||
# --home "/evmos/evmosd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
# Terraform K8s setup in GKE | ||
Terraform K8s setup of a public and a private GKE cluster | ||
Requires access to gcloud via oauth | ||
# Private Zonal Cluster Terraform Setup | ||
|
||
Create a simple private or public cluster in a single zone. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| cluster\_name\_suffix | A suffix to append to the default cluster name | `string` | `""` | no | | ||
| ip\_range\_pods | The secondary ip range to use for pods | `any` | n/a | yes | | ||
| ip\_range\_services | The secondary ip range to use for services | `any` | n/a | yes | | ||
| network | The VPC network to host the cluster in | `any` | n/a | yes | | ||
| project\_id | The project ID to host the cluster in | `any` | n/a | yes | | ||
| region | The region to host the cluster in | `any` | n/a | yes | | ||
| subnetwork | The subnetwork to host the cluster in | `any` | n/a | yes | | ||
| zones | The zone to host the cluster in (required if is a zonal cluster) | `list(string)` | n/a | yes | | ||
|
||
Use an oauth token, such as this example from a GKE cluster. The google_client_config data source fetches a token from the Google Authorization server, which expires in 1 hour by default. | ||
```json | ||
provider "kubernetes" { | ||
host = "https://${data.google_container_cluster.my_cluster.endpoint}" | ||
token = data.google_client_config.default.access_token | ||
cluster_ca_certificate = base64decode(data.google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate) | ||
} | ||
``` | ||
## Update Inputs In terraform.tfvars | ||
The code is pretty generic, most variable can directly be set in the .tfvars file | ||
A generic VPC confuration is set in private-vpc.tf. Edit as needed. | ||
|
||
To provision this example, run the following from within this directory: | ||
- `terraform init` to get the plugins | ||
- `terraform plan` to see the infrastructure plan | ||
- `terraform apply` to apply the infrastructure build | ||
- `terraform destroy` to destroy the built infrastructure |
This file was deleted.
Oops, something went wrong.