Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unwire spot module for main branch #1831

Merged
merged 10 commits into from
Apr 21, 2024
Merged

fix: unwire spot module for main branch #1831

merged 10 commits into from
Apr 21, 2024

Conversation

matthiasmatt
Copy link
Contributor

@matthiasmatt matthiasmatt commented Mar 29, 2024

#1830 should be merged first

Summary by CodeRabbit

  • Documentation

    • Reordered sections and added troubleshooting and contributing sections to INSTALL.md.
    • Updated README.md with refined component descriptions and documentation links.
  • New Features

    • Updated configurations for running Nibiru Chain nodes in Docker containers with enhanced settings.
  • Refactor

    • Removed references to unused modules (spot and perp) from the application, including keepers and types.
    • Adjusted keeper initialization process.
    • Removed unused import statements and functions across multiple files.
  • Chores

    • Optimized script execution flow and configurations in localnet.sh.
    • Updated Dockerfile and scripts for Nibiru Chain nodes deployment.

@matthiasmatt matthiasmatt requested a review from a team as a code owner March 29, 2024 12:34
Copy link
Contributor

coderabbitai bot commented Mar 29, 2024

Walkthrough

The recent updates reflect a significant shift in the Nibiru project, focusing on streamlining its components by removing the spot and perp modules and their associated elements. This includes adjustments in documentation, Docker configurations, script optimizations, and core application logic. Additionally, there's an emphasis on enhancing the project's maintainability and ease of use, with updates to installation instructions, contributing guidelines, and overall system efficiency.

Changes

Files Change Summary
INSTALL.md Reordered sections, added new sections, minor text updates, updated commands and paths.
README.md Updated documentation links, fixed formatting, refined component descriptions.
app/keepers.go, x/.../testapp/testapp.go Removed spot and perp modules references, adjusted keeper initializations.
cmd/nibid/cmd/root.go, x/oracle/.../gen_..._test.go, x/common/testutil/... Removed specific module imports and functions, updated test configurations.
contrib/.../chaosnet.Dockerfile, contrib/scripts/... Updated Docker and script configurations for Nibiru Chain nodes.
justfile, simapp/sim_test.go Command and test adjustments for starting local network and removing module dependencies.
x/oracle/keeper/hooks.go Altered logic in AfterEpochEnd for reward handling and allocation strategies.

🐇✨
Changes abound, the code does shift,
Out with the old, the new to lift.
Modules spot and perp take flight,
Streamlining paths, making coding light.
Through Docker's sea and script's weave,
A more nimble Nibiru we achieve.
🚀🌌


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 18fcef1 and 7dc56be.
Files ignored due to path filters (15)
  • x/perp/v2/types/event.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/perp/v2/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/perp/v2/types/query.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/perp/v2/types/query.pb.gw.go is excluded by !**/*.pb.gw.go, !**/*.pb.gw.go
  • x/perp/v2/types/state.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/perp/v2/types/tx.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/event.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/misc/stabletests.csv is excluded by !**/*.csv, !**/*.csv
  • x/spot/types/params.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/pool.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/query.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/query.pb.gw.go is excluded by !**/*.pb.gw.go, !**/*.pb.gw.go
  • x/spot/types/tx.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/spot/types/tx.pb.gw.go is excluded by !**/*.pb.gw.go, !**/*.pb.gw.go
Files selected for processing (14)
  • INSTALL.md (7 hunks)
  • README.md (5 hunks)
  • app/keepers.go (12 hunks)
  • cmd/nibid/cmd/root.go (2 hunks)
  • contrib/docker/chaosnet.Dockerfile (1 hunks)
  • contrib/scripts/chaosnet.sh (3 hunks)
  • contrib/scripts/localnet.sh (6 hunks)
  • justfile (1 hunks)
  • simapp/sim_test.go (2 hunks)
  • x/common/testutil/cli/network.go (2 hunks)
  • x/common/testutil/cli/query.go (3 hunks)
  • x/common/testutil/testapp/testapp.go (2 hunks)
  • x/oracle/client/cli/gen_pricefeeder_delegation_test.go (1 hunks)
  • x/oracle/keeper/hooks.go (2 hunks)
Files skipped from review due to trivial changes (2)
  • simapp/sim_test.go
  • x/oracle/client/cli/gen_pricefeeder_delegation_test.go
Additional Context Used
Additional comments not posted (10)
contrib/docker/chaosnet.Dockerfile (1)

23-28: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-31]

The Dockerfile changes seem aligned with the PR's objective to remove the spot and perp modules, as indicated by the removal of the feat-perp.sh script copying. Ensure that any dependencies or references to this script in other parts of the project or in documentation are also updated or removed to maintain consistency.

