-
Notifications
You must be signed in to change notification settings - Fork 359
Conversation
WalkthroughThe changes primarily focus on enhancing the flexibility and robustness of the Polard blockchain network setup scripts. The home directory path ( Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 6
Files ignored due to filter (1)
- e2e/testapp/docker/docker-compose.yml
Files selected for processing (20)
- e2e/testapp/docker/network-init-2.sh (2 hunks)
- e2e/testapp/docker/network-init-4.sh (1 hunks)
- e2e/testapp/docker/nginx.conf (1 hunks)
- e2e/testapp/docker/seed/init.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/get-seed-address.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/liveness-probe.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/readiness-probe.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/reset.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/seed-start.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/seed0-init-step1.sh (2 hunks)
- e2e/testapp/docker/seed/scripts/seed0-init-step2.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/seed1-init-step1.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/seed1-init-step2.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/set-persistent-peers.sh (1 hunks)
- e2e/testapp/docker/seed/scripts/set-seed-address.sh (1 hunks)
- e2e/testapp/docker/validator/scripts/val0-init-step1.sh (1 hunks)
- e2e/testapp/docker/validator/scripts/val0-init-step2.sh (1 hunks)
- e2e/testapp/docker/validator/scripts/val0-init-step3.sh (1 hunks)
- e2e/testapp/docker/validator/scripts/val1-init-step1.sh (1 hunks)
- e2e/testapp/docker/validator/scripts/val1-init-step2.sh (1 hunks)
Files skipped from review due to trivial changes (8)
- e2e/testapp/docker/network-init-4.sh
- e2e/testapp/docker/seed/scripts/liveness-probe.sh
- e2e/testapp/docker/seed/scripts/readiness-probe.sh
- e2e/testapp/docker/seed/scripts/seed1-init-step1.sh
- e2e/testapp/docker/seed/scripts/seed1-init-step2.sh
- e2e/testapp/docker/seed/scripts/set-persistent-peers.sh
- e2e/testapp/docker/seed/scripts/set-seed-address.sh
- e2e/testapp/docker/validator/scripts/val1-init-step1.sh
Additional comments (Suppressed): 18
e2e/testapp/docker/seed/scripts/reset.sh (1)
- 21-23: The script now checks if the
HOMEDIR
environment variable is set and assigns a default value if it's not. This adds flexibility in specifying the home directory path.e2e/testapp/docker/nginx.conf (1)
- 1-19: The new hunk introduces an upstream block with four server addresses, effectively setting up a basic reverse proxy configuration. This is part of the expansion from 2 nodes to 4 nodes in the testnet. Ensure that the ports
8545
are correctly open and accessible on all four servers (polard-node0
,polard-node1
,polard-node2
,polard-node3
). Also, verify that the load balancing strategy suits your needs; by default, Nginx uses a round-robin algorithm.e2e/testapp/docker/seed/scripts/seed-start.sh (3)
21-23: The home directory path has been changed from "/root/.polard" to "/.polard". Ensure that this new path is accessible and has the correct permissions set for the operations performed by the
polard
command.24-26: The default log level remains "info". This change allows the log level to be set via an environment variable, which can provide more flexibility in debugging and monitoring.
28-28: The
--api.enable
flag has been added to thepolard start
command. Verify that this flag is supported in your version ofpolard
and that enabling the API does not introduce any security concerns.e2e/testapp/docker/seed/scripts/get-seed-address.sh (1)
- 21-23: The change from a hardcoded
HOMEDIR
to a default value is a good practice. It allows for flexibility in setting the home directory path.- HOMEDIR="/root/.polard" + if [ -z "$HOMEDIR" ]; then + HOMEDIR="/.polard" + fiPlease ensure that all scripts and services that depend on this script are updated to either provide the
HOMEDIR
environment variable or can work with the new default value.e2e/testapp/docker/validator/scripts/val0-init-step2.sh (1)
- 23-23: The home directory path has been changed from
"/root/.polard"
to"/.polard"
. Ensure that this new path is accessible and has the appropriate permissions for the operations performed by thepolard
command.- HOMEDIR="/root/.polard" + HOMEDIR="/.polard"e2e/testapp/docker/seed/scripts/seed0-init-step2.sh (1)
- 21-29: Good use of checking if environment variables are set and assigning default values if they are not. This adds flexibility in specifying parameters like the home directory path, keyring, and key algorithm.
e2e/testapp/docker/validator/scripts/val1-init-step2.sh (1)
- 21-23: The
HOMEDIR
variable has been changed from"/root/.polard"
to"/.polard"
. Ensure that this new path is accessible and has the appropriate permissions for the operations performed by thepolard
command.e2e/testapp/docker/validator/scripts/val0-init-step3.sh (1)
- 23-23: The home directory path has been changed from
"/root/.polard"
to"/.polard"
. Ensure that this new path is accessible and has the appropriate permissions set for the operations performed by the script.e2e/testapp/docker/validator/scripts/val0-init-step1.sh (2)
23-26: The home directory for
polard
has been changed from/root/.polard
to/.polard
. Ensure that this new path is accessible and has the appropriate permissions set. Also, verify that all scripts and services that rely on this path have been updated accordingly.28-28: The
polard init
command now uses the updatedHOMEDIR
. Make sure that thepolard
tool can access and write to this directory.e2e/testapp/docker/seed/scripts/seed0-init-step1.sh (4)
21-35: The script now checks if certain environment variables are set and assigns default values if they are not. This is a good practice as it provides flexibility in specifying parameters like the home directory path, log level, keyring, and key algorithm.
37-38: The value of
KEY1
andMONIKER1
has been changed from "seed0" to "seed-0". Ensure that this change does not affect other parts of the system that might be using these values.46-56: Several new parameters have been added to the genesis.json file. Make sure these changes align with your blockchain's governance model and requirements.
59-71: The commands for setting the client configuration, adding keys, adding a genesis account, and generating a genesis transaction have been updated with additional flags and parameters. Verify that these changes are correct and necessary.
e2e/testapp/docker/network-init-2.sh (2)
20-44: The script has been updated to include two additional containers (
CONTAINER2
andCONTAINER3
). The home directory path (HOMEDIR
) has been changed from"/root/.polard"
to"/.polard"
. This change should be verified across all scripts and configurations to ensure consistency and avoid potential issues. The initialization step 1 now includes the new containers.47-93: The script now copies the
genesis.json
file from each container to the next one in a chain-like manner, including the new containers. It also copies thegentx
files from all containers toCONTAINER0
. The final genesis.json is copied fromCONTAINER0
to all other containers. The start commands for the new containers are commented out, similar to the old hunk. If these lines are meant to be executed, they should be uncommented.
fi | ||
|
||
rm -rf $HOMEDIR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the HOMEDIR
variable is always correctly set before this script is run, as it could lead to unintentional deletion of directories if misconfigured.
- rm -rf $HOMEDIR
+ [ -n "$HOMEDIR" ] && rm -rf $HOMEDIR
e2e/testapp/docker/seed/init.sh
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script assumes that if the $HOMEDIR
directory is not empty, it contains a valid network configuration. This might not always be the case. Consider adding a more robust check for a valid network configuration.
e2e/testapp/docker/seed/init.sh
Outdated
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script modifies the genesis file in-place, which could lead to data loss if the script fails or is interrupted. Consider creating a backup of the original genesis file before modifying it.
e2e/testapp/docker/seed/init.sh
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate command execution. The same polard start
command is executed twice with slightly different parameters. If this is intentional, please clarify why. Otherwise, remove the duplicate line.
- 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
+ polard start --pruning=nothing "$TRACE" --log_level $LOGLEVEL --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR"
KEYALGO="eth_secp256k1" | ||
fi | ||
|
||
HOMEDIR="/.polard" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HOMEDIR
variable is being reassigned here after potentially being set in lines 21-23. If this line is necessary, consider removing the conditional assignment above. If it's not, simply remove this line to avoid overwriting the HOMEDIR
value.
- HOMEDIR="/.polard"
# # faucet | ||
# polard keys add faucet --keyring-backend $KEYRING --algo $KEYALGO --home "$HOMEDIR" | ||
# polard genesis add-genesis-account faucet 1000000000000000000000000000abera,1000000000000000000000000000stgusdc --keyring-backend $KEYRING --home "$HOMEDIR" | ||
|
||
# # # Test Account | ||
# # absurd surge gather author blanket acquire proof struggle runway attract cereal quiz tattoo shed almost sudden survey boring film memory picnic favorite verb tank | ||
# # 0xfffdbb37105441e14b0ee6330d855d8504ff39e705c3afa8f859ac9865f99306 | ||
# polard genesis add-genesis-account cosmos1yrene6g2zwjttemf0c65fscg8w8c55w58yh8rl 1000000000000000000000000000abera,1000000000000000000000000000stgusdc --keyring-backend $KEYRING --home "$HOMEDIR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are commented out. If they're not needed, consider removing them to keep the codebase clean. If they're meant for future use or debugging, consider adding a comment explaining their purpose.
Summary by CodeRabbit
HOMEDIR
variable across multiple scripts to improve consistency and flexibility in specifying the home directory path.nginx.conf
, enhancing load balancing capabilities.HOMEDIR
environment variable instead of a hardcoded directory path, increasing flexibility.polard genesis gentx
command with additional parameters, providing more detailed genesis transaction information.