Skip to content

ci: add tx test in integration test#87

Merged
julienrbrt merged 3 commits intomainfrom
julien/tx-test
May 8, 2025
Merged

ci: add tx test in integration test#87
julienrbrt merged 3 commits intomainfrom
julien/tx-test

Conversation

@julienrbrt
Copy link
Copy Markdown
Member

@julienrbrt julienrbrt commented May 8, 2025

ref: #42

Summary by CodeRabbit

  • New Features
    • Added automated testing of transaction submission and balance validation to the integration test workflow, ensuring end-to-end transaction functionality is verified during continuous integration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2025

"""

Walkthrough

A new step was added to the GitHub Actions integration test workflow to perform an automated test of transaction submission and balance verification on the local blockchain. This step retrieves account balances, executes a transaction, and checks the results, enhancing the workflow's end-to-end coverage.

Changes

File(s) Change Summary
.github/workflows/integration_test.yml Added a step for automated transaction submission and balance validation in the integration workflow

Sequence Diagram(s)

sequenceDiagram
    participant CI as GitHub Actions Workflow
    participant Chain as Local Blockchain Node

    CI->>Chain: Retrieve Bob and Alice addresses
    CI->>Chain: Query Bob's initial balance
    alt Bob's balance >= 100 stake
        CI->>Chain: Submit transaction (Bob -> Alice, 100 stake)
        Note right of CI: Capture transaction hash
        CI->>Chain: Query Bob's balance after transaction
        CI->>CI: Validate balance decreased by 100 stake
        CI->>CI: Print success or exit on failure
    else Bob's balance < 100 stake
        CI->>CI: Exit with error
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Simple TXs (send, multi-send) (#42)
Staking (#42) No staking-related tests or steps were added in this change.
Queries IP:Ports of the node (grpc/rpc/rest/etc.) (#42) No explicit testing of node query endpoints or their ports is included in this change.
Tests executed on every PR, short-lived, using local-devnet (#42)

Possibly related PRs

  • ci: add liveness test #81: Introduced the initial integration test workflow, which the current PR extends by adding transaction and balance verification steps.

Suggested reviewers

  • randygrok

Poem

🐇
In the garden of code, a new test did sprout,
Bob sent some stake, and Alice did shout!
Balances checked, with numbers precise,
CI hops along, verifying twice.
With every transaction, the workflow grows bright—
Another leap forward in blockchain delight!

"""

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2680e97 and 1d0da96.

📒 Files selected for processing (1)
  • .github/workflows/integration_test.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/integration_test.yml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test / Run Unit Tests
  • GitHub Check: Test with Rollkit Chain

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

echo "Sending 100stake from Bob to Alice..."
TX_HASH=$(gmd tx bank send bob $(gmd keys show alice -a) 100stake -y --output json | jq -r .txhash)

# query the transaction (TODO: uncomment after tx indexer is fixed)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this should be uncommented after #68

@julienrbrt julienrbrt marked this pull request as ready for review May 8, 2025 11:31
@julienrbrt julienrbrt requested a review from randygrok May 8, 2025 11:31
Copy link
Copy Markdown
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: 2

♻️ Duplicate comments (1)
.github/workflows/integration_test.yml (1)

149-156: Preserve commented tx-query for future re-enablement
The TODO to uncomment the transaction query after the indexer fix matches the existing guidance in PR #68.

🧹 Nitpick comments (2)
.github/workflows/integration_test.yml (2)

124-125: Clarify step name consistency
The step is named "Test Transaction Submission and Query" but the on-chain transaction query is currently commented out. Consider renaming it to reflect the active functionality (e.g., "Test Transaction Submission and Balance Update") until the query portion is re-enabled.


128-133: Optimize address retrieval and reuse
You fetch both Bob’s and Alice’s addresses here but later invoke gmd keys show alice again when sending the tx. To avoid redundant calls and improve readability, use the $ALICE_ADDRESS variable in subsequent commands.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc7a627 and 2680e97.

📒 Files selected for processing (1)
  • .github/workflows/integration_test.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test / Run Unit Tests
  • GitHub Check: Test with Rollkit Chain
🔇 Additional comments (5)
.github/workflows/integration_test.yml (5)

126-127: These lines simply change into the gm directory; no issues detected.


134-138: Balance query implementation looks good
The use of gmd query bank balances piped through jq correctly retrieves the initial stake amount. No issues here.


158-161: Final balance query is correct
Querying Bob's balance post-transaction with jq is consistent with the initial query. No changes necessary.


