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

chore: add spellchecker #303

Merged
merged 4 commits into from
Nov 14, 2024
Merged

chore: add spellchecker #303

merged 4 commits into from
Nov 14, 2024

Conversation

Vritra4
Copy link
Contributor

@Vritra4 Vritra4 commented Nov 14, 2024

Description

add a workflow to check spell


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

@Vritra4 Vritra4 requested a review from beer-1 November 14, 2024 06:45
@Vritra4 Vritra4 self-assigned this Nov 14, 2024
@Vritra4 Vritra4 requested a review from a team as a code owner November 14, 2024 06:45
Copy link

coderabbitai bot commented Nov 14, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces a new .codespellignore file to specify terms that should be excluded from spell-checking by the codespell tool. Additionally, it includes various comment corrections across multiple .pulsar.go, .proto, and other files, primarily fixing typographical errors in comments and enhancing documentation clarity. The changes do not modify any existing functionality or logic within the codebase.

Changes

File Path Change Summary
.github/config/.codespellignore New file added with terms to ignore during spell-checking: cips, pullrequest, keypair, etc.
api/initia/distribution/v1/genesis.pulsar.go Comment corrected from "paramaters" to "parameters" in GenesisState struct.
api/initia/gov/v1/genesis.pulsar.go Comment corrected from "paramaters" to "parameters" in GenesisState struct.
api/initia/ibchooks/v1/genesis.pulsar.go Comment corrected from "paramaters" to "parameters" in GenesisState struct.
api/initia/mstaking/v1/genesis.pulsar.go Comment corrected from "paramaters" to "parameters" in GenesisState struct.
api/initia/reward/v1/genesis.pulsar.go Comment corrected from "paramaters" to "parameters" in GenesisState struct.
api/initia/move/v1/types.pulsar.go Enum value corrected from UpgradePolicy_COMPATBILE to UpgradePolicy_COMPATIBLE.
api/initia/move/v1/types.pulsar.go Comment corrected from "metdata" to "metadata" in DexPair struct.
app/upgrade.go Comment corrected from "new seperator" to "new separator".
cmd/move/move.go Comment corrected from "noe kebab" to "not kebab"; typo in fiagCheckStacklessVM corrected to flagCheckStacklessVM.
contrib/devtools/Makefile Comments updated for clarity regarding installation commands.
images/node/entrypoint.sh Comment corrected from "corresponsding" to "corresponding".
proto/initia/distribution/v1/genesis.proto Comment corrected from "paramaters" to "parameters" in GenesisState.
proto/initia/gov/v1/genesis.proto Comment corrected from "paramaters" to "parameters" in GenesisState.
proto/initia/ibchooks/v1/genesis.proto Comment corrected from "paramaters" to "parameters" in GenesisState.
proto/initia/move/v1/query.proto Comment corrected from "arguemtns" to "arguments" in ViewJSON and ViewJSONBatch methods.
proto/initia/move/v1/types.proto Comment corrected from "COMPATBILE" to "COMPATIBLE"; "metdata" to "metadata".
proto/initia/mstaking/v1/genesis.proto Comment corrected from "paramaters" to "parameters" in GenesisState.
proto/initia/mstaking/v1/staking.proto Comment corrected from "identifing" to "identifying" in Validator message.
proto/initia/reward/v1/genesis.proto Comment corrected from "paramaters" to "parameters" in GenesisState.
shared.Dockerfile Comment corrected from "editting" to "editing"; installation command streamlined.
x/authz/client/cli/tx.go Command flag description corrected from "excute" to "execute".
x/distribution/types/dec_pool.go Comment corrected from "wether" to "whether" in IsEmpty method.
x/distribution/types/pool.go Comment corrected from "wether" to "whether" in IsEmpty method.
x/genutil/collect.go Variable renamed from fos to entries in CollectTxs function for clarity.
x/gov/types/params.go Error message corrections from "mininum" to "minimum" and "quorom" to "quorum".
x/ibc/nft-transfer/client/cli/query.go Comment corrected from "mantains" to "maintains" in GetCmdQueryClassTraces.
x/ibc/testing/README.md Typographical errors corrected, including "contruct" to "construct" and "intitialized" to "initialized".
x/ibc/testing/endpoint.go Comment corrected from "lastest" to "latest" in QueryProof method.
x/intertx/keeper/msg_server_test.go Test case name corrected from "faliure" to "failure".
x/move/client/cli/utils_test.go Expected result fields renamed from expRes to express in tests.
x/move/keeper/handler.go Methods deprecated and new JSON-based methods added for improved performance.
x/move/keeper/keeper.go Comment corrected from "wether" to "whether" in HasResource method.
x/move/keeper/staking.go Comment corrected from "consequentially" to "consequently"; error handling improved in various methods.
x/move/keeper/whitelist_test.go Comment corrected from "currnetly" to "currently".
x/move/types/authz.go Comment corrected from "propoer" to "proper".
x/mstaking/keeper/slash.go Comment corrected from "therefor" to "therefore" in SlashRedelegation method.
x/mstaking/types/authz.go Comment corrected from "propoer" to "proper".
x/slashing/keeper/signing_info.go Comment corrected from "retruns" to "returns" in GetValidatorSigningInfo method.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Codespell
    participant Codebase

    User->>Codespell: Run spell-check
    Codespell->>Codebase: Check for terms in .codespellignore
    Codebase-->>Codespell: Ignore specified terms
    Codespell-->>User: Return spell-check results