x/oracle/keeper/hooks.go (1)

7-12: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-39]

The significant alteration within the AfterEpochEnd function, removing logic related to reward handling and allocation, aligns with the PR's objective to simplify or refocus the project by removing the spot and perp modules. Ensure that this change does not inadvertently affect other functionalities that might rely on the previous behavior of this function. It's also important to verify that the removal of this logic is part of a broader strategy or refactoring plan that includes handling these operations differently or deems them unnecessary.

justfile (1)

42-42: Splitting the command example into two lines in the comment improves readability and clarity, making it easier for users to understand how to run a Nibiru local network. This change is a good practice for documentation within code files, ensuring instructions are clear and accessible.

INSTALL.md (1)

46-78: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-127]

The updates and reorganization in INSTALL.md, including the addition of troubleshooting and contributing sections, enhance the clarity and usefulness of the installation guide. These changes make it easier for users to follow the installation process and contribute to the project. However, consider updating "MacOS" to "macOS" to align with the official naming convention by Apple.

- Error when running `make install` on MacOS
+ Error when running `make install` on macOS
x/common/testutil/cli/query.go (1)

16-21: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-93]

The removal of functions related to querying markets and positions in the perp/v2 module from query.go is consistent with the PR's objective to remove the spot and perp modules. Ensure that any references to these removed functions in documentation, tests, or other parts of the codebase are also updated or removed to maintain consistency and avoid broken references.

x/common/testutil/testapp/testapp.go (1)

19-24: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-103]

The removal of the import statement related to perp/v2/types and the function call to PerpKeeperV2.Collateral.Set in testapp.go aligns with the PR's objective to remove the spot and perp modules. This change likely affects test setups and should be accompanied by updates to any tests or documentation that relied on the removed functionality. Ensure that the removal of these elements does not leave any orphaned references or broken tests in the codebase.

cmd/nibid/cmd/root.go (1)

29-34: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-263]

Given the PR's objective to remove the perpv2cli package import and associated function call, ensure that:

  • All references to perpv2cli are completely removed from the file.
  • No orphaned variables or functions that depended on perpv2cli remain.
  • Any tests or documentation that referenced perpv2cli are updated accordingly.

Additionally, verify that the removal does not affect the functionality of related modules or commands, potentially requiring adjustments elsewhere in the codebase.

README.md (2)

25-25: Ensure the link to the Nibiru Chain documentation is correct and accessible. It's crucial for users to have accurate and working links for documentation.


47-47: The description of CosmWasm Smart Contracts mentions enhanced security, performance, and interoperability. Ensure that the link to the CosmWasm sandbox monorepo is correct and that the repository contains relevant and up-to-date information about the protocol's core smart contracts.

x/common/testutil/cli/network.go (1)

42-47: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-263]

Given the PR's objective to remove the perpV2types import and its usage, ensure that:

  • All references to perpV2types are completely removed from the file.
  • No orphaned variables or functions that depended on perpV2types remain.
  • Any tests or documentation that referenced perpV2types are updated accordingly.

Additionally, verify that the removal does not affect the functionality of related modules or configurations, potentially requiring adjustments elsewhere in the codebase.

README.md Outdated
@@ -22,17 +22,17 @@

## ⚙️ — Documentation

