Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Oct 6, 2023
2 parents 5d03e96 + 5dcdec1 commit 1babef2
Show file tree
Hide file tree
Showing 23 changed files with 334 additions and 262 deletions.
25 changes: 20 additions & 5 deletions e2e/testapp/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.

version: '3.3'
version: "3.3"

services:
node0:
Expand All @@ -27,9 +27,10 @@ services:
ports:
- "26656-26658:26656-26658"
- "9090-9091:9090-9091"
- "8545-8546:8545-8546"
- "1545-1546:8545-8546"
environment:
- ID=0
- CHAINID=berachain-localnet-666
volumes:
- type: bind
source: ./temp/seed0
Expand All @@ -44,9 +45,10 @@ services:
ports:
- "26659-26661:26656-26658"
- "9092-9093:9090-9091"
- "8547-8548:8545-8546"
- "2547-2548:8545-8546"
environment:
- ID=1
- CHAINID=berachain-localnet-666
volumes:
- type: bind
source: ./temp/seed1
Expand All @@ -61,9 +63,10 @@ services:
ports:
- "26662-26664:26656-26658"
- "9094-9095:9090-9091"
- "8549-8550:8545-8546"
- "3549-3550:8545-8546"
environment:
- ID=2
- CHAINID=berachain-localnet-666
volumes:
- type: bind
source: ./temp/seed2
Expand All @@ -78,9 +81,10 @@ services:
ports:
- "26665-26667:26656-26658"
- "9096-9097:9090-9091"
- "8551-8552:8545-8546"
- "4551-4552:8545-8546"
environment:
- ID=3
- CHAINID=berachain-localnet-666
volumes:
- type: bind
source: ./temp/seed3
Expand All @@ -89,6 +93,17 @@ services:
localnet:
ipv4_address: 192.168.10.13

nginx:
container_name: nginx
image: nginx:latest
ports:
- "8545:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
localnet:
ipv4_address: 192.168.10.14

networks:
localnet:
driver: bridge
Expand Down
60 changes: 0 additions & 60 deletions e2e/testapp/docker/network-init-2.sh

This file was deleted.

2 changes: 1 addition & 1 deletion e2e/testapp/docker/network-init-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CONTAINER1="polard-node1"
CONTAINER2="polard-node2"
CONTAINER3="polard-node3"

HOMEDIR="/root/.polard"
HOMEDIR="/.polard"
SCRIPTS="/scripts"

rm -rf ./temp
Expand Down
19 changes: 19 additions & 0 deletions e2e/testapp/docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
events {}