Loading

Possibly related PRs

  • fix pulsar and some typos in proto #193: This PR involves fixing typos in comments across various files, including .pulsar.go files, which aligns with the main PR's focus on customizing spell-checking behavior by adding terms to .codespellignore.
  • chore: review dependencies #243: Although this PR primarily focuses on dependency management, it includes a new workflow that may indirectly relate to ensuring that documentation and comments are clear and accurate, similar to the objectives of the main PR.
  • fix: allow to be failed with invalid message without error #283: This PR enhances error handling and message dispatching, which may relate to the overall clarity and correctness of the codebase, echoing the main PR's goal of improving spell-checking and documentation accuracy.

Suggested reviewers

  • beer-1

Poem

🐇 In the code where comments dwell,
Typos fixed, all is well.
With .codespellignore in sight,
Our documentation shines so bright!
Clarity reigns, errors take flight,
Hopping forward, all feels right!

Warning

Rate limit exceeded

@Vritra4 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between dedb34e and f4e6491.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dedb34e and f4e6491.

📒 Files selected for processing (1)
  • x/move/client/cli/utils_test.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • x/move/client/cli/utils_test.go

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

github-actions bot commented Nov 14, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 4.*.* 🟢 7.4
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1012 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
Security-Policy🟢 9security policy file detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Packaging🟢 10packaging workflow detected
SAST🟢 9SAST tool detected but not run on all commits
Vulnerabilities🟢 91 existing vulnerabilities detected
actions/peter-evans/create-pull-request 7.0.5 🟢 5.3
Details
CheckScoreReason
Code-Review🟢 5Found 7/12 approved changesets -- score normalized to 5
Maintained🟢 1030 commit(s) and 26 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
Security-Policy⚠️ 0security policy file not detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 91 existing vulnerabilities detected

Scanned Files

  • .github/workflows/spellcheck.yml

x/bank/keeper/msg_server.go Outdated Show resolved Hide resolved
x/move/keeper/balancer.go Outdated 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: 2

🧹 Outside diff range and nitpick comments (6)
x/genutil/collect.go (2)

101-105: Maintain consistent indentation.