- [Docs | Nibiru Chain](https://nibiru.fi/docs/): Conceptual and technical documentation can be found here.
- [Docs | Nibiru Chain](https://nibiru.fi/docs/): Conceptual and technical documentation can be found here.
- [Complete Golang reference docs](https://pkg.go.dev/github.com/NibiruChain/nibiru): (`pkg.go.dev`) For the blockchain implementation .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase "For the blockchain implementation." should not have a space before the period. Consider revising to maintain grammatical correctness.

- For the blockchain implementation .
+ For the blockchain implementation.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- [Complete Golang reference docs](https://pkg.go.dev/github.com/NibiruChain/nibiru): (`pkg.go.dev`) For the blockchain implementation .
- [Complete Golang reference docs](https://pkg.go.dev/github.com/NibiruChain/nibiru): (`pkg.go.dev`) For the blockchain implementation.

README.md Outdated
Comment on lines 22 to 38

## ⚙️ — Documentation

- [Docs | Nibiru Chain](https://nibiru.fi/docs/): Conceptual and technical documentation can be found here.
- [Docs | Nibiru Chain](https://nibiru.fi/docs/): Conceptual and technical documentation can be found here.
- [Complete Golang reference docs](https://pkg.go.dev/github.com/NibiruChain/nibiru): (`pkg.go.dev`) For the blockchain implementation .
- ["X Module"](https://nibiru.fi/docs/dev/x/)-specific documentation

## 💬 — Community

If you have questions or concerns, feel free to connect with a developer or community member in the [Nibiru Discord][social-discord]. We also have active communities on [Twitter][social-twitter] and [Telegram][social-telegram].

<!-- Markdown versions of the social badges
[![description][discord-badge]][social-discord]
[![description][twitter-badge]][social-twitter]
<!-- Markdown versions of the social badges
[![description][discord-badge]][social-discord]
[![description][twitter-badge]][social-twitter]
[![description][telegram-badge]][social-telegram]
-->

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [79-79]

The operating system from Apple should be written as “macOS” instead of “MacOS” to align with the official branding and naming conventions.

- Unix system: MacOS or Ubuntu 18+
+ Unix system: macOS or Ubuntu 18+

README.md Outdated
```
and open another terminal.
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence does not start with an uppercase letter. Ensure that the documentation follows consistent grammatical rules for readability and professionalism.

- and open another terminal.
+ And open another terminal.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change

Comment on lines 1 to 7
#!/usr/bin/env bash
#
# This script is used in tandem with `contrib/docker/chaosnet.Dockerfile` to
# run nodes for Nibiru Chain networks inside docker containers.
# run nodes for Nibiru Chain networks inside docker containers.
# - See CHAOSNET.md for usage instructions.
set -e

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [16-16]

Consider quoting variables to prevent globbing and word splitting, which enhances the script's robustness and security. For example:

- rm -rf "$HOME/.nibid"
+ rm -rf "${HOME}/.nibid"

curr_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "$curr_dir/feat-perp.sh"
add_genesis_perp_markets_offline
curr_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable curr_dir appears unused in the script. If it's not needed, consider removing it to clean up the script and avoid confusion.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Actionable comments outside the diff hunks (1)
contrib/scripts/localnet.sh (1)

Line range hint 235-237: Ensure that the jq command arguments are properly quoted to prevent globbing and word splitting. This is crucial for maintaining the integrity of the command's input and output.

- cat $CHAIN_DIR/config/genesis.json | jq "$1" >$CHAIN_DIR/config/tmp_genesis.json
+ cat "$CHAIN_DIR/config/genesis.json" | jq "$1" > "$CHAIN_DIR/config/tmp_genesis.json"
- mv $CHAIN_DIR/config/tmp_genesis.json $CHAIN_DIR/config/genesis.json
+ mv "$CHAIN_DIR/config/tmp_genesis.json" "$CHAIN_DIR/config/genesis.json"

echo_info "config/app.toml: Enabling API server"
sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml
echo_info "Enabling API server"
if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that variables and paths in shell commands are properly quoted to prevent globbing and word splitting. This is particularly important for the sed command modifications in the script.

- if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
+ if sed -i "$SEDOPTION" '/\[api\]/,+3 s/enable = false/enable = true/' "$CHAIN_DIR/config/app.toml"; then

- if sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml; then
+ if sed -i "$SEDOPTION" 's/swagger = false/swagger = true/' "$CHAIN_DIR/config/app.toml"; then

- if sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml; then
+ if sed -i "$SEDOPTION" 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' "$CHAIN_DIR/config/app.toml"; then

Also applies to: 182-182, 190-190


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
if sed -i "$SEDOPTION" '/\[api\]/,+3 s/enable = false/enable = true/' "$CHAIN_DIR/config/app.toml"; then

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Comment on lines 174 to 194
if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled API server"
else
echo_error "Failed to enable API server"
fi

# Enable Swagger Docs
echo_info "config/app.toml: Enabling Swagger Docs"
sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml
echo_info "Enabling Swagger Docs"
if sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled Swagger Docs"
else
echo_error "Failed to enable Swagger Docs"
fi

# Enable CORS for localnet
echo_info "config/app.toml: Enabling CORS"
sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml
echo_info "Enabling CORS"
if sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled CORS"
else
echo_error "Failed to enable CORS"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure variables in sed commands are properly quoted to prevent globbing and word splitting.

- if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
+ if sed -i "$SEDOPTION" '/\[api\]/,+3 s/enable = false/enable = true/' "$CHAIN_DIR/config/app.toml"; then

- if sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml; then
+ if sed -i "$SEDOPTION" 's/swagger = false/swagger = true/' "$CHAIN_DIR/config/app.toml"; then

- if sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml; then
+ if sed -i "$SEDOPTION" 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' "$CHAIN_DIR/config/app.toml"; then

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled API server"
else
echo_error "Failed to enable API server"
fi
# Enable Swagger Docs
echo_info "config/app.toml: Enabling Swagger Docs"
sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml
echo_info "Enabling Swagger Docs"
if sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled Swagger Docs"
else
echo_error "Failed to enable Swagger Docs"
fi
# Enable CORS for localnet
echo_info "config/app.toml: Enabling CORS"
sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml
echo_info "Enabling CORS"
if sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled CORS"
else
echo_error "Failed to enable CORS"
fi
if sed -i "$SEDOPTION" '/\[api\]/,+3 s/enable = false/enable = true/' "$CHAIN_DIR/config/app.toml"; then
echo_success "Successfully enabled API server"
else
echo_error "Failed to enable API server"
fi
# Enable Swagger Docs
echo_info "Enabling Swagger Docs"
if sed -i "$SEDOPTION" 's/swagger = false/swagger = true/' "$CHAIN_DIR/config/app.toml"; then
echo_success "Successfully enabled Swagger Docs"
else
echo_error "Failed to enable Swagger Docs"
fi
# Enable CORS for localnet
echo_info "Enabling CORS"
if sed -i "$SEDOPTION" 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' "$CHAIN_DIR/config/app.toml"; then
echo_success "Successfully enabled CORS"
else
echo_error "Failed to enable CORS"
fi


echo_info "Adding genesis accounts..."

val_key_name="validator"

echo "$MNEMONIC" | $BINARY keys add $val_key_name --recover
$BINARY add-genesis-account $($BINARY keys show $val_key_name -a) $GENESIS_COINS
echo_success "Successfully added genesis account: $val_key_name"
if $BINARY add-genesis-account $($BINARY keys show $val_key_name -a) $GENESIS_COINS; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote the subshell command to prevent word splitting when adding a genesis account.

- if $BINARY add-genesis-account $($BINARY keys show $val_key_name -a) $GENESIS_COINS; then
+ if $BINARY add-genesis-account "$($BINARY keys show $val_key_name -a)" $GENESIS_COINS; then

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if $BINARY add-genesis-account $($BINARY keys show $val_key_name -a) $GENESIS_COINS; then
if $BINARY add-genesis-account "$($BINARY keys show $val_key_name -a)" $GENESIS_COINS; then

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Actionable comments outside the diff hunks (5)
contrib/scripts/localnet.sh (5)

[!TIP]
Codebase Verification

The search results confirm that FLAG_SPOT is only set in the localnet.sh script and does not appear to be used elsewhere in the repository. This suggests that the variable is indeed unused, which aligns with the concern raised in the review comment. It would be advisable to either implement the necessary logic using FLAG_SPOT or remove the variable if it is not needed.

Analysis chain

Line range hint 75-75: Verify the usage of FLAG_SPOT since it appears unused in the script.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for FLAG_SPOT usage in the repository
rg --type sh 'FLAG_SPOT'

Length of output: 78


Line range hint 109-109: Ensure that the sed command uses double quotes to prevent globbing and word splitting.

- sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml
+ sed -i "$SEDOPTION" '/\[api\]/,+3 s/enable = false/enable = true/' "$CHAIN_DIR/config/app.toml"

Line range hint 150-150: Ensure that the sed command uses double quotes to prevent globbing and word splitting.

- sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml
+ sed -i "$SEDOPTION" 's/swagger = false/swagger = true/' "$CHAIN_DIR/config/app.toml"

Line range hint 158-158: Ensure that the sed command uses double quotes to prevent globbing and word splitting.

- sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml
+ sed -i "$SEDOPTION" 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' "$CHAIN_DIR/config/app.toml"

Line range hint 165-165: Quote the subshell command to prevent word splitting when adding a genesis account.

- $BINARY add-genesis-account $($BINARY keys show $val_key_name -a) $GENESIS_COINS
+ $BINARY add-genesis-account "$($BINARY keys show $val_key_name -a)" $GENESIS_COINS

@@ -24,7 +24,7 @@ console_log_text_color() {
}

if [ console_log_text_color ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the conditional check to correctly execute the console_log_text_color function.

- if [ console_log_text_color ]; then
+ if console_log_text_color; then

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if [ console_log_text_color ]; then
if console_log_text_color; then

@Unique-Divine Unique-Divine enabled auto-merge (squash) April 21, 2024 23:37
@Unique-Divine Unique-Divine merged commit 3036618 into main Apr 21, 2024
12 of 13 checks passed
@Unique-Divine Unique-Divine deleted the mat/rip-spot branch April 21, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants