Skip to content

Commit

Permalink
Various fixes to make V0 LocalNet work on WSL2
Browse files Browse the repository at this point in the history
- Remove go.mod.local and use the latest go.mod in the pocket-core branch
- Update the tendermint path in go.mod before `go build`
  - docker/pokt-net/dev-tm/Dockerfile for scaffold
  - docker/pokt-net/dev-tm/prepare-tendermint.sh for playground nodes
- Clean up pocket-core/vendor before creating a container
- Simplify data directory creation because
  `paths=($(echo $nodes | tr " " "\n"))` causes a syntax error somehow
- Update some critical parameters in genesis.json with the same values as mainnet
  • Loading branch information
msmania committed Apr 4, 2023
1 parent 70369dd commit 5c38698
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 113 deletions.
2 changes: 1 addition & 1 deletion bin/pokt-net/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function update_chains_json() {
if [[ ! -z ${ETH_ALTRUIST} && ! -z ${POLY_ALTRUIST} ]]; then
echo "ETH_ALTRUIST and POLY_ALTRUIST are set so we are going update chains.json"
sed "s#http://user:[email protected]#${ETH_ALTRUIST}#g" stacks/pokt-net/shared/chains.template.json > stacks/pokt-net/shared/chains.local.json
sed -i '' "s#http://user:[email protected]#${POLY_ALTRUIST}#g" stacks/pokt-net/shared/chains.local.json
sed -i "s#http://user:[email protected]#${POLY_ALTRUIST}#g" stacks/pokt-net/shared/chains.local.json
else
echo "ETH_ALTRUIST and POLY_ALTRUIST are not set so we are not going update chains.json"
cp stacks/pokt-net/shared/chains.template.json > stacks/pokt-net/shared/chains.local.json
Expand Down
11 changes: 7 additions & 4 deletions docker/pokt-net/dev-tm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ RUN mkdir -p /home/app/.pocket/config
RUN chown -R app /home/app/.pocket
RUN chown -R app /go

# Overwrite go.mod files for local development
RUN sed -i 's|^replace github.com/tendermint/tendermint => .*$|replace github.com/tendermint/tendermint => '$TENDERMINT_PATH'|' $POCKET_PATH/go.mod
RUN cp $POCKET_PATH/go.mod $POCKET_ROOT/go.mod.core

# Clear vendor directory to reset the previous run
RUN rm -rf $POCKET_PATH/vendor

# Build the pocket main binary using the mainline dependencies
RUN cd ${POCKET_PATH} \
&& go build -tags cleveldb -o ${GOPATH}/bin/pocket app/cmd/pocket_core/main.go

# Overwrite go.mod files for local development
COPY ${POCKET_E2E_STACK_RELATIVE_PATH}/go.mod.local $POCKET_ROOT/go.mod.core
RUN chmod 654 $POCKET_ROOT/go.mod.core

# Overwrite go.mod files for local development
COPY ${POCKET_E2E_STACK_RELATIVE_PATH}/go.mod.tendermint $POCKET_ROOT/go.mod.tendermint
RUN chmod 654 $POCKET_ROOT/go.mod.tendermint
Expand Down
83 changes: 0 additions & 83 deletions docker/pokt-net/dev-tm/go.mod.local

This file was deleted.

8 changes: 4 additions & 4 deletions docker/pokt-net/dev-tm/prepare-tendermint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ if [[ -f "/dev/tendermint.built" ]]; then
go mod tidy && go mod vendor
# Need to get the dependencies in the docker container
go mod download
go build cmd/tendermint/main.go
fi
cd $TENDERMINT_PATH
go build cmd/tendermint/main.go

# Doing a `mv` here errors; can't preserve ownership
cp -f $POCKET_ROOT/go.mod.core $POCKET_PATH/go.mod

if [[ -f "/dev/core.built" ]]; then
touch "/dev/core.built"
echo "Installing dependencies for core..."
# Doing a `mv` here errors; can't preserve ownershi
cp -f $POCKET_ROOT/go.mod.core $POCKET_PATH/go.mod
cd $POCKET_PATH
# Need to update vendor/module.txt to the local dev paths
go mod tidy && go mod vendor
Expand Down
4 changes: 2 additions & 2 deletions docker/pokt-net/dev-tm/watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ echo "Starting watch.sh..."
echo "POCKET_CORE_SEEDS: $POCKET_CORE_SEEDS";
echo "POCKET_ADDRESS: $POCKET_ADDRESS";

if [ -z $EXECOMMAND ]
if [ -z "$EXECCOMMAND" ]
then
echo "Expecting EXECOMMAND env var, none was exported.";
echo "Expecting EXECCOMMAND env var, none was exported.";
export EXECCOMMAND="start --seeds $POCKET_CORE_SEEDS --keybase=false --datadir=/home/app/.pocket"
echo "Exported $EXECCOMMAND as EXECCOMMAND";
fi;
Expand Down
2 changes: 1 addition & 1 deletion stacks/pokt-net/scaffold/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

rm -rf $CWD/stacks/pokt-playground
sudo rm -rf $CWD/stacks/pokt-playground
22 changes: 7 additions & 15 deletions stacks/pokt-net/scaffold/up.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
#!/usr/bin/bash

create_data_folder() {
mkdir -p $1/data/
}

create_data_folders_for_nodes() {
paths=$1
for i in "${!paths[@]}"
do
create_data_folder $CWD/stacks/pokt-playground/${paths[i]}
done
}

export POCKET_CORE_REPOS_PATH=$POCKET_CORE_REPOS_PATH
export POCKET_E2E_STACK_RELATIVE_PATH=$(basename -a $POCKET_E2E_STACK_PATH)

Expand All @@ -30,8 +18,12 @@ docker-compose \
--force-recreate

echo "Creating data folders for the generated nodes..."
nodes=$(ls $CWD/stacks/pokt-playground | grep node | awk '{print $1}')
paths=($(echo $nodes | tr " " "\n"))
create_data_folders_for_nodes $paths

NODES=$CWD/stacks/pokt-playground/node*
for NODE in $NODES
do
echo "Creating $NODE/data"
sudo mkdir $NODE/data
done

echo 'Done';
6 changes: 3 additions & 3 deletions stacks/pokt-net/shared/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"session_node_count": "4",
"proof_waiting_period": "3",
"supported_blockchains": ["0021", "0009"],
"claim_expiration": "100",
"claim_expiration": "24",
"replay_attack_burn_multiplier": "3",
"minimum_number_of_proofs": "1"
"minimum_number_of_proofs": "10"
},
"receipts": null,
"claims": null
Expand Down Expand Up @@ -168,7 +168,7 @@
"max_validators": "5",
"stake_denom": "upokt",
"stake_minimum": "1000000",
"session_block_frequency": "2",
"session_block_frequency": "4",
"dao_allocation": "10",
"proposer_allocation": "1",
"maximum_chains": "15",
Expand Down

0 comments on commit 5c38698

Please sign in to comment.