162-167: Validation logic for expected balance is sound
Subtracting 100 from INITIAL_BALANCE and comparing strings works here. Optionally, you could use if (( FINAL_BALANCE != EXPECTED_BALANCE )); then for an arithmetic test.


169-169: The success echo is clear and needs no modification.

Comment on lines +145 to +148
# send transaction from bob to alice and get tx hash
echo "Sending 100stake from Bob to Alice..."
TX_HASH=$(gmd tx bank send bob $(gmd keys show alice -a) 100stake -y --output json | jq -r .txhash)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Reuse $ALICE_ADDRESS and ensure block commitment
When sending the transaction, replace the inline key lookup with the saved variable, and add --broadcast-mode=block so the CLI waits for inclusion in a block before returning. For example:

- TX_HASH=$(gmd tx bank send bob $(gmd keys show alice -a) 100stake -y --output json | jq -r .txhash)
+ TX_HASH=$(gmd tx bank send bob $ALICE_ADDRESS 100stake -y --broadcast-mode=block --output json | jq -r .txhash)

This guarantees the state is updated before you query the balance.

📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# send transaction from bob to alice and get tx hash
echo "Sending 100stake from Bob to Alice..."
TX_HASH=$(gmd tx bank send bob $(gmd keys show alice -a) 100stake -y --output json | jq -r .txhash)
# send transaction from bob to alice and get tx hash
echo "Sending 100stake from Bob to Alice..."
TX_HASH=$(gmd tx bank send bob $ALICE_ADDRESS 100stake -y --broadcast-mode=block --output json | jq -r .txhash)

Comment on lines +139 to +143
# check that bob has funds
if [ "$INITIAL_BALANCE" == "" ] || [ "$INITIAL_BALANCE" == "null" ] || [ "$INITIAL_BALANCE" -lt 100 ]; then
echo "Error: Bob's account not properly funded"
exit 1
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve shell conditional for empty/null and numeric checks
Mixing == for string equality and -lt for numeric comparison can be error-prone. Use -z to test for emptiness and a single = for string equality, reserving -lt for numeric cases. For example:

- if [ "$INITIAL_BALANCE" == "" ] || [ "$INITIAL_BALANCE" == "null" ] || [ "$INITIAL_BALANCE" -lt 100 ]; then
+ if [ -z "$INITIAL_BALANCE" ] || [ "$INITIAL_BALANCE" = "null" ] || [ "$INITIAL_BALANCE" -lt 100 ]; 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# check that bob has funds
if [ "$INITIAL_BALANCE" == "" ] || [ "$INITIAL_BALANCE" == "null" ] || [ "$INITIAL_BALANCE" -lt 100 ]; then
echo "Error: Bob's account not properly funded"
exit 1
fi
# check that bob has funds
if [ -z "$INITIAL_BALANCE" ] || [ "$INITIAL_BALANCE" = "null" ] || [ "$INITIAL_BALANCE" -lt 100 ]; then
echo "Error: Bob's account not properly funded"
exit 1
fi

Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

the hard part i have with this flow is it requires installing a new tool to run tests (act), when we want to expand the set of tests, ibc, cosmwasm, rpc compat testing, relayer testing, comet migration, etc.. do we need to write new yaml files for each? i dont understand how to reuse this flow for many other test cases we should do.

i dont think this solves the issue, we should have a cosmwasm test as well.

@julienrbrt
Copy link
Copy Markdown
Member Author

the hard part i have with this flow is it requires installing a new tool to run tests (act), when we want to expand the set of tests, ibc, cosmwasm, rpc compat testing, relayer testing, comet migration, etc.. do we need to write new yaml files for each? i dont understand how to reuse this flow for many other test cases we should do.

i dont think this solves the issue, we should have a cosmwasm test as well.

For more fleshed out tests we should eventually fork system test and use that. This was the fastest to create, as this is basically automatizing the basic local testing and avoid regressions in the short/mid term.

Concerning cosmwasm, this can easily be added here or in another workflow (depending on what part of cosmwasm we want to test). We can even split the app scaffolding in multiple actions to get different flavor of an app (app with ibc, app with cosmwasm, ...)

Adding cosmwasm should eventually be as simple as:

ignite app install github.com/ignite/apps/wasm@main
ignite app install github.com/ignite/apps/rollkit@main
ignite wasm add
ignite rollkit add
ignite rollkit init
ignite wasm config

@julienrbrt julienrbrt merged commit 86659ac into main May 8, 2025
12 checks passed
@julienrbrt julienrbrt deleted the julien/tx-test branch May 8, 2025 13:04
chatton pushed a commit that referenced this pull request Oct 7, 2025
* ci: add tx test in integration test

* updates

* updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants