Skip to content

Commit

Permalink
Added flixnet-2 folder & updated scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 committed Sep 3, 2021
1 parent 974d6bd commit a5ce685
Show file tree
Hide file tree
Showing 8 changed files with 866 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/verify-gentx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ jobs:
- name: validate-gentx
run: |
bash -x ./scripts/verify_gentx.sh
- name: check-is-previous-participant
run: |
python3 ./scripts/is_prev_participant.py
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

808 changes: 808 additions & 0 deletions flixnet-1/validator_addresses.txt

Large diffs are not rendered by default.

Empty file added flixnet-2/gentxs/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion scripts/generate_genesis.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

CHAIN_ID=flixnet-1
CHAIN_ID=flixnet-2
NODE_HOME=/tmp/ofhub
CONFIG=/tmp/ofhub/config

Expand Down
29 changes: 29 additions & 0 deletions scripts/is_prev_participant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import glob
import json


CHAIN_ID = 'flixnet-2'
PREV_CHAIN_ID = 'flixnet-1'
gentx_files = glob.glob(f'./{CHAIN_ID}/gentxs/*.json')

if len(gentx_files) != 1:
print("invalid submission!!")
exit(1)

gentx_file = gentx_files[0]

with open(gentx_file, 'r') as f:
gentx = json.loads(f.read())


p_file = f'./{PREV_CHAIN_ID}/validator_addresses.txt'
with open(p_file, 'r') as p_f:
text = p_f.read()
prev_participants = text.strip().split('\n')

if gentx['body']['messages'][0]['validator_address'] in prev_participants:
print("Yes, Previous Participant")
else:
print('No')


4 changes: 2 additions & 2 deletions scripts/start_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

NODE_HOME=~/.omniflixhub
NODE_MONIKER="myflixnode"
CHAIN_ID="flixnet-1"
CHAIN_ID="flixnet-2"
SERVICE_NAME="omniflixhubd"

is_exists () {
Expand Down Expand Up @@ -44,7 +44,7 @@ else
sudo apt-get install git curl build-essential make jq -y
git clone https://github.com/Omniflix/omniflixhub.git
cd omniflixhub
git checkout v0.1.0
git checkout v0.2.1
make install

echo "omniflixhub installed ..."
Expand Down
27 changes: 21 additions & 6 deletions scripts/verify_gentx.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
#!/bin/sh
FLIX_HOME="/tmp/omniflixhub$(date +%s)"
RANDOM_KEY="random-validator-key"
CHAIN_ID=flixnet-1
CHAIN_ID=flixnet-2
VERSION=v0.2.1

GENTX_FILE=$(find ./$CHAIN_ID/gentxs -iname "*.json")
LEN_GENTX=$(echo ${#GENTX_FILE})

GENTX_DEADLINE=$(date -u -d '2021-07-26T18:00:00.000Z' +'%s')
GENTX_SUBMISSION_START=$(date -u -d '2021-09-03T14:00:00.000Z' +'%s')
GENTX_SUBMISSION_DEADLINE=$(date -u -d '2021-09-06T14:00:00.000Z' +'%s')

now=$(date -u +'%s')

declare -i maxbond=50000000
if [ $now -le GENTX_SUBMISSION_START ]; then
echo 'Gentx submission not started yet'
exit 1
fi

if [ $now -ge $GENTX_DEADLINE ]; then
if [ $now -ge GENTX_SUBMISSION_DEADLINE ]; then
echo 'Gentx submission is closed'
exit 1
fi
GENTX_FILE=$(find ./$CHAIN_ID/gentxs -iname "*.json")
FILES_COUNT=$(find ./$CHAIN_ID/gentxs -iname "*.json" | wc -l)
LEN_GENTX=$(echo ${#GENTX_FILE})

if [ $FILES_COUNT -g 1 ]; then
echo 'Invalid! found more than 1 json file'
exit 1
fi

if [ $LEN_GENTX -eq 0 ]; then
echo "gentx file not found."
exit 1
else
set -e

Expand All @@ -38,7 +52,7 @@ else
fi
echo "...........Init omniflixhub.............."

wget -q https://github.com/OmniFlix/omniflixhub/releases/download/v0.1.0/omniflixhubd -O omniflixhubd
wget -q https://github.com/OmniFlix/omniflixhub/releases/download/$VERSION/omniflixhubd -O omniflixhubd
chmod +x omniflixhubd

./omniflixhubd keys add $RANDOM_KEY --home $FLIX_HOME
Expand Down Expand Up @@ -78,3 +92,4 @@ else
killall omniflixhubd >/dev/null 2>&1
rm -rf $FLIX_HOME >/dev/null 2>&1
fi

0 comments on commit a5ce685

Please sign in to comment.