-
Notifications
You must be signed in to change notification settings - Fork 32
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
Test(wasmd): add basic e2e tests for wasm #187
Conversation
WalkthroughThe recent update introduces a comprehensive suite of tools and guidelines for working with Cosmwasm contracts. It covers everything from setting up a local node and downloading contract files to deploying and interacting with CW20 token contracts on a blockchain network. Additionally, it streamlines the governance process for submitting and managing wasm store proposals. These changes are encapsulated in modifications to the Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
63a4a73
to
4d4ace0
Compare
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: 10
Configuration used: CodeRabbit UI
Files selected for processing (6)
- .gitignore (1 hunks)
- scripts/wasm/README.md (1 hunks)
- scripts/wasm/get_contract.sh (1 hunks)
- scripts/wasm/gov_upload_code.sh (1 hunks)
- scripts/wasm/instantiate_cw20.sh (1 hunks)
- scripts/wasm/upload_code.sh (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- .gitignore
Additional comments: 2
scripts/wasm/upload_code.sh (1)
- 9-13: Variables
DENOM
andTEST0_ADDRESS
are defined but appear unused in the script. If these are intended for future use or external scripts, consider documenting their purpose or exporting them. Otherwise, you might want to remove them to clean up the script.scripts/wasm/gov_upload_code.sh (1)
- 6-7: Variables
VOTER
andVAL
are defined but appear unused in the script. If these are intended for future use or external scripts, consider documenting their purpose or exporting them. Otherwise, you might want to remove them to clean up the script.
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: 9
Configuration used: CodeRabbit UI
Files selected for processing (5)
- scripts/wasm/README.md (1 hunks)
- scripts/wasm/get_contract.sh (1 hunks)
- scripts/wasm/gov_upload_code.sh (1 hunks)
- scripts/wasm/instantiate_cw20.sh (1 hunks)
- scripts/wasm/upload_code.sh (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- scripts/wasm/get_contract.sh
Additional comments: 1
scripts/wasm/README.md (1)
- 1-1: The spelling of "CosmWasm" is correct as per the previous comment. No action needed here.
|
||
CONTRACT=cw20_base | ||
HOME=mytestnet | ||
DENOM="ueve" |
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 variable DENOM
appears unused in this script. If it's intended for external use, consider exporting it. Otherwise, verify if it's needed.
KEY="test0" | ||
|
||
KEYRING="test" | ||
TEST0_ADDRESS=$($BINARY keys show $KEY -a --keyring-backend $KEYRING --home $HOME) |
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 variable TEST0_ADDRESS
appears unused. If it's intended for use outside this script, you might want to export it. Otherwise, please check its necessity.
|
||
CHAIN_ID=local-eve | ||
VAL_KEY=test0 | ||
VOTER= |
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 variable VOTER
appears unused in this script. If it's intended for external use, consider exporting it. Otherwise, verify if it's needed.
CHAIN_ID=local-eve | ||
VAL_KEY=test0 | ||
VOTER= | ||
VAL=$($BINARY keys show -a $VAL_KEY --keyring-backend test) |
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 variable VAL
appears unused. If it's intended for use outside this script, you might want to export it. Otherwise, please check its necessity.
|
||
# check initial balance | ||
echo "Validator Balance:" | ||
$BINARY query wasm contract-state smart $CONTRACT "$QUERY" |
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.
To prevent globbing and word splitting, consider double quoting the variable expansion in this command.
- $BINARY query wasm contract-state smart $CONTRACT "$QUERY"
+ $BINARY query wasm contract-state smart "$CONTRACT" "$QUERY"
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.
$BINARY query wasm contract-state smart $CONTRACT "$QUERY" | |
$BINARY query wasm contract-state smart "$CONTRACT" "$QUERY" |
@tropicaldog can you add |
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: 2
Configuration used: CodeRabbit UI
Files selected for processing (4)
- Makefile (1 hunks)
- scripts/run-node.sh (1 hunks)
- scripts/wasm/instantiate_cw20.sh (1 hunks)
- scripts/wasm/test_wasm.sh (1 hunks)
Additional comments: 3
scripts/wasm/test_wasm.sh (1)
- 44-44: Using
pkill -9
to terminate theeved
process might be too forceful and could lead to data corruption or other issues if the process is in the middle of writing to disk. Consider using a gentler signal first (e.g.,SIGTERM
) and then escalating toSIGKILL
(-9
) if the process does not terminate after a timeout period.scripts/run-node.sh (1)
- 14-14: Changing the process kill command to
pkill -9 eved
forces the termination of theeved
process. While this ensures the process is terminated, it might be too abrupt and could lead to data corruption or other unintended consequences. Consider using a more graceful shutdown approach if possible.Makefile (1)
- 157-159: The addition of the
test-wasm
target to the Makefile is a positive enhancement that streamlines the process of running Wasm tests. This change supports the PR's objectives to improve the testing framework for Wasm contracts. Ensure that thetest_wasm.sh
script is properly maintained and updated to reflect any changes in the testing process.
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
screen -L -dmS node1 bash scripts/run-node.sh | ||
else | ||
screen -L -Logfile $HOME/log-screen.txt -dmS node1 bash scripts/run-node.sh |
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.
To enhance the security and reliability of your script, it's recommended to double-quote variables to prevent globbing and word splitting. This is particularly important when variables could potentially contain spaces or special characters.
- screen -L -Logfile $HOME/log-screen.txt -dmS node1 bash scripts/run-node.sh
+ screen -L -Logfile "$HOME/log-screen.txt" -dmS node1 bash scripts/run-node.sh
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.
screen -L -Logfile $HOME/log-screen.txt -dmS node1 bash scripts/run-node.sh | |
screen -L -Logfile "$HOME/log-screen.txt" -dmS node1 bash scripts/run-node.sh |
fi | ||
|
||
rm -rf mytestnet | ||
pkill eved | ||
pkill -9 eved | ||
|
||
# check DENOM is set. If not, set to ueve | ||
DENOM=${2:-ueve} |
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.
📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [65-68]
To prevent globbing and word splitting, it's recommended to double-quote variables when they are expanded. This ensures that the variables are treated as a single argument even if they contain spaces or special characters.
- $BINARY start --home $HOME_DIR --log_level debug
+ $BINARY start --home "$HOME_DIR" --log_level debug
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.
LGTM
Summary by CodeRabbit
.eved
files and WebAssembly (.wasm
) scripts in.gitignore
to improve project confidentiality.