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

update simulation #2983

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

update simulation #2983

wants to merge 4 commits into from

Conversation

wangjiulian
Copy link
Collaborator

@wangjiulian wangjiulian commented Dec 17, 2024

Closed: #2978 #2979 #2980 #2981

Summary by CodeRabbit

  • New Features

    • Streamlined handling of service-related messages in the application.
    • Improved address handling for validator operations.
  • Bug Fixes

    • Enhanced error management during address conversion and validator operations.
  • Tests

    • Updated simulation tests to ensure correct initialization with a fresh database.
  • Chores

    • Updated various module versions in the project dependencies.
    • Removed obsolete simulation target from the makefile.

Copy link

coderabbitai bot commented Dec 17, 2024

Walkthrough

The pull request introduces modifications across several files in the IrisHub project. In app/ante/decorators.go, the ValidateServiceDecorator has been simplified by removing service message validation logic. The app/export.go file updates address handling methods, replacing sdk.ValAddressFromBech32 with a new address conversion approach. Simulation tests in app/sim_test.go have been updated to improve application initialization. The go.mod file reflects version updates for various modules, and sims.mk removes a specific simulation target.

Changes

File Change Summary
app/ante/decorators.go Removed MsgCallService message validation logic in AnteHandle method
app/export.go Updated validator address conversion methods, enhanced error handling
app/sim_test.go Modified TestAppImportExport and TestAppSimulationAfterImport to improve app initialization
go.mod Updated module versions for various mods.irisnet.org modules
sims.mk Removed test-sim-custom-genesis-multi-seed target

Assessment against linked issues

Objective Addressed Explanation
Resolve simulation test failures [#2978] Modifications made to simulation tests, but unclear if completely resolves the issue

Possibly related PRs

  • refactor: bump up irismod #2950: The changes in go.mod related to updating module versions may indirectly affect the ValidateServiceDecorator class in app/ante/decorators.go, as dependencies could influence the behavior of the decorators, but there are no direct code changes in the same file or related functions.

Suggested reviewers

  • harvey-smith
  • mitch1024

Poem

🐰 A rabbit's tale of code so bright,
Decorators trimmed with surgical might.
Modules dancing, versions anew,
Simulations running, tests breaking through.
CodeRabbit's magic, clean and light! 🔧

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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>, 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.

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. (Beta)
  • @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.

Copy link

@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: 4

🧹 Nitpick comments (1)
go.mod (1)

281-285: Consider removing commented-out module replacements.

The commented-out replace directives may no longer be needed. Removing unused code improves maintainability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between af27100 and 1cdd761.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • app/ante/decorators.go (1 hunks)
  • app/export.go (5 hunks)
  • app/sim_test.go (2 hunks)
  • go.mod (2 hunks)
  • sims.mk (0 hunks)
💤 Files with no reviewable changes (1)
  • sims.mk
🧰 Additional context used
🪛 golangci-lint (1.62.2)
app/export.go

179-179: Error return value of app.StakingKeeper.IterateRedelegations is not checked

(errcheck)


191-191: Error return value of app.StakingKeeper.IterateUnbondingDelegations is not checked

(errcheck)


220-220: Error return value of app.StakingKeeper.SetValidator is not checked

(errcheck)

🔇 Additional comments (4)
app/ante/decorators.go (1)

79-79: ⚠️ Potential issue

Verify removal of validation logic in ValidateServiceDecorator.

Removing the validation logic in ValidateServiceDecorator.AnteHandle means MsgCallService messages are no longer validated. This could introduce security risks if repeatable service invocations are not intended.

Run the following script to assess the impact of this change:

go.mod (1)

14-23: Verify compatibility and security of updated modules.

Ensure that the updated module versions are compatible with the codebase and do not introduce new vulnerabilities.

Run the following script to check for known vulnerabilities in the updated modules:

app/sim_test.go (2)

199-199: Ensure newApp uses newDB for accurate testing.

Using newDB instead of db when creating newApp ensures that tests are performed on a fresh database, preventing state leakage between tests.


372-377: Add error handling and specify ChainId in InitChain.

Including ChainId and checking the error returned by newApp.InitChain ensures proper initialization and catches potential issues early.

app/export.go Outdated Show resolved Hide resolved
app/export.go Show resolved Hide resolved
app/export.go Outdated Show resolved Hide resolved
app/export.go Show resolved Hide resolved
Copy link

@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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1cdd761 and 980d8c4.

📒 Files selected for processing (2)
  • app/export.go (5 hunks)
  • go.mod (1 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
app/export.go

197-197: Error return value of app.StakingKeeper.IterateUnbondingDelegations is not checked

(errcheck)

🔇 Additional comments (5)
app/export.go (4)

86-96: LGTM: Improved address handling and error management

The changes properly implement the new address codec pattern and add comprehensive error handling for both address conversion and iteration operations.


126-155: LGTM: Well-structured error handling

The changes implement proper error handling for all operations and consistently use the new address codec pattern.


182-194: LGTM: Proper error handling added

Error handling has been appropriately added for both redelegation operations and iteration.


197-206: ⚠️ Potential issue

Add missing error handling for IterateUnbondingDelegations

While error handling was added for SetUnbondingDelegation, the error return value from IterateUnbondingDelegations is not being checked.

Apply this diff to handle the error:

-app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
+err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
     for i := range ubd.Entries {
         ubd.Entries[i].CreationHeight = 0
     }
     err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
     if err != nil {
         panic(err)
     }
     return false
 })
+if err != nil {
+    panic(err)
+}

Likely invalid or redundant comment.

🧰 Tools
🪛 golangci-lint (1.62.2)

197-197: Error return value of app.StakingKeeper.IterateUnbondingDelegations is not checked

(errcheck)

go.mod (1)

14-23: LGTM: Consistent version updates

All irisnet modules have been updated to the same version (20241217080151-0ad41be03ac6), maintaining consistency across the codebase.

app/export.go Show resolved Hide resolved
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.

test-sim-after-import: runsim
1 participant