http {
upstream nodes {
server polard-node0:8545;
server polard-node1:8545;
server polard-node2:8545;
server polard-node3:8545;
}

server {
listen 80;
location / {
proxy_pass http://nodes;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
Empty file modified e2e/testapp/docker/reset-temp.sh
100644 → 100755
Empty file.
65 changes: 65 additions & 0 deletions e2e/testapp/docker/seed/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# SPDX-License-Identifier: BUSL-1.1
#
# Copyright (C) 2023, Berachain Foundation. All rights reserved.
# Use of this software is govered by the Business Source License included
# in the LICENSE file of this repository and at www.mariadb.com/bsl11.
#
# ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
# TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
# VERSIONS OF THE LICENSED WORK.
#
# THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
# LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
# LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
#
# TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
# AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
# EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.

KEY="brick"
CHAINID="berachain-666"
MONIKER="brickchain"
KEYRING="test"
KEYALGO="eth_secp256k1"
LOGLEVEL="info"
HOMEDIR="data/.polard"
TRACE=""
GENESIS=$HOMEDIR/config/genesis.json
TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json

if [ "$(ls -A $HOMEDIR)" ]; then
echo "$HOMEDIR is not empty"
polard start --pruning=nothing "$TRACE" --log_level $LOGLEVEL --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR"
else
echo "$HOMEDIR is empty, creating a new network"

polard init $MONIKER -o --chain-id $CHAINID --home "$HOMEDIR"

jq '.app_state["staking"]["params"]["bond_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS"
jq '.app_state["crisis"]["constant_fee"]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS"
jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS"
jq '.app_state["evm"]["params"]["evm_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS"
jq '.app_state["mint"]["params"]["mint_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS"
jq '.consensus["params"]["block"]["max_gas"]="30000000"' "$GENESIS" >"$TMP_GENESIS"
mv "$TMP_GENESIS" "$GENESIS"

polard config set client keyring-backend $KEYRING --home "$HOMEDIR"
polard config set client chain-id "$CHAINID" --home "$HOMEDIR"

polard keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --home "$HOMEDIR"

polard genesis add-genesis-account $KEY 100000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR"

# polard genesis add-genesis-account cosmos1yrene6g2zwjttemf0c65fscg8w8c55w58yh8rl 100000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR"

polard genesis gentx $KEY 1000000000000000000000abera --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR"

polard genesis collect-gentxs --home "$HOMEDIR"

polard genesis validate-genesis --home "$HOMEDIR"

polard start --pruning=nothing "$TRACE" --log_level $LOGLEVEL --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR"
polard start --pruning=nothing '' --log_level info --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home data/.polard
fi
4 changes: 3 additions & 1 deletion e2e/testapp/docker/seed/scripts/get-seed-address.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.

HOMEDIR="/root/.polard"
if [ -z "$HOMEDIR" ]; then
HOMEDIR="/.polard"
fi

ip=$1
node_id=$(polard comet show-node-id --home "$HOMEDIR")
Expand Down
54 changes: 54 additions & 0 deletions e2e/testapp/docker/seed/scripts/liveness-probe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# SPDX-License-Identifier: BUSL-1.1
#
# Copyright (C) 2023, Berachain Foundation. All rights reserved.
# Use of this software is govered by the Business Source License included
# in the LICENSE file of this repository and at www.mariadb.com/bsl11.
#
# ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
# TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
# VERSIONS OF THE LICENSED WORK.
#
# THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
# LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
# LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
#
# TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
# AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
# EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.


# Execute the cURL command and capture the response
response=$(curl -s -X POST -H "Content-Type: application/json" -d '{
"jsonrpc":"2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}' http://localhost:8545)

height=$(echo "$response" | jq -r '.result')

file="last_height.txt"

# Check if the file exists
if [ -e "$file" ]; then
# Read the contents of the file into the result variable
last_height=$(cat "$file")
else
# File does not exist, set result to an empty string
last_height=""
fi

rm $file
echo "$height" >> $file

# Check if the two input strings are equal
if [ "$height" == "$last_height" ]; then
# Strings are equal, return 1
exit 1
else
# Strings are not equal, return 0
exit 0
fi
38 changes: 38 additions & 0 deletions e2e/testapp/docker/seed/scripts/readiness-probe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# SPDX-License-Identifier: BUSL-1.1
#
# Copyright (C) 2023, Berachain Foundation. All rights reserved.
# Use of this software is govered by the Business Source License included
# in the LICENSE file of this repository and at www.mariadb.com/bsl11.
#
# ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
# TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
# VERSIONS OF THE LICENSED WORK.
#
# THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
# LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
# LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
#
# TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
# AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
# EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.


# Execute the cURL command and capture the response
response=$(curl -s -X POST -H "Content-Type: application/json" -d '{
"jsonrpc":"2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}' http://localhost:8545)

# Check if the response contains the "result" field
if echo "$response" | grep -q '"result":.*false'; then
echo "Syncing is not in progress"
exit 0 # Exit with success code
else
echo "Syncing is in progress or port is not up"
exit 1 # Exit with failed code
fi
6 changes: 5 additions & 1 deletion e2e/testapp/docker/seed/scripts/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.

rm -rf /root/.polard
if [ -z "$HOMEDIR" ]; then
HOMEDIR="/.polard"
fi

rm -rf $HOMEDIR
10 changes: 7 additions & 3 deletions e2e/testapp/docker/seed/scripts/seed-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
# TITLE.

HOMEDIR="/root/.polard"
LOGLEVEL="info"
if [ -z "$HOMEDIR" ]; then
HOMEDIR="/.polard"
fi
if [ -z "$LOGLEVEL" ]; then
LOGLEVEL="info"
fi

polard start --log_level $LOGLEVEL --minimum-gas-prices=0.0001abera --home "$HOMEDIR"
polard start --log_level $LOGLEVEL --minimum-gas-prices=0.0001abera --api.enable --home "$HOMEDIR"
Loading

0 comments on commit 1babef2

Please sign in to comment.