While the logic is correct, the indentation of the conditions appears inconsistent. Consider aligning the indentation of both if-continue blocks for better readability.

 for _, entry := range entries {
   if entry.IsDir() {
     continue
   }
-if !strings.HasSuffix(entry.Name(), ".json") {
-    continue
-}
+  if !strings.HasSuffix(entry.Name(), ".json") {
+    continue
+  }

Line range hint 149-153: Remove debug print statements.

The code contains temporary debugging statements using runtime.Caller. These should be removed or replaced with proper logging.

-      _, file, no, ok := runtime.Caller(1)
-      if ok {
-        fmt.Printf("CollectTxs-1, called from %s#%d\n", file, no)
-      }

-      _, file, no, ok := runtime.Caller(1)
-      if ok {
-        fmt.Printf("CollectTxs-2, called from %s#%d - %s\n", file, no, valAccAddrStr)
-      }

Also applies to: 160-164

x/move/client/cli/utils_test.go (1)

Line range hint 1-1: Update .codespellignore to preserve common test abbreviations

Since this PR introduces spell checking, please add expRes to .codespellignore to preserve this common test abbreviation. This will prevent unintended changes to established testing conventions while still catching actual spelling errors.

x/move/keeper/balancer.go (1)

Line range hint 209-219: LGTM! Consider consistent naming for paired variables.

The variable renaming from metadataA to metadata improves clarity. However, for better symmetry with metadataB, consider either:

  1. Keep both variables with suffixes: metadataA and metadataB
  2. Remove suffixes from both: metadata1 and metadata2

This is a minor stylistic suggestion, the current implementation is functionally correct.

x/move/keeper/staking.go (2)

143-143: LGTM! Consider enhancing the function documentation.

The spelling correction from "consequentially" to "consequently" is accurate. Consider enhancing the documentation to better describe the operation flow and potential error cases.

Add more details to the comment:

-// consequently delegate the deposited coins to a validator.
+// consequently delegate the deposited coins to a validator.
+//
+// Flow:
+// 1. Withdraws staking coins from move module account
+// 2. Sends coins to delegator module account
+// 3. Delegates coins to the specified validator
+//
+// Returns the delegation shares and any error encountered during the process.
+// Possible errors:
+// - If the module account already exists and is not empty
+// - If coin transfer fails
+// - If validator does not exist
+// - If delegation fails

Line range hint 149-152: Enhance error message for better debugging.

The error message for address collision could be more descriptive to aid in debugging.

-				return sdk.NewDecCoins(), types.ErrAddressAlreadyTaken.Wrapf("module account %s is already taken", delModuleAddr.String())
+				return sdk.NewDecCoins(), types.ErrAddressAlreadyTaken.Wrapf(
+					"module account %s is already taken by a non-module account type %T",
+					delModuleAddr.String(),
+					macc,
+				)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 329e6e3 and 8a81401.

⛔ Files ignored due to path filters (11)
  • .github/workflows/spellcheck.yml is excluded by !**/*.yml
  • api/initia/move/v1/query_grpc.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • client/docs/swagger-ui/swagger.yaml is excluded by !**/*.yaml
  • x/distribution/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/gov/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/ibc-hooks/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/move/types/query.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/move/types/types.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/mstaking/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/mstaking/types/staking.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/reward/types/genesis.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
📒 Files selected for processing (41)
  • .github/config/.codespellignore (1 hunks)
  • api/initia/distribution/v1/genesis.pulsar.go (1 hunks)
  • api/initia/gov/v1/genesis.pulsar.go (1 hunks)
  • api/initia/ibchooks/v1/genesis.pulsar.go (1 hunks)
  • api/initia/move/v1/types.pulsar.go (2 hunks)
  • api/initia/mstaking/v1/genesis.pulsar.go (1 hunks)
  • api/initia/mstaking/v1/staking.pulsar.go (1 hunks)
  • api/initia/reward/v1/genesis.pulsar.go (1 hunks)
  • app/upgrade.go (1 hunks)
  • cmd/move/move.go (1 hunks)
  • contrib/devtools/Makefile (2 hunks)
  • images/node/entrypoint.sh (1 hunks)
  • proto/initia/distribution/v1/genesis.proto (1 hunks)
  • proto/initia/gov/v1/genesis.proto (1 hunks)
  • proto/initia/ibchooks/v1/genesis.proto (1 hunks)
  • proto/initia/move/v1/query.proto (1 hunks)
  • proto/initia/move/v1/types.proto (2 hunks)
  • proto/initia/mstaking/v1/genesis.proto (1 hunks)
  • proto/initia/mstaking/v1/staking.proto (1 hunks)
  • proto/initia/reward/v1/genesis.proto (1 hunks)
  • shared.Dockerfile (1 hunks)
  • x/authz/client/cli/tx.go (1 hunks)
  • x/bank/keeper/msg_server.go (1 hunks)
  • x/distribution/types/dec_pool.go (1 hunks)
  • x/distribution/types/pool.go (1 hunks)
  • x/genutil/collect.go (2 hunks)
  • x/gov/types/params.go (1 hunks)
  • x/ibc/nft-transfer/client/cli/query.go (1 hunks)
  • x/ibc/testing/README.md (2 hunks)
  • x/ibc/testing/endpoint.go (1 hunks)
  • x/intertx/keeper/msg_server_test.go (1 hunks)
  • x/move/client/cli/utils_test.go (5 hunks)
  • x/move/keeper/balancer.go (2 hunks)
  • x/move/keeper/handler.go (1 hunks)
  • x/move/keeper/keeper.go (1 hunks)
  • x/move/keeper/staking.go (1 hunks)
  • x/move/keeper/whitelist_test.go (1 hunks)
  • x/move/types/authz.go (1 hunks)
  • x/mstaking/keeper/slash.go (1 hunks)
  • x/mstaking/types/authz.go (1 hunks)
  • x/slashing/keeper/signing_info.go (1 hunks)
🔥 Files not summarized due to errors (1)
  • api/initia/mstaking/v1/staking.pulsar.go: Error: Server error: no LLM provider could handle the message
✅ Files skipped from review due to trivial changes (32)
  • .github/config/.codespellignore
  • api/initia/distribution/v1/genesis.pulsar.go
  • api/initia/gov/v1/genesis.pulsar.go
  • api/initia/ibchooks/v1/genesis.pulsar.go
  • api/initia/move/v1/types.pulsar.go
  • api/initia/mstaking/v1/genesis.pulsar.go
  • api/initia/reward/v1/genesis.pulsar.go
  • cmd/move/move.go
  • contrib/devtools/Makefile
  • images/node/entrypoint.sh
  • proto/initia/distribution/v1/genesis.proto
  • proto/initia/gov/v1/genesis.proto
  • proto/initia/ibchooks/v1/genesis.proto
  • proto/initia/move/v1/query.proto
  • proto/initia/move/v1/types.proto
  • proto/initia/mstaking/v1/genesis.proto
  • proto/initia/mstaking/v1/staking.proto
  • proto/initia/reward/v1/genesis.proto
  • shared.Dockerfile
  • x/authz/client/cli/tx.go
  • x/distribution/types/dec_pool.go
  • x/distribution/types/pool.go
  • x/gov/types/params.go
  • x/ibc/nft-transfer/client/cli/query.go
  • x/ibc/testing/README.md
  • x/ibc/testing/endpoint.go
  • x/move/keeper/keeper.go
  • x/move/keeper/whitelist_test.go
  • x/move/types/authz.go
  • x/mstaking/keeper/slash.go
  • x/mstaking/types/authz.go
  • x/slashing/keeper/signing_info.go
🔇 Additional comments (12)
app/upgrade.go (3)

Line range hint 51-82: Critical: Ensure data migration reliability and validation.

The migration logic appears sound but has several critical aspects that need attention:

  1. The descending order walk is correct to prevent overwriting, but consider adding a comment explaining this choice.
  2. Key cloning is properly implemented with bytes.Clone().
  3. Consider adding validation steps:
    • Count of migrated entries
    • Verification of checksum computation
    • Post-migration integrity check

Let's verify the migration logic:

#!/bin/bash
# Description: Check for similar migration patterns in the codebase

# Look for other Walk implementations to compare patterns
ast-grep --pattern 'Walk($_, $_, func($_, $_) ($_, $_) {'

# Search for similar upgrade handlers
rg -A 5 'SetUpgradeHandler'

Consider adding these safety measures:

 func (app *InitiaApp) RegisterUpgradeHandlers(cfg module.Configurator) {
+    // Track migration statistics
+    var migratedCount int
+    var checksumCount int
+
     app.UpgradeKeeper.SetUpgradeHandler(
         upgradeName,
         func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
+            // Log start of migration
+            logger := app.Logger()
+            logger.Info("Starting VM store migration", "upgrade", upgradeName)
+
             // ... existing code ...
+
             err = app.MoveKeeper.VMStore.Walk(ctx, new(collections.Range[[]byte]).Descending(), func(key, value []byte) (stop bool, err error) {
                 // ... existing code ...
                 if separator == movetypes.ModuleSeparator {
                     checksum := movetypes.ModuleBzToChecksum(value)
                     value = checksum[:]
+                    checksumCount++
                 }
                 // ... existing code ...
                 err = app.MoveKeeper.VMStore.Set(ctx, key, value)
                 if err != nil {
                     return true, err
                 }
+                migratedCount++
                 return false, nil
             })
+
+            // Log migration statistics
+            logger.Info("Completed VM store migration",
+                "migrated_entries", migratedCount,
+                "checksum_entries", checksumCount)

Line range hint 1-100: Verify upgrade handler test coverage.

This upgrade handler performs critical database migrations. Please ensure:

  1. Comprehensive test coverage including:
    • Migration of different entry types
    • Error scenarios
    • Edge cases with various key lengths
    • Validation of checksums
  2. Integration tests with actual VM store data
  3. Rollback scenarios

Let's check for existing tests:

#!/bin/bash
# Description: Check for upgrade handler tests

# Look for test files
fd -e go -e _test.go

# Search for upgrade handler tests
rg -l "TestUpgrade.*Handler" 

Line range hint 37-50: Document version information and verify migration completeness.

The comment block clearly explains the separator changes, but consider adding:

  1. The version where this change was introduced (0.6.0)
  2. Any backward compatibility implications

Let's verify that all separator constants are updated correctly in the codebase:

Consider extracting these separator constants into a versioned configuration to make future upgrades more maintainable.

✅ Verification successful

Separator constants are correctly defined and used in the upgrade handler

The verification confirms that:

  1. The separator constants are properly defined in x/move/types/keys.go with the new values:

    • ModuleSeparator = byte(0)
    • ChecksumSeparator = byte(1)
    • ResourceSeparator = byte(2)
    • TableEntrySeparator = byte(3)
    • TableInfoSeparator = byte(4)
  2. The upgrade handler in app/upgrade.go correctly handles the migration by:

    • Preserving ModuleSeparator at byte(0)
    • Adding ChecksumSeparator at byte(1)
    • Shifting other separators accordingly
    • Walking through the store and updating the data structure

The implementation matches the documented changes and handles the migration appropriately.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any hardcoded separator values that might need updating

# Search for separator constant definitions
ast-grep --pattern 'const $_ = byte($_)'

# Search for direct byte comparisons that might be using old separator values
rg -A 2 'byte\([0-3]\)'

Length of output: 17554


Script:

#!/bin/bash
# Search for separator-related constants and their usage in the codebase

# Look for separator constants in move module
rg -A 5 "ModuleSeparator|ResourceSeparator|TableEntrySeparator|TableInfoSeparator|ChecksumSeparator" --type go

# Look for byte separator usage in move module
rg -A 5 "byte\([0-4]\)" --type go

# Look for separator-related code in move types
ast-grep --pattern 'const $_ = byte($_)' x/move/types/

Length of output: 11513

x/bank/keeper/msg_server.go (1)

105-105: LGTM! The comment clarification improves readability.

The updated comment "total In == total Out" better reflects the validation check performed by ValidateInputOutputs. The spacing makes it easier to read while maintaining technical accuracy.

Let's verify the validation logic referenced in the comment:

x/intertx/keeper/msg_server_test.go (1)

38-38: LGTM! Typo fix looks good.

The correction from "faliure" to "failure" improves code clarity and maintains consistency with other test case names.

Let's verify the consistency of "failure" spelling across test cases:

✅ Verification successful

Spelling consistency verified across the codebase

The search results confirm that "failure" is consistently spelled correctly throughout the codebase, including all test case names and comments. No instances of the misspelling "faliure" were found, indicating that this was an isolated typo that has been properly fixed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining misspellings of "failure" in test files
# Expected: No occurrences of "faliure" should be found

rg -i "faliure" --type go

Length of output: 25


Script:

#!/bin/bash
# Let's check for both "failure" and "faliure" with context to better understand the test case naming patterns
rg -i "fail[ui]re" --type go -A 2 -B 2

Length of output: 6608

x/genutil/collect.go (2)

81-82: LGTM! Improved variable naming.

The change from fos to entries makes the code more readable by using a more descriptive variable name that better represents its purpose.


110-110: LGTM! Secure file path handling.

The code correctly uses filepath.Join for path construction and maintains proper error handling.

x/move/keeper/handler.go (2)

Line range hint 1-600: Document JSON format expectations for new JSON-based methods

The migration from byte-based to JSON-based methods introduces potential compatibility concerns. Consider adding documentation that specifies:

  • Expected JSON format for different argument types
  • Examples of valid JSON inputs
  • Handling of special characters and escape sequences

Review unsafe string conversions for potential risks

The code uses unsafe.String and unsafe.Slice for performance optimization. While this can be beneficial for performance, it needs careful consideration:

  • Document the assumptions about input data
  • Add validation checks before unsafe conversions
  • Consider adding runtime checks in debug builds

Let's check for potential issues with unsafe conversions:

#!/bin/bash
# Search for patterns that might cause issues with unsafe string conversions
rg -g '*.go' 'unsafe\.(String|Slice).*json' .

# Look for any existing validation before unsafe conversions
rg -g '*.go' -B 5 'unsafe\.(String|Slice)' .

Line range hint 424-437: Consider using proper JSON marshaling for callback arguments

While the current string formatting approach works for simple types, it may not handle all JSON edge cases correctly. Consider using proper JSON marshaling for better reliability and maintainability.

Here's a suggested improvement:

- fmt.Sprintf("\"%d\"", message.Callback.Id),
- fmt.Sprintf("%v", success),
+ string(must(json.Marshal(message.Callback.Id))),
+ string(must(json.Marshal(success))),

Where must is a helper function:

func must[T any](v T, err error) T {
    if err != nil {
        panic(err)
    }
    return v
}

Let's verify the callback execution behavior:

x/move/keeper/staking.go (1)

Line range hint 144-148: Verify validator address handling across the codebase.

The function handles validator addresses in multiple places. Let's verify that all validator address validations are consistent across the codebase.

Also applies to: 171-173

api/initia/mstaking/v1/staking.pulsar.go (2)

13000-13000: Consider the impact on existing validators

If this is indeed a new field, adding it to the validator struct could affect:

  1. Existing validator state migrations
  2. API compatibility
  3. Database schema changes

Please ensure:

  • State migration handlers are in place
  • API version is properly incremented if this is a breaking change
  • Documentation is updated to reflect this new identifier

Let's check for migration handling:

#!/bin/bash
# Description: Look for state migration code and documentation updates

# Check for migration handlers
fd -e .go | xargs rg -l "RegisterMigration|MigrateState"

# Look for documentation updates
fd -e .md | xargs rg -i "unbonding[_-]id"

13000-13000: Verify if this is a new field addition rather than a spelling fix

While this PR is marked as a spell-checking effort, the addition of UnbondingId appears to be a functional change that introduces a new field to track validator unbonding processes. This seems to go beyond the scope of a spell-checking PR.

Let's verify if this is indeed a new field:

x/move/client/cli/utils_test.go Outdated Show resolved Hide resolved
x/move/client/cli/utils_test.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 41.04%. Comparing base (329e6e3) to head (f4e6491).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
x/genutil/collect.go 66.66% 2 Missing ⚠️
x/authz/client/cli/tx.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #303   +/-   ##
=======================================
  Coverage   41.04%   41.04%           
=======================================
  Files         268      268           
  Lines       25728    25728           
=======================================
  Hits        10559    10559           
  Misses      13532    13532           
  Partials     1637     1637           
Files with missing lines Coverage Δ
app/upgrade.go 5.76% <ø> (ø)
x/distribution/types/dec_pool.go 85.00% <ø> (ø)
x/distribution/types/pool.go 80.25% <ø> (ø)
x/gov/types/params.go 64.57% <100.00%> (ø)
x/ibc/nft-transfer/client/cli/query.go 0.00% <ø> (ø)
x/move/keeper/handler.go 81.05% <100.00%> (ø)
x/move/keeper/keeper.go 56.05% <ø> (ø)
x/move/keeper/staking.go 58.43% <ø> (ø)
x/move/types/authz.go 61.68% <ø> (ø)
x/mstaking/keeper/slash.go 45.63% <ø> (ø)
... and 4 more

Copy link
Contributor

@beer-1 beer-1 left a comment

Choose a reason for hiding this comment

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

LGTM except last comment 👍

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