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

release/v1.51 chain upgrade 1.13 to master #231

Merged
merged 63 commits into from
Jul 30, 2024

Conversation

aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented Jul 29, 2024

  • PR containing all latest changes in dev to release them to master to create the v1.51 release.
  • Includes all required changes to support interacting with with the chain upgrade v1.13

abel and others added 30 commits March 14, 2024 17:21
…factoring

feat/cookies_management_refactoring
…le_queries

(feat) Added support for IBC Core Channel module queries. Added also …
…ries

(feat) Added script examples for the IBC Core Client module queries
…_queries

feat/ibc_connection_module_queries
…mismatch. Added configuration for local network.
…atch_fixing

(feat) Added a new config option to disable the auto fix of sequence …
…ll go.mod dependencies to sync with injective-core dependencies
…om the official tokens lists for each environment
…ll go.mod dependencies to sync with injective-core dependencies
aarmoa and others added 24 commits June 6, 2024 17:01
fix: make PrepareFactory public so chilliass can re-use it
…e and injective-indexer (v1.13 chain upgrade candidates)
…ript. Updated all markets and tokens INI files
…hain_v1_13

Feat/update dependencies chain v1 13
… release/v1_51_chain_upgrade_1_13_master
Copy link

coderabbitai bot commented Jul 29, 2024

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Files selected but had no reviewable changes (4)
  • client/metadata/assets/devnet-1.ini
  • client/metadata/assets/devnet.ini
  • client/metadata/assets/mainnet.ini
  • client/metadata/assets/testnet.ini

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Warning

Walkthrough skipped

File diffs could not be summarized.


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.
    • @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 as 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.

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

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

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.82%. Comparing base (7294750) to head (7cdfb24).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #231      +/-   ##
==========================================
- Coverage   25.01%   15.82%   -9.20%     
==========================================
  Files          17       25       +8     
  Lines        3022     4784    +1762     
==========================================
+ Hits          756      757       +1     
- Misses       2234     3992    +1758     
- Partials       32       35       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Outside diff range, codebase verification and nitpick comments (11)
chain/auction/types/key.go (1)

14-14: The new key KeyLastAuctionResult is declared but not used anywhere else in the codebase. Please ensure it is integrated where necessary to avoid dead code.

Analysis chain

LGTM! But verify the usage of the new key.

The addition of KeyLastAuctionResult follows the existing pattern for keys.

However, ensure that the new key is used correctly in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new key `KeyLastAuctionResult`.

# Test: Search for the key usage. Expect: Occurrences of the new key.
rg --type go 'KeyLastAuctionResult'

Length of output: 99

.github/workflows/run-tests.yml (1)

11-11: Consider using a specific version for the checkout action.

Using the master branch for the checkout action can introduce instability as it pulls the latest changes. Consider using a specific version for stability.

-      - uses: actions/checkout@master
+      - uses: actions/checkout@v3
.pre-commit-config.yaml (1)

16-16: Consider using a specific version for the repository reference.

Using the master branch can introduce instability as it pulls the latest changes. Consider using a specific version for stability.

-      rev: master
+      rev: v0.5.0
chain/oracle/types/stork.go (1)

7-19: NewPriceState does not handle errors.

The NewPriceState function initializes a PriceState struct without any error handling. It assumes that the provided parameters are always valid. This could lead to issues if invalid data is passed to the function.

  • Location: chain/oracle/types/oracle.go, lines 1-7
Analysis chain

Verify error handling in NewPriceState.

Ensure that NewPriceState properly handles any potential errors or edge cases.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify error handling in `NewPriceState`.

# Test: Search for the function implementation. Expect: Proper error handling.
ast-grep --lang go --pattern $'func NewPriceState(price math.LegacyDec, blockTime int64) *PriceState {
  $$$
}'

Length of output: 112


Script:

#!/bin/bash
# Description: Verify error handling in `NewPriceState`.

# Search for the definition of the `NewPriceState` function in the Go codebase.
rg "func NewPriceState" -A 10 --multiline

Length of output: 708

chain/insurance/types/expected_keepers.go (2)

14-14: Inconsistent context type for SendCoinsFromModuleToModule.

The method SendCoinsFromModuleToModule in chain/exchange/types/expected_keepers.go still uses sdk.Context instead of the updated context.Context. Please update the context type to ensure consistency across the codebase.

  • chain/exchange/types/expected_keepers.go: Update ctx sdk.Context to ctx context.Context.
Analysis chain

Verify method usage for SendCoinsFromModuleToModule.

Ensure that all function calls to SendCoinsFromModuleToModule correctly handle the updated context type.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `SendCoinsFromModuleToModule` handle the updated context type.

# Test: Search for the method usage. Expect: Correct handling of the updated context type.
rg --type go 'SendCoinsFromModuleToModule'

Length of output: 1075


15-15: Update context type in SendCoinsFromModuleToAccount method.

The SendCoinsFromModuleToAccount method in chain/exchange/types/expected_keepers.go should be updated to use context.Context instead of sdk.Context to maintain consistency across the codebase.

  • chain/exchange/types/expected_keepers.go: Update SendCoinsFromModuleToAccount method to use context.Context.
Analysis chain

Verify method usage for SendCoinsFromModuleToAccount.

Ensure that all function calls to SendCoinsFromModuleToAccount correctly handle the updated context type.


Verify method usage for SendCoinsFromModuleToAccount in chain/exchange.

Ensure that the SendCoinsFromModuleToAccount function in chain/exchange/types/expected_keepers.go correctly handles the context type.


Verify method calls to SendCoinsFromModuleToAccount in chain/exchange.

Ensure that all calls to SendCoinsFromModuleToAccount in the chain/exchange directory handle the context type correctly.


Verify method calls to SendCoinsFromModuleToAccount in chain/exchange.

Ensure that all calls to SendCoinsFromModuleToAccount in the chain/exchange directory handle the context type correctly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `SendCoinsFromModuleToAccount` handle the updated context type.

# Test: Search for the method usage. Expect: Correct handling of the updated context type.
rg --type go 'SendCoinsFromModuleToAccount'

Length of output: 1509


Script:

#!/bin/bash
# Description: Verify all function calls to `SendCoinsFromModuleToAccount` in the `chain/exchange` directory handle the context type correctly.

# Test: Search for the method usage in the `chain/exchange` directory. Expect: Correct handling of the context type.
rg --type go 'SendCoinsFromModuleToAccount' chain/exchange

Length of output: 218


Script:

#!/bin/bash
# Description: Verify all function calls to `SendCoinsFromModuleToAccount` in the `chain/exchange` directory handle the context type correctly.

# Test: Search for the method calls in the `chain/exchange` directory. Expect: Correct handling of the context type.
rg --type go 'SendCoinsFromModuleToAccount(' chain/exchange

Length of output: 170


Script:

#!/bin/bash
# Description: Verify all function calls to `SendCoinsFromModuleToAccount` in the `chain/exchange` directory handle the context type correctly.

# Test: Search for the method calls in the `chain/exchange` directory. Expect: Correct handling of the context type.
rg --type go 'SendCoinsFromModuleToAccount\(' chain/exchange

Length of output: 222

chain/ocr/types/expected_keepers.go (1)

Inconsistent interface update:

The BankKeeper interface in the chain/exchange/types/expected_keepers.go file still uses sdk.Context instead of context.Context. Please update the following methods to use context.Context for consistency:

  • SendCoinsFromModuleToModule
  • SendCoinsFromModuleToAccount
  • SendCoinsFromAccountToModule
  • GetSupply

Location:

  • chain/exchange/types/expected_keepers.go
Analysis chain

Line range hint 4-28:
Verify consistency of interface changes.

Ensure that all implementations of the BankKeeper interface are updated to use context.Context instead of sdk.Context.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all implementations of the `BankKeeper` interface are updated to use `context.Context` instead of `sdk.Context`.

# Test: Search for the interface implementations. Expect: Only occurrences of the new context type.
rg --type go -A 5 $'BankKeeper'

Length of output: 7040


Script:

#!/bin/bash
# Description: Verify that all `BankKeeper` interface methods use `context.Context` instead of `sdk.Context`.

# Search for `BankKeeper` interface methods that still use `sdk.Context`.
rg --type go 'BankKeeper' -A 5 | rg 'sdk.Context'

Length of output: 591

chain/exchange/types/fee_discounts.go (1)

13-14: Incomplete Migration of sdkmath.Int to math.Int

The migration from sdkmath.Int to math.Int is incomplete. The following files still contain instances of sdkmath.Int:

  • chain/peggy/types/types.go
  • chain/exchange/types/expected_keepers.go

Please ensure that all instances of sdkmath.Int are replaced with math.Int for consistency across the codebase.

Analysis chain

LGTM! But verify the usage of math.Int and math.LegacyDec in the codebase.

The code changes are approved.

However, ensure that all instances of sdkmath.Int and sdk.Dec have been replaced with math.Int and math.LegacyDec for consistency.

Also applies to: 33-34

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `sdkmath.Int` and `sdk.Dec` have been replaced with `math.Int` and `math.LegacyDec`.

# Test: Search for the old types. Expect: No occurrences.
rg --type go 'sdkmath.Int'
rg --type go 'sdk.Dec'

# Test: Search for the new types. Expect: Multiple occurrences.
rg --type go 'math.Int'
rg --type go 'math.LegacyDec'

Length of output: 104281

chain/peggy/types/params_legacy.go (1)

70-70: Add a comment to explain the purpose of ParamStoreAdmins.

Adding a brief comment to explain the purpose of ParamStoreAdmins will improve code readability and maintainability.

+ // ParamStoreAdmins stores the admin-related settings
  ParamStoreAdmins = []byte("Admins")
chain/exchange/types/params.go (2)

24-25: Update comments to reflect new fee structure.

The comment should be updated to reflect the new listing fee values.

-	// SpotMarketInstantListingFee is 20 INJ
+	// SpotMarketInstantListingFee is 20 INJ (reduced from 1000 INJ)

27-28: Update comments to reflect new fee structure.

The comment should be updated to reflect the new listing fee values.

-	// DerivativeMarketInstantListingFee is 20 INJ
+	// DerivativeMarketInstantListingFee is 20 INJ (reduced from 1000 INJ)
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7294750 and 7cdfb24.

Files ignored due to path filters (54)
  • chain/auction/types/auction.pb.go is excluded by !**/*.pb.go
  • chain/auction/types/genesis.pb.go is excluded by !**/*.pb.go
  • chain/auction/types/query.pb.go is excluded by !**/*.pb.go
  • chain/auction/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/crypto/ethsecp256k1/keys.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/authz.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/events.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/exchange.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/genesis.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/proposal.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/query.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/insurance/types/insurance.pb.go is excluded by !**/*.pb.go
  • chain/insurance/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/ocr/types/ocr.pb.go is excluded by !**/*.pb.go
  • chain/ocr/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/oracle/types/events.pb.go is excluded by !**/*.pb.go
  • chain/oracle/types/genesis.pb.go is excluded by !**/*.pb.go
  • chain/oracle/types/oracle.pb.go is excluded by !**/*.pb.go
  • chain/oracle/types/proposal.pb.go is excluded by !**/*.pb.go
  • chain/oracle/types/query.pb.go is excluded by !**/*.pb.go
  • chain/oracle/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/peggy/types/attestation.pb.go is excluded by !**/*.pb.go
  • chain/peggy/types/events.pb.go is excluded by !**/*.pb.go
  • chain/peggy/types/msgs.pb.go is excluded by !**/*.pb.go
  • chain/peggy/types/params.pb.go is excluded by !**/*.pb.go
  • chain/peggy/types/pool.pb.go is excluded by !**/*.pb.go
  • chain/peggy/types/types.pb.go is excluded by !**/*.pb.go
  • chain/permissions/types/events.pb.go is excluded by !**/*.pb.go
  • chain/permissions/types/genesis.pb.go is excluded by !**/*.pb.go
  • chain/permissions/types/params.pb.go is excluded by !**/*.pb.go
  • chain/permissions/types/permissions.pb.go is excluded by !**/*.pb.go
  • chain/permissions/types/query.pb.go is excluded by !**/*.pb.go
  • chain/permissions/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/stream/types/query.pb.go is excluded by !**/*.pb.go
  • chain/tokenfactory/types/genesis.pb.go is excluded by !**/*.pb.go
  • chain/tokenfactory/types/gov.pb.go is excluded by !**/*.pb.go
  • chain/tokenfactory/types/params.pb.go is excluded by !**/*.pb.go
  • chain/tokenfactory/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/types/account.pb.go is excluded by !**/*.pb.go
  • chain/wasmx/types/proposal.pb.go is excluded by !**/*.pb.go
  • chain/wasmx/types/tx.pb.go is excluded by !**/*.pb.go
  • chain/wasmx/types/wasmx.pb.go is excluded by !**/*.pb.go
  • exchange/accounts_rpc/pb/goadesign_goagen_injective_accounts_rpc.pb.go is excluded by !**/*.pb.go
  • exchange/accounts_rpc/pb/goadesign_goagen_injective_accounts_rpc_grpc.pb.go is excluded by !**/*.pb.go
  • exchange/accounts_rpc/pb/injective_accounts_rpc.pb.go is excluded by !**/*.pb.go
  • exchange/accounts_rpc/pb/injective_accounts_rpc.pb.gw.go is excluded by !**/*.pb.gw.go
  • exchange/accounts_rpc/pb/pb/goadesign_goagen_injective_accounts_rpc.pb.go is excluded by !**/*.pb.go
  • exchange/accounts_rpc/pb/pb/goadesign_goagen_injective_accounts_rpc_grpc.pb.go is excluded by !**/*.pb.go
  • exchange/accounts_rpc/pb/pb/injective_accounts_rpc.pb.gw.go is excluded by !**/*.pb.gw.go
  • exchange/auction_rpc/pb/goadesign_goagen_injective_auction_rpc.pb.go is excluded by !**/*.pb.go
  • exchange/auction_rpc/pb/goadesign_goagen_injective_auction_rpc_grpc.pb.go is excluded by !**/*.pb.go
  • exchange/auction_rpc/pb/injective_auction_rpc.pb.gw.go is excluded by !**/*.pb.gw.go
  • exchange/campaign_rpc/pb/goadesign_goagen_injective_campaign_rpc.pb.go is excluded by !**/*.pb.go
Files selected for processing (71)
  • .github/workflows/pre-commit.yml (1 hunks)
  • .github/workflows/run-tests.yml (1 hunks)
  • .golangci.yml (1 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • Makefile (4 hunks)
  • README.md (1 hunks)
  • auth_vote/authz_vote.go (2 hunks)
  • chain/auction/types/codec.go (2 hunks)
  • chain/auction/types/expected_keepers.go (1 hunks)
  • chain/auction/types/key.go (1 hunks)
  • chain/auction/types/params.go (5 hunks)
  • chain/codec/types/types.go (1 hunks)
  • chain/crypto/ethsecp256k1/ethsecp256k1.go (2 hunks)
  • chain/exchange/types/authz_common.go (2 hunks)
  • chain/exchange/types/authz_derivative.go (6 hunks)
  • chain/exchange/types/authz_spot.go (6 hunks)
  • chain/exchange/types/codec.go (5 hunks)
  • chain/exchange/types/common_order.go (3 hunks)
  • chain/exchange/types/common_utils.go (6 hunks)
  • chain/exchange/types/deposit.go (3 hunks)
  • chain/exchange/types/derivative_orders.go (14 hunks)
  • chain/exchange/types/errors.go (2 hunks)
  • chain/exchange/types/events.go (1 hunks)
  • chain/exchange/types/exchange.go (5 hunks)
  • chain/exchange/types/expected_keepers.go (4 hunks)
  • chain/exchange/types/fee_discounts.go (4 hunks)
  • chain/exchange/types/fee_validation.go (1 hunks)
  • chain/exchange/types/key.go (7 hunks)
  • chain/exchange/types/market.go (8 hunks)
  • chain/exchange/types/market_admin.go (1 hunks)
  • chain/exchange/types/msgs.go (23 hunks)
  • chain/exchange/types/orderbook.go (4 hunks)
  • chain/exchange/types/params.go (19 hunks)
  • chain/exchange/types/positions.go (16 hunks)
  • chain/exchange/types/proposal.go (35 hunks)
  • chain/exchange/types/spot_orders.go (7 hunks)
  • chain/exchange/types/stake_grants.go (1 hunks)
  • chain/exchange/types/subaccount.go (2 hunks)
  • chain/exchange/types/trading_rewards.go (2 hunks)
  • chain/exchange/types/volume_record.go (3 hunks)
  • chain/exchange/types/wasm_trade_summary.go (1 hunks)
  • chain/exchange/types/wasm_trades.go (2 hunks)
  • chain/insurance/types/codec.go (2 hunks)
  • chain/insurance/types/expected_keepers.go (1 hunks)
  • chain/insurance/types/msgs.go (1 hunks)
  • chain/insurance/types/params.go (2 hunks)
  • chain/ocr/types/codec.go (3 hunks)
  • chain/ocr/types/expected_keepers.go (2 hunks)
  • chain/ocr/types/hooks.go (2 hunks)
  • chain/ocr/types/types.go (1 hunks)
  • chain/oracle/bandchain/oracle/types/error.go (1 hunks)
  • chain/oracle/types/codec.go (7 hunks)
  • chain/oracle/types/errors.go (1 hunks)
  • chain/oracle/types/expected_keepers.go (1 hunks)
  • chain/oracle/types/key.go (2 hunks)
  • chain/oracle/types/msgs.go (5 hunks)
  • chain/oracle/types/oracle.go (5 hunks)
  • chain/oracle/types/params.go (1 hunks)
  • chain/oracle/types/proposal.go (6 hunks)
  • chain/oracle/types/pyth.go (3 hunks)
  • chain/oracle/types/stork.go (1 hunks)
  • chain/oracle/types/stork_oracle.go (1 hunks)
  • chain/peggy/types/codec.go (3 hunks)
  • chain/peggy/types/ethereum.go (1 hunks)
  • chain/peggy/types/expected_keepers.go (2 hunks)
  • chain/peggy/types/msgs.go (2 hunks)
  • chain/peggy/types/params.go (7 hunks)
  • chain/peggy/types/params_legacy.go (2 hunks)
  • chain/peggy/types/types.go (1 hunks)
  • chain/permissions/types/codec.go (1 hunks)
  • chain/permissions/types/errors.go (1 hunks)
Files skipped from review due to trivial changes (3)
  • README.md
  • chain/ocr/types/types.go
  • chain/oracle/bandchain/oracle/types/error.go
Additional comments not posted (341)
.github/workflows/run-tests.yml (1)

16-17: LGTM!

Using a version file and checking for the latest version enhances flexibility and ensures the workflow uses the most current code.

chain/exchange/types/stake_grants.go (2)

8-13: Function implementation approved.

The NewActiveGrant function correctly initializes and returns a new ActiveGrant object.


15-21: Function implementation approved.

The NewEffectiveGrant function correctly initializes and returns a new EffectiveGrant object.

.github/workflows/pre-commit.yml (3)

12-14: Efficient checkout configuration.

The code checks out the master branch with a fetch depth of 2, which is efficient for the workflow.


17-18: Flexible Go version management.

The Go setup step uses a version file (go.mod) instead of a hardcoded version number, allowing for more flexibility in managing Go versions.


20-20: Updated golangci-lint version.

The golangci-lint tool version has been updated from v1.49.0 to v1.59.0, which may include important bug fixes and improvements.

chain/auction/types/expected_keepers.go (5)

11-11: Standardized context handling for GetAllBalances.

The GetAllBalances method now uses context.Context for the ctx parameter, aligning with broader Go conventions.


12-12: Standardized context handling for SendCoinsFromModuleToModule.

The SendCoinsFromModuleToModule method now uses context.Context for the ctx parameter, aligning with broader Go conventions.


13-13: Standardized context handling for SendCoinsFromModuleToAccount.

The SendCoinsFromModuleToAccount method now uses context.Context for the ctx parameter, aligning with broader Go conventions.


14-14: Standardized context handling for SendCoinsFromAccountToModule.

The SendCoinsFromAccountToModule method now uses context.Context for the ctx parameter, aligning with broader Go conventions.


15-15: Standardized context handling for BurnCoins.

The BurnCoins method now uses context.Context for the ctx parameter, aligning with broader Go conventions.

chain/oracle/types/stork.go (2)

27-29: Verify the definition of EighteenDecimals.

Ensure that EighteenDecimals is correctly defined and used.

Verification successful

The definition of EighteenDecimals is correct and used appropriately.

  • EighteenDecimals is defined as var EighteenDecimals = math.LegacyNewDec(10).Power(18) in chain/oracle/types/oracle.go.
  • This definition correctly represents 10^18, which is a common scaling factor in financial calculations.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition of `EighteenDecimals`.

# Test: Search for the definition. Expect: Correct definition and usage.
rg --type go 'EighteenDecimals'

Length of output: 187


21-25: Verify error handling in PriceState.UpdatePrice.

Ensure that PriceState.UpdatePrice properly handles any potential errors or edge cases.

chain/exchange/types/events.go (3)

19-20: Verify function usage for IsEmpty.

Ensure that all function calls to IsEmpty correctly handle the updated logic.


22-32: Verify function usage for NewEventOrderCancelFail.

Ensure that all function calls to NewEventOrderCancelFail correctly handle the new function.

Verification successful

No issues found with the function NewEventOrderCancelFail.

There are no direct calls to this function in the codebase, indicating it is not currently in use. The function itself appears to be correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewEventOrderCancelFail` handle the new function.

# Test: Search for the function usage. Expect: Correct handling of the new function.
rg --type go 'NewEventOrderCancelFail'

Length of output: 192


Script:

#!/bin/bash
# Description: Verify all references to `EventOrderCancelFail` to ensure there are no indirect usages or references.

# Test: Search for references to `EventOrderCancelFail`. Expect: Correct handling of the new function.
rg --type go 'EventOrderCancelFail'

Length of output: 2931


9-15: Verify function usage with the new parameter cid.

Ensure that all function calls to AddOrderFail correctly pass the cid parameter.

chain/insurance/types/expected_keepers.go (6)

16-16: Verify method usage for SendCoinsFromAccountToModule.

Ensure that all function calls to SendCoinsFromAccountToModule correctly handle the updated context type.


17-17: Verify method usage for MintCoins.

Ensure that all function calls to MintCoins correctly handle the updated context type.

Verification successful

No direct calls to MintCoins were found.

Based on the search results, there are no direct calls to MintCoins in the codebase. Therefore, no further action is needed to handle the updated context type.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `MintCoins` handle the updated context type.

# Test: Search for the method usage. Expect: Correct handling of the updated context type.
rg --type go 'MintCoins'

Length of output: 733


Script:

#!/bin/bash
# Description: Search for actual calls to MintCoins and inspect the context being passed.

# Test: Search for all calls to MintCoins and include context lines for better understanding.
rg --type go 'MintCoins(' -A 3 -B 3

Length of output: 108


Script:

#!/bin/bash
# Description: Search for actual calls to MintCoins and inspect the context being passed.

# Test: Search for all calls to MintCoins and include context lines for better understanding.
rg --type go 'MintCoins\(' -A 3 -B 3

Length of output: 3432


Script:

#!/bin/bash
# Description: Search for actual calls to MintCoins and inspect the context being passed.

# Test: Search for all calls to MintCoins and include more context lines for better understanding.
rg --type go 'MintCoins' -A 5 -B 5

Length of output: 5524


Script:

#!/bin/bash
# Description: Search for all instances of MintCoins being called, including potential indirect calls or usage in different contexts.

# Test: Search for all instances of MintCoins being called and include more context lines for better understanding.
rg --type go 'MintCoins' -A 10 -B 10

Length of output: 8485


12-12: Verify method usage for GetBalance.

Ensure that all function calls to GetBalance correctly handle the updated context type.


19-19: Verify method usage for SetDenomMetaData.

Ensure that all function calls to SetDenomMetaData correctly handle the updated context type.

Verification successful

No usages of the SetDenomMetaData method were found.

The change to the context type does not impact any existing code, as there are no calls to this method in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `SetDenomMetaData` handle the updated context type.

# Test: Search for the method usage. Expect: Correct handling of the updated context type.
rg --type go 'SetDenomMetaData'

Length of output: 360


Script:

#!/bin/bash
# Description: Find all usages of the `SetDenomMetaData` method and inspect the context type being passed.

# Search for all instances where `SetDenomMetaData` is called.
rg --type go 'SetDenomMetaData(' -A 3

Length of output: 124


Script:

#!/bin/bash
# Description: Find all usages of the `SetDenomMetaData` method and inspect the context type being passed.

# Search for all instances where `SetDenomMetaData` is called.
rg --type go 'SetDenomMetaData\(' -A 3

Length of output: 645


Script:

#!/bin/bash
# Description: Find all usages of the `SetDenomMetaData` method and inspect the context type being passed.

# Search for all instances where `SetDenomMetaData` is called.
rg --type go '\.SetDenomMetaData\(' -A 3

Length of output: 42


Script:

#!/bin/bash
# Description: Find all references to the `SetDenomMetaData` method to ensure correct usage.

# Search for any references to `SetDenomMetaData` in the codebase.
rg --type go 'SetDenomMetaData'

Length of output: 360


18-18: Verify method usage for BurnCoins.

Ensure that all function calls to BurnCoins correctly handle the updated context type.


13-13: Verify method usage for GetAllBalances.

Ensure that all function calls to GetAllBalances correctly handle the updated context type.

chain/ocr/types/hooks.go (3)

4-4: Import Approved.

The import statement for cosmossdk.io/math is necessary for the usage of math.LegacyDec.


28-28: Struct Method Signature Change Approved.

The AfterTransmit method in the MultiOcrHooks struct has changed the type of the answer parameter from sdk.Dec to math.LegacyDec.

Ensure that all calls to this method are updated accordingly.

Verification successful

Struct Method Signature Change Approved.

The AfterTransmit method in the MultiOcrHooks struct has changed the type of the answer parameter from sdk.Dec to math.LegacyDec. The method usage has been updated accordingly in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to the `AfterTransmit` method in the `MultiOcrHooks` struct are updated accordingly.

# Test: Search for the method calls. Expect: Only occurrences of the new signature.
rg --type go -A 5 'AfterTransmit(ctx sdk.Context, feedId string, answer math.LegacyDec, timestamp int64)'

Length of output: 107


Script:

#!/bin/bash
# Description: Verify all calls to the `AfterTransmit` method in the `MultiOcrHooks` struct are updated accordingly.

# Test: Search for the old method signature.
rg --type go -A 5 'AfterTransmit(ctx sdk.Context, feedId string, answer sdk.Dec, timestamp int64)'

# Test: Search for the new method signature.
rg --type go -A 5 'AfterTransmit(ctx sdk.Context, feedId string, answer math.LegacyDec, timestamp int64)'

Length of output: 208


Script:

#!/bin/bash
# Description: Verify all calls to the `AfterTransmit` method in the `MultiOcrHooks` struct by searching for the method name alone.

# Test: Search for the method name `AfterTransmit`.
rg --type go 'AfterTransmit'

Length of output: 354


10-10: Interface Method Signature Change Approved.

The AfterTransmit method in the OcrHooks interface has changed the type of the answer parameter from sdk.Dec to math.LegacyDec.

Ensure that all implementations of this interface are updated accordingly.

Verification successful

Interface Method Signature Change Approved.

The AfterTransmit method in the OcrHooks interface has changed the type of the answer parameter from sdk.Dec to math.LegacyDec. The change has been correctly applied to both the interface definition and its implementation in MultiOcrHooks.

  • chain/ocr/types/hooks.go: AfterTransmit method updated in OcrHooks interface and MultiOcrHooks implementation.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all implementations of the `OcrHooks` interface are updated accordingly.

# Test: Search for the interface implementation. Expect: Only occurrences of the new signature.
rg --type go -A 5 'AfterTransmit(ctx sdk.Context, feedId string, answer math.LegacyDec, timestamp int64)'

Length of output: 107


Script:

#!/bin/bash
# Description: Verify all implementations of the `OcrHooks` interface are updated accordingly.

# Test: Search for the old interface implementation signature.
rg --type go -A 5 'AfterTransmit(ctx sdk.Context, feedId string, answer sdk.Dec, timestamp int64)'

# Test: Search for the new interface implementation signature.
rg --type go -A 5 'AfterTransmit(ctx sdk.Context, feedId string, answer math.LegacyDec, timestamp int64)'

Length of output: 208


Script:

#!/bin/bash
# Description: Verify the `OcrHooks` interface definition and any `AfterTransmit` method implementations.

# Test: Search for the `OcrHooks` interface definition.
rg --type go 'interface OcrHooks'

# Test: Search for any `AfterTransmit` method implementations.
rg --type go 'AfterTransmit'

Length of output: 390

.golangci.yml (4)

28-39: Revive Linter Settings Approved.

The revive linter is configured to enable all rules and has a specific rule for variable naming.


40-51: Gocritic Linter Settings Approved.

The gocritic linter is configured to enable specific tags and disable the hugeParam check.


2-4: Verify Intention Behind Disabling Tests.

The run settings disable tests. Ensure this is intentional and does not affect the overall testing strategy.


5-26: Linter Settings Approved.

The linter settings enable common and useful linters.

Verify the reason for disabling the unused linter.

chain/oracle/types/stork_oracle.go (4)

20-22: Function Approved.

The encodePacked function concatenates multiple byte slices and seems to be correctly implemented.


14-18: Function Approved. Verify Hash Generation.

The getMessageHash function generates a hash from the provided parameters and seems to be correctly implemented.

Verify the correctness of the hash generation.

Verification successful

Function Approved.

The getMessageHash function generates a hash from the provided parameters and is correctly implemented. The encodePacked and encodeUint256 functions are also correctly implemented.

  • encodePacked concatenates byte slices.
  • encodeUint256 converts a string to a big-endian 256-bit integer.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the hash generation in the `getMessageHash` function.

# Test: Search for test cases or usage examples. Expect: Correct hash generation.
rg --type go -A 5 'getMessageHash'

Length of output: 891


Script:

#!/bin/bash
# Description: Verify the correctness of the functions used in `getMessageHash`.

# Search for the definition of `encodePacked`.
rg --type go 'func encodePacked'

# Search for the definition of `encodeUint256`.
rg --type go 'func encodeUint256'

# Search for the usage of `crypto.Keccak256Hash`.
rg --type go 'crypto.Keccak256Hash'

Length of output: 2290


Script:

#!/bin/bash
# Extract the implementation of `encodePacked` function.
rg --type go -A 10 'func encodePacked' chain/oracle/types/stork_oracle.go

# Extract the implementation of `encodeUint256` function.
rg --type go -A 10 'func encodeUint256' chain/oracle/types/stork_oracle.go

Length of output: 854


30-39: Function Approved. Verify Signature Verification.

The VerifyStorkMsgSignature function verifies a message signature and seems to be correctly implemented.

Verify the correctness of the signature verification.


24-28: Function Approved. Verify Conversion.

The encodeUint256 function converts a string to a big integer and returns its byte representation and seems to be correctly implemented.

Verify the correctness of the conversion.

chain/exchange/types/trading_rewards.go (3)

Line range hint 44-44:
Verify consistency of function calls.

Ensure that all calls to MergeTradingRewardPoints use math.LegacyDec instead of sdk.Dec.


26-26: Verify consistency of method signature change.

Ensure that all calls to AddPointsForAddress use math.LegacyDec instead of sdk.Dec.

Verification successful

Verify consistency of method signature change.

All calls to AddPointsForAddress correctly use math.LegacyDec as expected.

  • TradingRewardPoints is defined as map[string]math.LegacyDec, ensuring that all values passed to AddPointsForAddress are of the correct type.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `AddPointsForAddress` use `math.LegacyDec` instead of `sdk.Dec`.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'AddPointsForAddress'

Length of output: 1025


Script:

#!/bin/bash
# Description: Verify the types of variables `k` and `v` used in calls to `AddPointsForAddress`.

# Search for the declarations and types of `k` and `v` in the context of their usage.
rg --type go -A 10 -B 10 $'for k, v := range' chain/exchange/types/trading_rewards.go

Length of output: 429


Script:

#!/bin/bash
# Description: Verify the type of `TradingRewardPoints` and its underlying structure.

# Search for the definition and structure of `TradingRewardPoints`.
rg --type go 'type TradingRewardPoints' -A 10

Length of output: 798


6-9: Verify consistency of type change.

Ensure that all instances of sdk.Dec used for TradingRewardPoints are updated to math.LegacyDec throughout the codebase.

Verification successful

Verify complete replacement of sdk.Dec with math.LegacyDec.

Ensure that there are no remaining instances of sdk.Dec in the codebase, particularly in the context of TradingRewardPoints.


Re-verify the complete replacement of sdk.Dec with math.LegacyDec.

Ensure that there are no remaining instances of sdk.Dec in the codebase.


Type change verified successfully.

All instances of sdk.Dec have been replaced with math.LegacyDec throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `sdk.Dec` used for `TradingRewardPoints` are updated to `math.LegacyDec`.

# Test: Search for the type usage. Expect: Only occurrences of the new type.
rg --type go -A 5 $'TradingRewardPoints'

Length of output: 4071


Script:

#!/bin/bash
# Description: Verify that there are no remaining instances of `sdk.Dec` in the codebase.

# Test: Search for any usage of `sdk.Dec`. Expect: No occurrences related to `TradingRewardPoints`.
rg --type go 'sdk.Dec'

Length of output: 22


Script:

#!/bin/bash
# Description: Verify that there are no remaining instances of `sdk.Dec` in the codebase.

# Test: Search for any usage of `sdk.Dec`. Expect: No occurrences.
rg 'sdk.Dec'

Length of output: 12

chain/permissions/types/errors.go (1)

1-24: LGTM!

The error definitions are straightforward and follow the standard pattern.

chain/auction/types/codec.go (4)

17-17: LGTM! The Params struct registration is correctly added.

The addition of Params to the codec registration enhances the codec's capability to handle this type.


36-36: LGTM! The ModuleCdc variable redefinition is correct.

Redefining ModuleCdc to use codec.NewLegacyAmino() simplifies the codec initialization.


40-41: LGTM! The init function updates are correct.

The updates correctly reflect the change in ModuleCdc initialization.


44-44: LGTM! The ModuleCdc.Seal() call is correctly added.

Calling Seal finalizes the codec, preventing further modifications.

chain/exchange/types/volume_record.go (6)

4-4: LGTM! The import statement for math is correct.

The import is necessary for transitioning to math.LegacyDec.


7-9: LGTM! The NewVolumeRecord function signature is correctly updated.

The function now accepts math.LegacyDec for makerVolume and takerVolume.


15-15: LGTM! The NewZeroVolumeRecord function is correctly updated.

The function now uses math.LegacyZeroDec() for consistency with the new data type.


20-24: LGTM! The Add method is correctly updated.

The method now uses math.LegacyZeroDec() for consistency with the new data type.


Line range hint 48-56:
LGTM! The Total method is correctly updated.

The method now returns math.LegacyDec and initializes totalVolume with math.LegacyZeroDec().


59-63: LGTM! The NewVolumeWithSingleType function is correctly updated.

The function now uses math.LegacyDec for its volume parameter and adjusts its calls to NewVolumeRecord accordingly.

chain/oracle/types/pyth.go (4)

4-4: LGTM! The import statement for math is correct.

The import is necessary for transitioning to math.LegacyDec.


10-12: LGTM! The NewPythPriceState function signature is correctly updated.

The function now accepts math.LegacyDec for emaPrice, emaConf, conf, and price.


26-28: LGTM! The Update method of PythPriceState is correctly updated.

The method now uses math.LegacyDec for emaPrice, emaConf, conf, and price.


67-74: LGTM! The GetExponentiatedDec function is correctly updated.

The function now returns math.LegacyDec and uses math.LegacyNewDecWithPrec and math.LegacyNewDec.

chain/insurance/types/codec.go (3)

19-19: New registration for Params structure.

The new registration line for the Params structure is correctly added.


41-41: Update to codec initialization.

The global variable ModuleCdc has been correctly updated to use codec.NewLegacyAmino().


45-47: Changes to init function.

The init function correctly registers the RegisterLegacyAminoCodec with ModuleCdc and updates the codec registration process.

chain/oracle/types/expected_keepers.go (6)

4-5: Addition of context package import.

The context package has been correctly imported to support the changes in the BankKeeper interface.


16-16: Change in GetAllBalances method signature.

The GetAllBalances method now correctly accepts context.Context as the first parameter instead of sdk.Context.


17-17: Change in SendCoinsFromModuleToModule method signature.

The SendCoinsFromModuleToModule method now correctly accepts context.Context as the first parameter instead of sdk.Context.


18-18: Change in SendCoinsFromModuleToAccount method signature.

The SendCoinsFromModuleToAccount method now correctly accepts context.Context as the first parameter instead of sdk.Context.


19-19: Change in SendCoinsFromAccountToModule method signature.

The SendCoinsFromAccountToModule method now correctly accepts context.Context as the first parameter instead of sdk.Context.


20-20: Change in BurnCoins method signature.

The BurnCoins method now correctly accepts context.Context as the first parameter instead of sdk.Context.

chain/permissions/types/codec.go (6)

1-10: Package declaration and import statements.

The package declaration and import statements are correctly added.


14-22: Implementation of RegisterCodec function.

The RegisterCodec function correctly registers several concrete types for the permissions module.


24-35: Implementation of RegisterInterfaces function.

The RegisterInterfaces function correctly registers several implementations for the permissions module.


38-40: Initialization of ModuleCdc.

The global variable ModuleCdc is correctly initialized using codec.NewLegacyAmino().


42-48: Implementation of init function.

The init function correctly registers the codec and seals it.


1-49: New file implementation.

The new file is correctly implemented and follows the required standards.

chain/codec/types/types.go (2)

16-21: LGTM! Struct definition is well-defined.

The EncodingConfig struct contains appropriately typed fields.


23-38: LGTM! Function implementation is correct.

The MakeEncodingConfig function correctly initializes and registers the necessary components.

chain/exchange/types/wasm_trades.go (4)

9-12: LGTM! Struct definition is well-defined.

The PositionTransfer struct contains appropriately typed fields, and the Quantity field type change to math.LegacyDec is appropriate.


53-58: LGTM! Struct definition is well-defined.

The SyntheticTrade struct contains appropriately typed fields, and the field type changes to math.LegacyDec are appropriate.


Line range hint 14-22: LGTM! Method implementation is correct.

The ValidateBasic method correctly validates the Quantity field and subaccount IDs.


Line range hint 60-74: LGTM! Method implementation is correct.

The Validate method correctly validates the Quantity, Price, and Margin fields.

chain/insurance/types/params.go (1)

21-21: LGTM! Constant definition is appropriate.

The MaxUnderwritingAmount constant is correctly initialized using math.NewIntFromString.

chain/exchange/types/subaccount.go (2)

13-14: LGTM! But verify the usage of math.LegacyZeroDec() in the codebase.

The code changes are approved.

However, ensure that all instances of sdk.ZeroDec() have been replaced with math.LegacyZeroDec() for consistency.

Verification successful

All instances of sdk.ZeroDec() have been successfully replaced with math.LegacyZeroDec().

The codebase is consistent with the new function usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `sdk.ZeroDec()` have been replaced with `math.LegacyZeroDec()`.

# Test: Search for the old function. Expect: No occurrences.
rg --type go 'sdk.ZeroDec()'

# Test: Search for the new function. Expect: Multiple occurrences.
rg --type go 'math.LegacyZeroDec()'

Length of output: 5851


29-29: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to NewSubaccountOrder match the new signature.

Verification successful

No issues found with the function usage.

The function NewSubaccountOrder is not currently used anywhere in the codebase, so there are no calls that need to be updated to match the new signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewSubaccountOrder` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go 'NewSubaccountOrder'

Length of output: 240


Script:

#!/bin/bash
# Description: Verify all function calls to `NewSubaccountOrder` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go 'NewSubaccountOrder('

Length of output: 125


Script:

#!/bin/bash
# Description: Verify all function calls to `NewSubaccountOrder` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go 'NewSubaccountOrder\('

Length of output: 140


Script:

#!/bin/bash
# Description: Verify all references to `NewSubaccountOrder` in the codebase.

# Test: Search for the function references. Expect: Any references or assignments to `NewSubaccountOrder`.
rg --type go 'NewSubaccountOrder'

Length of output: 240

chain/exchange/types/fee_validation.go (2)

32-37: LGTM! But verify the usage of math.LegacyDec in the codebase.

The code changes are approved.

However, ensure that all instances of sdk.Dec have been replaced with math.LegacyDec for consistency.


10-26: LGTM! But verify the usage of math.LegacyDec in the codebase.

The code changes are approved.

However, ensure that all instances of sdk.Dec have been replaced with math.LegacyDec for consistency.

Verification successful

Verification successful!

All instances of sdk.Dec have been replaced with math.LegacyDec across the codebase, ensuring consistency.

  • No occurrences of sdk.Dec found.
  • Multiple occurrences of math.LegacyDec found.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `sdk.Dec` have been replaced with `math.LegacyDec`.

# Test: Search for the old type. Expect: No occurrences.
rg --type go 'sdk.Dec'

# Test: Search for the new type. Expect: Multiple occurrences.
rg --type go 'math.LegacyDec'

Length of output: 95439

chain/exchange/types/fee_discounts.go (2)

47-48: LGTM! But verify the usage of math.Int and math.LegacyDec in the codebase.

The code changes are approved.

However, ensure that all instances of sdkmath.Int and sdk.Dec have been replaced with math.Int and math.LegacyDec for consistency.


63-64: LGTM! But verify the usage of math.LegacyDec in the codebase.

The code changes are approved.

However, ensure that all instances of sdk.Dec have been replaced with math.LegacyDec for consistency.

chain/oracle/types/params.go (1)

14-14: Verify the compatibility and impact of using math.LegacyMustNewDecFromStr.

The initialization of LargestDecPrice has been changed from sdk.MustNewDecFromStr to math.LegacyMustNewDecFromStr. Ensure that this change is compatible with the rest of the codebase and that it does not introduce any unintended side effects.

Verification successful

The change to use math.LegacyMustNewDecFromStr is compatible with the rest of the codebase.

The initialization of LargestDecPrice using math.LegacyMustNewDecFromStr is consistent with its usage in the codebase and does not introduce any unintended side effects.

  • The LargestDecPrice is used in chain/oracle/types/msgs.go for comparisons, which is compatible with the new initialization method.
  • The math.LegacyMustNewDecFromStr function is widely used across the codebase, indicating its reliability and integration.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and compatibility of `math.LegacyMustNewDecFromStr` in the codebase.

# Test: Search for the usage of `LargestDecPrice` and `math.LegacyMustNewDecFromStr`. Expect: Ensure compatibility and no unintended side effects.
rg --type go 'LargestDecPrice'
rg --type go 'math.LegacyMustNewDecFromStr'

Length of output: 6017

auth_vote/authz_vote.go (1)

72-72: LGTM! Ensures msgs starts as an empty slice.

The change from var msgs []sdk.Msg to var msgs = make([]sdk.Msg, 0) ensures that msgs starts as an empty slice, preventing potential nil slice issues when appending messages.

chain/ocr/types/codec.go (3)

28-29: LGTM! Registers the new concrete type Params.

The registration of the new concrete type Params with the legacy Amino codec enhances the functionality of the module by allowing it to handle this new type.


61-61: LGTM! Simplifies codec initialization.

The initialization of ModuleCdc has been updated to use codec.NewLegacyAmino() directly, simplifying the codec initialization process and ensuring consistent usage throughout the module.


65-71: LGTM! Ensures correct registration of codecs.

The modifications in the init function ensure that the legacy Amino codec and the crypto codec are registered correctly. The commented-out lines suggest a potential refactor or shift in dependency management.

chain/auction/types/params.go (4)

6-6: LGTM!

The import statement changes are consistent with the transition to the new math library.


17-17: LGTM!

The default value changes align with the new decimal type.


34-34: LGTM!

The function parameter changes are consistent with the transition to the new math library's types.


Line range hint 85-98:
LGTM!

The validation logic changes ensure consistency with the new decimal type.

chain/exchange/types/deposit.go (7)

14-15: LGTM!

The constructor updates reflect the shift in the underlying mathematical representation used for balance calculations.


28-29: LGTM!

The data structure modifications are consistent with the transition to the new decimal type.


32-32: LGTM!

The constructor updates for DepositDelta align with the new data structure definition.


40-40: LGTM!

The constructor updates for NewDepositDelta are consistent with the transition to the new decimal type.


43-43: LGTM!

The method adjustments for AddAvailableBalance ensure consistency with the new decimal type.


77-77: LGTM!

The method adjustments for ApplyUniformDelta ensure consistency with the new decimal type.


81-81: LGTM!

The method adjustments for ApplyDelta ensure consistency with the new decimal type.

chain/peggy/types/expected_keepers.go (5)

4-4: LGTM!

The import statement changes are consistent with the transition to using context.Context.


18-31: LGTM!

The method signature changes for StakingKeeper enhance error handling and context management.


36-43: LGTM!

The method signature changes for BankKeeper enhance context management.


47-47: LGTM!

The method signature changes for SlashingKeeper enhance error handling.


51-53: LGTM!

The method signature changes for DistributionKeeper enhance context management.

chain/exchange/types/market_admin.go (5)

14-14: LGTM!

The MaxPerm constant is correctly defined as a bitwise OR of all permission flags.


16-16: LGTM!

The MarketAdminPermissions type definition is appropriate for representing permission flags.


18-20: LGTM!

The HasPerm function is correctly implemented for checking permission flags.


70-75: LGTM!

The EmptyAdminInfo function is correctly implemented to return an empty AdminInfo struct.


22-40: Fix typographical errors in constant names.

The function uses constants InitialMarginRationPerm and MaintenanceMarginRationPerm which have typographical errors. They should be InitialMarginRatioPerm and MaintenanceMarginRatioPerm.

-	if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRationPerm) {
+	if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRatioPerm) {
-	if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRationPerm) {
+	if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRatioPerm) {

Likely invalid or redundant comment.

chain/peggy/types/codec.go (2)

38-39: LGTM!

The RegisterInterfaces and RegisterLegacyAminoCodec functions are correctly implemented to register the necessary interfaces and codecs. The new message types MsgBlacklistEthereumAddresses and MsgRevokeEthereumBlacklist are correctly registered.

Also applies to: 74-75


18-20: Verify the necessity of commented-out codec registrations.

The govcdc.Amino and groupcdc.Amino codec registrations are commented out with a TODO comment. Verify if these registrations are no longer necessary or if they need to be included.

Verification successful

The commented-out codec registrations for govcdc.Amino and groupcdc.Amino are not necessary.

The search results show that govcdc and groupcdc are only referenced in commented-out lines for registering legacy Amino codecs, with no active dependencies or usage in the codebase.

  • chain/wasmx/types/codec.go
  • chain/oracle/types/codec.go
  • chain/peggy/types/codec.go
  • chain/ocr/types/codec.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the necessity of commented-out codec registrations.

# Test: Search for the usage of `govcdc.Amino` and `groupcdc.Amino` in the codebase. Expect: No usage if they are no longer necessary.
rg --type go 'govcdc\.Amino|groupcdc\.Amino'

Length of output: 612


Script:

#!/bin/bash
# Description: Search for any dependencies or references to `govcdc.Amino` and `groupcdc.Amino` beyond the commented-out lines.

# Test: Search for any usage of `govcdc` and `groupcdc` in the codebase to check for potential dependencies.
rg --type go 'govcdc|groupcdc'

Length of output: 598

chain/oracle/types/oracle.go (8)

17-17: LGTM!

The MaxStorkTimestampIntervalNano constant is correctly defined to represent a 500-millisecond interval.


19-19: LGTM!

The EighteenDecimals variable is correctly defined to represent 10^18.


38-39: LGTM!

The GetOracleType function is correctly updated to include the new oracle type "stork".


55-58: LGTM!

The GetDecPrice function is correctly updated to use math.LegacyDec for price calculations.


61-64: LGTM!

The NewPriceState function is correctly updated to use math.LegacyDec for price state initialization.


69-72: LGTM!

The NewProviderPriceState function is correctly updated to use math.LegacyDec for provider price state initialization.


76-77: LGTM!

The UpdatePrice function is correctly updated to use math.LegacyDec for price updates.


113-114: LGTM!

The CheckPriceFeedThreshold function is correctly updated to use math.LegacyDec for price threshold checks.

chain/exchange/types/wasm_trade_summary.go (2)

13-17: Verify the usage of MarketSummary fields in the codebase.

The fields of the MarketSummary struct have been changed from sdk.Dec to math.LegacyDec. Ensure that all necessary changes have been made to accommodate this new type throughout the codebase.


22-26: Verify the initialization of MarketSummary fields in the codebase.

The initialization of MarketSummary fields has been changed from sdk.ZeroDec() to math.LegacyZeroDec(). Ensure that all necessary changes have been made to accommodate this new type throughout the codebase.

Verification successful

The initialization of MarketSummary fields has been correctly updated to use math.LegacyZeroDec() throughout the codebase.

The search results confirm that math.LegacyZeroDec() is being used consistently, and no occurrences of sdk.ZeroDec() were found. The necessary changes have been made to accommodate the new type.

  • chain/auction/types/params.go
  • chain/oracle/types/oracle.go
  • chain/exchange/types/fee_discounts.go
  • chain/exchange/types/volume_record.go
  • chain/exchange/types/wasm_trade_summary.go
  • chain/exchange/types/subaccount.go
  • chain/exchange/types/spot_orders.go
  • chain/exchange/types/proposal.go
  • chain/exchange/types/orderbook.go
  • chain/exchange/types/positions.go
  • chain/exchange/types/deposit.go
  • chain/exchange/types/derivative_orders.go
  • chain/exchange/types/common_utils.go
  • chain/exchange/types/common_order.go
  • chain/exchange/types/msgs.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization of `MarketSummary` fields in the codebase.

# Test: Search for the initialization of `MarketSummary` fields. Expect: No occurrences of `sdk.ZeroDec()` for these fields.
rg --type go -A 5 $'math.LegacyZeroDec()'

Length of output: 19509

chain/exchange/types/orderbook.go (4)

48-48: Verify the initialization of lowestSellPrice.

The initialization of lowestSellPrice has been changed from sdk.ZeroDec() to math.LegacyZeroDec(). Ensure that all necessary changes have been made to accommodate this new type throughout the codebase.

Verification successful

Initialization of lowestSellPrice verified.

The initialization of lowestSellPrice has been correctly updated from sdk.ZeroDec() to math.LegacyZeroDec() throughout the codebase.

  • Instances of math.LegacyZeroDec() found in relevant files, ensuring consistency.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization of `lowestSellPrice` in the codebase.

# Test: Search for the initialization of `lowestSellPrice`. Expect: No occurrences of `sdk.ZeroDec()` for this variable.
rg --type go -A 5 $'math.LegacyZeroDec()'

Length of output: 19509


151-155: Verify the usage of GetPrice and GetQuantity methods.

The return types of GetPrice and GetQuantity methods have been updated to return math.LegacyDec instead of sdk.Dec. Ensure that all necessary changes have been made to accommodate this new type throughout the codebase.


144-144: Verify the usage of NewLevel.

The function signature has been updated to accept parameters of type math.LegacyDec instead of sdk.Dec. Ensure that all necessary changes have been made to accommodate this new type throughout the codebase.


129-129: Verify the usage of getReadableDec.

The function signature has been updated to accept a parameter of type math.LegacyDec instead of sdk.Dec. Ensure that all necessary changes have been made to accommodate this new type throughout the codebase.

Verification successful

Verify the types of variables passed to getReadableDec.

Ensure that the variables buyLevelsSorted[idx].P, buyLevelsSorted[idx].Q, sellLevelsSorted[idx].P, d.AvailableBalance, and d.TotalBalance are of type math.LegacyDec.


Verify the definition of the Level struct to ensure P and Q are of type math.LegacyDec.


Verified the usage of getReadableDec.

The function getReadableDec has been correctly updated to use math.LegacyDec. All instances where this function is called are passing variables of type math.LegacyDec, ensuring consistency throughout the codebase.

  • buyLevelsSorted[idx].P and buyLevelsSorted[idx].Q are of type math.LegacyDec.
  • sellLevelsSorted[idx].P and sellLevelsSorted[idx].Q are of type math.LegacyDec.
  • d.AvailableBalance and d.TotalBalance are of type math.LegacyDec.

No further changes are necessary.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `getReadableDec` in the codebase.

# Test: Search for the usage of `getReadableDec`. Expect: No occurrences of `sdk.Dec` type for this function.
rg --type go -A 5 $'getReadableDec'

Length of output: 1676


Script:

#!/bin/bash
# Verify the types of variables passed to `getReadableDec`.

# Check the type of `buyLevelsSorted[idx].P` and `buyLevelsSorted[idx].Q` in `orderbook.go`
rg --type go 'buyLevelsSorted' -A 10 chain/exchange/types/orderbook.go

# Check the type of `sellLevelsSorted[idx].P` and `sellLevelsSorted[idx].Q` in `orderbook.go`
rg --type go 'sellLevelsSorted' -A 10 chain/exchange/types/orderbook.go

# Check the type of `d.AvailableBalance` and `d.TotalBalance` in `deposit.go`
rg --type go 'AvailableBalance' -A 10 chain/exchange/types/deposit.go

Length of output: 5064


Script:

#!/bin/bash
# Verify the definition of the `Level` struct to ensure `P` and `Q` are of type `math.LegacyDec`.

# Search for the definition of the `Level` struct in the codebase.
rg --type go 'type Level struct' -A 10

Length of output: 917

chain/oracle/types/errors.go (4)

47-47: LGTM!

The addition of ErrBadStorkMessageTimestamp enhances error handling for Stork messages.


48-48: LGTM!

The addition of ErrEmptyStorkSender enhances error handling for Stork messages.


49-49: LGTM!

The addition of ErrInvalidStorkSignature enhances error handling for Stork messages.


50-50: LGTM!

The addition of ErrStorkAssetIdNotUnique enhances error handling for Stork messages.

chain/oracle/types/codec.go (7)

24-24: Register new message type MsgRelayStorkPrices.

The new message type MsgRelayStorkPrices has been registered correctly.


36-37: Register new proposal types GrantStorkPublisherPrivilegeProposal and RevokeStorkPublisherPrivilegeProposal.

The new proposal types GrantStorkPublisherPrivilegeProposal and RevokeStorkPublisherPrivilegeProposal have been registered correctly.


38-38: Register new struct Params.

The new struct Params has been registered correctly.


49-49: Register new message type MsgRelayStorkPrices.

The new message type MsgRelayStorkPrices has been registered correctly.


63-64: Register new proposal types GrantStorkPublisherPrivilegeProposal and RevokeStorkPublisherPrivilegeProposal.

The new proposal types GrantStorkPublisherPrivilegeProposal and RevokeStorkPublisherPrivilegeProposal have been registered correctly.


90-92: Verify the TODO comment.

The TODO comment indicates a need to check the commented-out lines. Ensure that these lines are addressed in future changes.


81-81: Verify compatibility of the new interface registry.

The ModuleCdc variable now uses injcodectypes.NewInterfaceRegistry(). Ensure that this change is compatible with the rest of the codebase.

chain/exchange/types/expected_keepers.go (10)

4-4: Import context package.

The context package has been imported correctly.


32-32: Add new method GetPricePairState.

The new method GetPricePairState has been added correctly.


31-31: Update return type of GetPrice method.

The return type of the GetPrice method has been updated to *sdkmath.LegacyDec. Ensure that this change is compatible with the rest of the codebase.


58-58: Update context parameter type of GetParams method.

The context parameter type of the GetParams method has been updated to context.Context. Ensure that this change is compatible with the rest of the codebase.


36-36: Update return type of GetStandardDeviationForPriceRecords method.

The return type of the GetStandardDeviationForPriceRecords method has been updated to *sdkmath.LegacyDec. Ensure that this change is compatible with the rest of the codebase.

Verification successful

No compatibility issues found with the updated return type of GetStandardDeviationForPriceRecords.

  • The method GetStandardDeviationForPriceRecords is only defined and not used elsewhere in the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the updated return type.

# Test: Search for the usage of `GetStandardDeviationForPriceRecords`. Expect: No compatibility issues.
rg --type go -A 5 $'GetStandardDeviationForPriceRecords'

Length of output: 654


Script:

#!/bin/bash
# Description: Search for all occurrences of the `GetStandardDeviationForPriceRecords` method in the codebase to verify its usage and ensure compatibility.

# Test: Search for the usage of `GetStandardDeviationForPriceRecords`. Expect: No compatibility issues.
rg 'GetStandardDeviationForPriceRecords'

Length of output: 178


33-33: Update return type of GetCumulativePrice method.

The return type of the GetCumulativePrice method has been updated to *sdkmath.LegacyDec. Ensure that this change is compatible with the rest of the codebase.

Verification successful

No compatibility issues found with the updated return type of GetCumulativePrice method.

  • The method GetCumulativePrice in chain/exchange/types/expected_keepers.go is not referenced elsewhere in the codebase, ensuring that the change in its return type to *sdkmath.LegacyDec does not affect other parts of the code.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the updated return type.

# Test: Search for the usage of `GetCumulativePrice`. Expect: No compatibility issues.
rg --type go -A 5 $'GetCumulativePrice'

Length of output: 1683


Script:

#!/bin/bash
# Description: Verify the compatibility of the updated return type by searching for all usages of `GetCumulativePrice`.

# Test: Search for all usages of `GetCumulativePrice` in the codebase to ensure compatibility.
rg --type go 'GetCumulativePrice'

Length of output: 348


57-57: Update context parameter type of IterateActiveProposalsQueue method.

The context parameter type of the IterateActiveProposalsQueue method has been updated to context.Context. Ensure that this change is compatible with the rest of the codebase.

Verification successful

No compatibility issues found with the updated context parameter type of IterateActiveProposalsQueue method.

The method IterateActiveProposalsQueue is not used elsewhere in the codebase, indicating that the change to the context parameter type does not introduce any compatibility issues.

  • chain/exchange/types/expected_keepers.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the updated context parameter type.

# Test: Search for the usage of `IterateActiveProposalsQueue`. Expect: No compatibility issues.
rg --type go -A 5 $'IterateActiveProposalsQueue'

Length of output: 539


Script:

#!/bin/bash
# Description: Search for all occurrences of `IterateActiveProposalsQueue` in the codebase to verify compatibility.

# Test: Find all usages of `IterateActiveProposalsQueue`. Expect: No compatibility issues.
rg 'IterateActiveProposalsQueue' --type go

Length of output: 195


Script:

#!/bin/bash
# Description: Search for all interfaces and implementations that might include or call `IterateActiveProposalsQueue`.

# Test: Find all interfaces and implementations that might include or call `IterateActiveProposalsQueue`. Expect: No compatibility issues.
rg 'IterateActiveProposalsQueue' --type go

Length of output: 195


68-68: Update return type and context parameter type of GetDelegatorDelegations method.

The GetDelegatorDelegations method now returns an additional error type and uses context.Context. Ensure that this change is compatible with the rest of the codebase.

Verification successful

Update return type and context parameter type of GetDelegatorDelegations method.

The GetDelegatorDelegations method now returns an additional error type and uses context.Context. Based on the comprehensive search, there are no compatibility issues found in the codebase.

  • No usage instances of GetDelegatorDelegations were found.
  • No references to the StakingKeeper interface were found that could indirectly use this method.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the updated return type and context parameter type.

# Test: Search for the usage of `GetDelegatorDelegations`. Expect: No compatibility issues.
rg --type go -A 5 $'GetDelegatorDelegations'

Length of output: 616


Script:

#!/bin/bash
# Description: Perform a comprehensive search for the usage of `GetDelegatorDelegations` to ensure compatibility.

# Search for the usage of `GetDelegatorDelegations` across the entire codebase.
rg 'GetDelegatorDelegations' --type go -A 10

Length of output: 895


Script:

#!/bin/bash
# Description: Search for references to the `StakingKeeper` interface to ensure there are no indirect usages of the `GetDelegatorDelegations` method.

# Search for references to the `StakingKeeper` interface across the entire codebase.
rg 'StakingKeeper' --type go -A 10

Length of output: 2391


38-38: Update return type of GetProviderPrice method.

The return type of the GetProviderPrice method has been updated to *sdkmath.LegacyDec. Ensure that this change is compatible with the rest of the codebase.


69-69: Update return type and context parameter type of Validator method.

The Validator method now returns an additional error type and uses context.Context. Ensure that this change is compatible with the rest of the codebase.

Makefile (6)

5-5: Create new directory exchange/health_rpc.

The new directory exchange/health_rpc has been created correctly.


19-20: Copy additional files to exchange/health_rpc and exchange/accounts_rpc.

The additional files have been copied correctly.


39-40: Copy additional files to chain/codec/types.

The additional files have been copied correctly.


54-55: Copy additional files to chain/permissions/types.

The additional files have been copied correctly.


58-59: Copy additional files to chain/wasmx/types.

The additional files have been copied correctly.


61-63: Copy additional files to chain/stream/types and chain/types.

The additional files have been copied correctly.

chain/exchange/types/authz_common.go (1)

44-44: LGTM! But verify the function usage in the codebase.

The change to use context.Context instead of sdk.Context is approved.

However, ensure that all function calls to BatchUpdateOrdersAuthz.Accept match the new signature.

chain/peggy/types/ethereum.go (1)

65-65: LGTM! But verify the function usage in the codebase.

The change to use math.NewIntFromUint64 instead of sdk.NewIntFromUint64 is approved.

However, ensure that all function calls to NewERC20Token are compatible with the new implementation.

Verification successful

The function usage is compatible with the new implementation.

The NewERC20Token function is correctly utilizing math.NewIntFromUint64 within the file chain/peggy/types/ethereum.go. No issues were found with its usage in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewERC20Token` are compatible with the new implementation.

# Test: Search for the function usage. Expect: Only occurrences of the new implementation.
rg --type go -A 5 $'NewERC20Token'

Length of output: 750

chain/exchange/types/common_order.go (3)

16-29: LGTM! But verify the function usage in the codebase.

The change to use math.LegacyDec instead of sdk.Dec for the price and quantity parameters and return type is approved.

However, ensure that all function calls to GetRequiredBinaryOptionsOrderMargin are compatible with the new implementation.

Verification successful

Verified: Function usage is compatible with the new implementation.

The price and quantity variables passed to GetRequiredBinaryOptionsOrderMargin are correctly typed as math.LegacyDec in the chain/exchange/types/msgs.go file. No further changes are necessary.

  • chain/exchange/types/msgs.go:
    • price and quantity are declared as math.LegacyDec.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `GetRequiredBinaryOptionsOrderMargin` are compatible with the new implementation.

# Test: Search for the function usage. Expect: Only occurrences of the new implementation.
rg --type go -A 5 $'GetRequiredBinaryOptionsOrderMargin'

Length of output: 1435


Script:

#!/bin/bash
# Description: Verify the types of `price` and `quantity` arguments passed to `GetRequiredBinaryOptionsOrderMargin` in `chain/exchange/types/msgs.go`.

# Search for the declarations of `price` and `quantity` in the `chain/exchange/types/msgs.go` file.
rg --type go -A 5 'price' chain/exchange/types/msgs.go
rg --type go -A 5 'quantity' chain/exchange/types/msgs.go

Length of output: 4128


75-75: LGTM! But verify the function usage in the codebase.

The change to use math.LegacyDec instead of sdk.Dec for the fee parameter and return type is approved.

However, ensure that all function calls to GetFeeAmount are compatible with the new implementation.

Verification successful

Function usage verified!

The function calls to GetFeeAmount in spot_orders.go are compatible with the new implementation using math.LegacyDec.

  • market.MakerFeeRate and market.TakerFeeRate are of type math.LegacyDec.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `GetFeeAmount` are compatible with the new implementation.

# Test: Search for the function usage. Expect: Only occurrences of the new implementation.
rg --type go -A 5 $'GetFeeAmount'

Length of output: 1321


Script:

#!/bin/bash
# Description: Verify the types of `market.MakerFeeRate` and `market.TakerFeeRate` to ensure compatibility with `math.LegacyDec`.

# Search for the declarations of `market.MakerFeeRate` and `market.TakerFeeRate`.
rg --type go 'MakerFeeRate|TakerFeeRate'

Length of output: 36847


71-71: LGTM! But verify the function usage in the codebase.

The change to use math.LegacyDec instead of sdk.Dec for the return type is approved.

However, ensure that all function calls to GetNotional are compatible with the new implementation.

chain/oracle/types/key.go (2)

62-64: LGTM!

The constants StorkPriceKey and StorkPublisherKey are defined correctly.


116-118: LGTM!

The function GetStorkPriceStoreKey is implemented correctly and follows the existing pattern.

chain/exchange/types/exchange.go (13)

6-6: LGTM!

The import of math from cosmossdk.io is necessary for the changes in data types.


19-19: LGTM!

The change of MarkPrice to math.LegacyDec ensures consistency in handling decimal values.


49-49: LGTM!

The change of Points to math.LegacyDec ensures consistency in handling decimal values.


Line range hint 52-56:
LGTM!

The change of the return type of GetMultiplier to math.LegacyDec ensures consistency in handling decimal values.


61-63: LGTM!

The change of the return types of GetPrice, GetQuantity, and GetFillable to math.LegacyDec ensures consistency in handling decimal values.


71-71: LGTM!

The change of the return type of GetMargin to math.LegacyDec ensures consistency in handling decimal values.


78-80: LGTM!

The change of the parameter types of SetPrice, SetQuantity, and SetMargin to math.LegacyDec ensures consistency in handling decimal values.


85-111: LGTM!

The changes to the methods of DerivativeOrder ensure consistency in handling decimal values by using math.LegacyDec.


117-144: LGTM!

The changes to the methods of DerivativeLimitOrder ensure consistency in handling decimal values by using math.LegacyDec.


150-174: LGTM!

The changes to the methods of DerivativeMarketOrder ensure consistency in handling decimal values by using math.LegacyDec.


184-194: LGTM!

The changes to the methods of SpotOrder ensure consistency in handling decimal values by using math.LegacyDec.


187-197: LGTM!

The changes to the methods of SpotLimitOrder ensure consistency in handling decimal values by using math.LegacyDec.


190-210: LGTM!

The changes to the methods of SpotMarketOrder ensure consistency in handling decimal values by using math.LegacyDec.

chain/crypto/ethsecp256k1/ethsecp256k1.go (2)

10-15: LGTM!

The reorganization of imports enhances readability and does not affect functionality.


198-198: LGTM!

The change to directly truncate the signature to the first 64 bytes simplifies the logic and ensures only the R and S components are retained.

chain/peggy/types/params_legacy.go (1)

106-106: Ensure validateAdmins function is implemented correctly.

The new parameter ParamStoreAdmins is integrated correctly in the ParamSetPairs method. However, ensure that the validateAdmins function is implemented correctly to validate the admin-related settings.

Verification successful

The validateAdmins function is implemented correctly.

The validateAdmins function is found in both chain/peggy/types/params.go and chain/exchange/types/params.go. It correctly validates the admin addresses by ensuring the input is a slice of strings and converting each string to an address, handling errors appropriately.

  • chain/peggy/types/params.go
  • chain/exchange/types/params.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the validateAdmins function.

# Test: Search for the implementation of the validateAdmins function. Expect: The function should be implemented correctly.
rg --type go 'func validateAdmins' -A 10

Length of output: 1230

chain/insurance/types/msgs.go (1)

64-65: Validation logic for Ticker field updated correctly.

The updated validation logic for the Ticker field is correct, allowing a maximum length of 40 characters. The error message is clear and reflects the new validation rule.

chain/exchange/types/authz_spot.go (5)

4-4: Import of context package is necessary and correctly placed.

The import of the context package is necessary to support the changes in the method signatures and is correctly placed.


24-24: Context type change in Accept method of CreateSpotLimitOrderAuthz is appropriate.

The change from sdk.Context to context.Context is consistent with the context management approach and does not affect the method logic.


64-64: Context type change in Accept method of CreateSpotMarketOrderAuthz is appropriate.

The change from sdk.Context to context.Context is consistent with the context management approach and does not affect the method logic.


104-104: Context type change in Accept method of BatchCreateSpotLimitOrdersAuthz is appropriate.

The change from sdk.Context to context.Context is consistent with the context management approach and does not affect the method logic.


146-146: Context type change in Accept methods of CancelSpotOrderAuthz and BatchCancelSpotOrdersAuthz is appropriate.

The change from sdk.Context to context.Context is consistent with the context management approach and does not affect the method logic.

Also applies to: 186-186

chain/exchange/types/authz_derivative.go (5)

Line range hint 24-34:
LGTM! The context parameter type change is appropriate.

The change from sdk.Context to context.Context aligns with Go's standard practices for context handling.


Line range hint 64-74:
LGTM! The context parameter type change is appropriate.

The change from sdk.Context to context.Context aligns with Go's standard practices for context handling.


Line range hint 104-116:
LGTM! The context parameter type change is appropriate.

The change from sdk.Context to context.Context aligns with Go's standard practices for context handling.


Line range hint 146-156:
LGTM! The context parameter type change is appropriate.

The change from sdk.Context to context.Context aligns with Go's standard practices for context handling.


Line range hint 186-198:
LGTM! The context parameter type change is appropriate.

The change from sdk.Context to context.Context aligns with Go's standard practices for context handling.

chain/exchange/types/spot_orders.go (8)

Line range hint 15-23:
LGTM!

The function signature has been correctly updated to use math.LegacyDec for balanceHold.


Line range hint 89-97:
LGTM!

The function signature has been correctly updated to use math.LegacyDec for minPriceTickSize and minQuantityTickSize.


99-105: LGTM!

The new function CheckNotional correctly calculates the order's notional value and checks it against a minimum notional requirement.


139-140: LGTM!

The function signature has been correctly updated to return math.LegacyDec.


142-144: LGTM!

The function signature has been correctly updated to use math.LegacyDec for fee and return math.LegacyDec.


Line range hint 146-166:
LGTM!

The function signature has been correctly updated to return balanceHold as math.LegacyDec.


Line range hint 168-184:
LGTM!

The function signature has been correctly updated to return balanceHold as math.LegacyDec.


203-213: LGTM!

The function signature has been correctly updated to use math.LegacyDec for feeRate and bestPrice, and return math.LegacyDec.

chain/peggy/types/params.go (3)

28-36: LGTM!

The function has been correctly updated to use math.LegacyNewDec for slashing fractions and the addition of the Admins parameter is correctly handled.


102-104: LGTM!

The function has been correctly updated to include validation for the Admins parameter.


301-322: LGTM!

The new function validateAdmins correctly validates the Admins parameter, ensuring that admin addresses are unique and correctly formatted.

chain/exchange/types/common_utils.go (12)

41-42: LGTM!

The FillQuantity field has been correctly updated to use math.LegacyDec.


46-47: LGTM!

The FillQuantity and CancelQuantity fields have been correctly updated to use math.LegacyDec.


52-53: LGTM!

The FillQuantity field has been correctly updated to use math.LegacyDec.


55-57: LGTM!

The function signature has been correctly updated to return math.LegacyDec.


67-68: LGTM!

The function signature has been correctly updated to return math.LegacyDec.


71-73: LGTM!

The function signature has been correctly updated to return math.LegacyDec.


Line range hint 170-181:
LGTM!

The function signature has been correctly updated to use math.LegacyDec for value and minTickSize.


305-306: LGTM!

The function signature has been correctly updated to use math.LegacyDec for dec.


309-314: LGTM!

The function signature has been correctly updated to return math.LegacyDec.


317-319: LGTM!

The new function IntToIntBytes correctly converts math.Int to byte array.


321-323: LGTM!

The new function IntBytesToInt correctly converts byte array to math.Int.


167-168: LGTM!

The function has been correctly updated to use the new regex variable hexRegex.

chain/exchange/types/codec.go (4)

47-48: New message types registered.

The new message types MsgUpdateSpotMarket and MsgUpdateDerivativeMarket are correctly registered.


180-180: Simplified codec initialization.

The initialization of ModuleCdc using codec.NewLegacyAmino() is correct and simplifies the code.


184-185: Updated codec registration in init function.

The RegisterLegacyAminoCodec function is correctly called with ModuleCdc, following the new initialization method.


188-188: Codec sealing.

The ModuleCdc.Seal() method is correctly called to seal the codec.

chain/exchange/types/errors.go (2)

33-33: Renamed error variable.

The error variable ErrInsufficientOrderMargin is correctly renamed to ErrInsufficientMargin.


107-111: New error variables added.

The new error variables ErrInvalidNotional, ErrStaleOraclePrice, ErrInvalidStakeGrant, ErrInsufficientStake, and ErrInvalidPermissions are correctly defined.

chain/oracle/types/msgs.go (7)

26-26: New message type added.

The new message type MsgRelayStorkPrices is correctly defined.


321-321: Route method added.

The Route method for MsgRelayStorkPrices is correctly implemented.


324-324: Type method added.

The Type method for MsgRelayStorkPrices is correctly implemented.


327-365: ValidateBasic method added.

The ValidateBasic method for MsgRelayStorkPrices is correctly implemented and includes robust validation logic.


369-371: GetSignBytes method added.

The GetSignBytes method for MsgRelayStorkPrices is correctly implemented.


374-379: GetSigners method added.

The GetSigners method for MsgRelayStorkPrices is correctly implemented.


387-401: Utility function added.

The utility function ConvertTimestampToNanoSecond is correctly implemented and follows best practices.

chain/exchange/types/positions.go (23)

8-9: LGTM! Transition to math.LegacyDec.

The changes to the positionPayout struct fields Payout and PnlNotional are approved.


36-43: LGTM! Transition to math.LegacyDec.

The changes to the NewPosition function parameters and internal logic are approved.


Line range hint 51-55:
LGTM! Transition to math.LegacyDec.

The changes to the GetEffectiveMarginRatio function parameters and return type are approved.


Line range hint 67-74:
LGTM! Transition to math.LegacyDec.

The changes to the ApplyProfitHaircutForDerivatives function parameters and internal logic are approved.


82-87: LGTM! Transition to math.LegacyDec.

The changes to the ApplyTotalPositionPayoutHaircut function parameters and internal logic are approved.


Line range hint 89-101:
LGTM! Transition to math.LegacyDec.

The changes to the ApplyProfitHaircutForBinaryOptions function parameters and internal logic are approved.


105-124: LGTM! Transition to math.LegacyDec.

The changes to the ClosePositionWithSettlePrice function parameters, return type, and internal logic are approved.


135-137: LGTM! Transition to math.LegacyDec.

The changes to the ClosePositionByRefunding function parameters, return type, and internal logic are approved.


Line range hint 149-164:
LGTM! Transition to math.LegacyDec.

The changes to the CheckValidPositionToReduce function parameters and internal logic are approved.


170-185: LGTM! Transition to math.LegacyDec.

The changes to the checkValidClosingPrice function parameters and internal logic are approved.


Line range hint 191-198:
LGTM! Transition to math.LegacyDec.

The changes to the GetLiquidationMarketOrderWorstPrice function parameters and return type are approved.


202-203: LGTM! Transition to math.LegacyDec.

The changes to the GetBankruptcyPrice function parameters and return type are approved.


206-207: LGTM! Transition to math.LegacyDec.

The changes to the GetBankruptcyPriceWithAddedMargin function parameters and return type are approved.


210-211: LGTM! Transition to math.LegacyDec.

The changes to the GetLiquidationPrice function parameters and return type are approved.


214-227: LGTM! Transition to math.LegacyDec.

The changes to the getLiquidationPriceWithAddedMargin function parameters and internal logic are approved.


230-238: LGTM! Transition to math.LegacyDec.

The changes to the GetEffectiveMargin function parameters and internal logic are approved.


253-254: LGTM! Transition to math.LegacyDec.

The changes to the getFundingAdjustedMargin function parameters and internal logic are approved.


Line range hint 257-270:
LGTM! Transition to math.LegacyDec.

The changes to the getFundingAdjustedMarginWithAddedMargin function parameters and internal logic are approved.


276-281: LGTM! Transition to math.LegacyDec.

The changes to the getFundingAdjustedUnitMarginWithAddedMargin function parameters and internal logic are approved.


284-287: LGTM! Transition to math.LegacyDec.

The changes to the GetAverageWeightedEntryPrice function parameters and return type are approved.


Line range hint 291-303:
LGTM! Transition to math.LegacyDec.

The changes to the GetPayoutIfFullyClosing function parameters, return type, and internal logic are approved.


Line range hint 309-322:
LGTM! Transition to math.LegacyDec.

The changes to the GetPayoutFromPnl function parameters, return type, and internal logic are approved.


Line range hint 325-389:
LGTM! Transition to math.LegacyDec.

The changes to the ApplyPositionDelta function parameters, return type, and internal logic are approved.

chain/oracle/types/proposal.go (12)

30-31: LGTM! New proposal type constants.

The new constants ProposalTypeGrantStorkPublisherPrivilege and ProposalTypeRevokeStorkPublisherPrivilege are approved.


44-45: LGTM! Register new proposal types.

The changes to the init function to register the new proposal types are approved.


428-430: LGTM! New method GetTitle for GrantStorkPublisherPrivilegeProposal.

The new method GetTitle is approved.


432-435: LGTM! New method GetDescription for GrantStorkPublisherPrivilegeProposal.

The new method GetDescription is approved.


437-439: LGTM! New method ProposalRoute for GrantStorkPublisherPrivilegeProposal.

The new method ProposalRoute is approved.


441-443: LGTM! New method ProposalType for GrantStorkPublisherPrivilegeProposal.

The new method ProposalType is approved.


446-454: LGTM! New method ValidateBasic for GrantStorkPublisherPrivilegeProposal.

The new method ValidateBasic is approved.


457-459: LGTM! New method GetTitle for RevokeStorkPublisherPrivilegeProposal.

The new method GetTitle is approved.


461-464: LGTM! New method GetDescription for RevokeStorkPublisherPrivilegeProposal.

The new method GetDescription is approved.


466-468: LGTM! New method ProposalRoute for RevokeStorkPublisherPrivilegeProposal.

The new method ProposalRoute is approved.


470-472: LGTM! New method ProposalType for RevokeStorkPublisherPrivilegeProposal.

The new method ProposalType is approved.


475-483: LGTM! New method ValidateBasic for RevokeStorkPublisherPrivilegeProposal.

The new method ValidateBasic is approved.

chain/exchange/types/derivative_orders.go (12)

Line range hint 14-37:
LGTM! Transition to math.LegacyDec.

The changes to the NewMarketOrderForLiquidation function parameters and internal logic are approved.


69-73: LGTM! Transition to math.LegacyDec.

The changes to the GetCancelRefundAmount function parameters and return type are approved.


Line range hint 153-161:
LGTM! Transition to math.LegacyDec.

The changes to the ResizeReduceOnlyOrder function parameters and internal logic are approved.


190-197: LGTM! Transition to math.LegacyDec.

The changes to the GetRequiredBinaryOptionsMargin function parameters and return type are approved.


200-207: LGTM! Transition to math.LegacyDec.

The changes to the GetRequiredBinaryOptionsMargin function parameters and return type are approved.


210-213: LGTM! Transition to math.LegacyDec.

The changes to the GetCancelDepositDelta function parameters and internal logic are approved.


Line range hint 217-227:
LGTM! Transition to math.LegacyDec.

The changes to the GetCancelRefundAmount function parameters and return type are approved.


230-238: LGTM! Transition to math.LegacyDec.

The changes to the CheckTickSize function parameters and internal logic are approved.


248-249: LGTM! Transition to math.LegacyDec.

The changes to the GetScaledPrice function parameters and return type are approved.


262-284: LGTM! Transition to math.LegacyDec.

The changes to the CheckMarginAndGetMarginHold function parameters, return type, and internal logic are approved.


289-294: LGTM! Transition to math.LegacyDec.

The changes to the CheckInitialMarginRequirementMarkPriceThreshold function parameters and internal logic are approved.


432-448: LGTM! Transition to math.LegacyDec.

The changes to the Quantity, FillableQuantity, and Price functions parameters and return types are approved.

chain/peggy/types/msgs.go (10)

624-624: Ensure consistency with existing message types.

The Route method correctly returns the RouterKey. Ensure this is consistent with other message types in the module.


626-626: Ensure consistency with existing message types.

The Type method correctly returns the type string. Ensure this is consistent with other message types in the module.


628-642: Validate the error handling in ValidateBasic method.

The ValidateBasic method correctly performs validation checks on the signer and blacklist addresses. Ensure that the error messages are informative and consistent with other validation methods.


644-646: Ensure proper serialization in GetSignBytes method.

The GetSignBytes method correctly serializes the message for signing using sdk.MustSortJSON. Ensure this is consistent with other message types in the module.


648-651: Ensure proper signer extraction in GetSigners method.

The GetSigners method correctly extracts the signer's address. Ensure this is consistent with other message types in the module.


653-653: Ensure consistency with existing message types.

The Route method correctly returns the RouterKey. Ensure this is consistent with other message types in the module.


655-655: Ensure consistency with existing message types.

The Type method correctly returns the type string. Ensure this is consistent with other message types in the module.


657-671: Validate the error handling in ValidateBasic method.

The ValidateBasic method correctly performs validation checks on the signer and blacklist addresses. Ensure that the error messages are informative and consistent with other validation methods.


673-675: Ensure proper serialization in GetSignBytes method.

The GetSignBytes method correctly serializes the message for signing using sdk.MustSortJSON. Ensure this is consistent with other message types in the module.


677-680: Ensure proper signer extraction in GetSigners method.

The GetSigners method correctly extracts the signer's address. Ensure this is consistent with other message types in the module.

chain/exchange/types/params.go (24)

6-6: Ensure compatibility with the new math library.

The import of the new math library from cosmossdk.io should be checked for compatibility with the rest of the codebase.


46-47: Ensure new constant is used appropriately.

The new constant MaxGranterDelegations should be checked for appropriate usage throughout the codebase.


50-50: Ensure compatibility with new math library.

The variable MaxBinaryOptionsOrderPrice is updated to use math.LegacyOneDec(). Ensure compatibility with the rest of the codebase.


53-53: Ensure compatibility with new math library.

The variable MinDerivativeOrderPrice is updated to use math.LegacyOneDec(). Ensure compatibility with the rest of the codebase.


56-56: Ensure compatibility with new math library.

The variable MaxOrderPrice is updated to use math.LegacyMustNewDecFromStr. Ensure compatibility with the rest of the codebase.


59-59: Ensure compatibility with new math library.

The variable MaxOrderMargin is updated to use math.LegacyMustNewDecFromStr. Ensure compatibility with the rest of the codebase.


62-62: Ensure compatibility with new math library.

The variable MaxTokenInt is updated to use math.NewIntFromString. Ensure compatibility with the rest of the codebase.


64-64: Ensure compatibility with new math library.

The variable MaxOrderQuantity is updated to use math.LegacyMustNewDecFromStr. Ensure compatibility with the rest of the codebase.


65-65: Ensure compatibility with new math library.

The variable MaxFeeMultiplier is updated to use math.LegacyMustNewDecFromStr. Ensure compatibility with the rest of the codebase.


67-67: Ensure compatibility with new math library.

The variable minMarginRatio is updated to use math.LegacyNewDecWithPrec. Ensure compatibility with the rest of the codebase.


107-127: Ensure compatibility with new math library in NewParams function.

The parameters in the NewParams function are updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


193-215: Ensure compatibility with new math library in DefaultParams function.

The return values in the DefaultParams function are updated to use math types. Ensure compatibility with the rest of the codebase.


292-294: Ensure new validation function is used appropriately.

The new validation function validateAdmins should be checked for appropriate usage throughout the codebase.


Line range hint 338-350: Ensure compatibility with new math library in ValidateFee function.

The parameter type in the ValidateFee function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


Line range hint 358-371: Ensure compatibility with new math library in ValidateMakerFee function.

The parameter type in the ValidateMakerFee function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


Line range hint 379-397: Ensure compatibility with new math library in ValidateHourlyFundingRateCap function.

The parameter type in the ValidateHourlyFundingRateCap function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


Line range hint 405-419: Ensure compatibility with new math library in ValidateHourlyInterestRate function.

The parameter type in the ValidateHourlyInterestRate function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


Line range hint 427-453: Ensure compatibility with new math library in ValidateTickSize function.

The parameter type in the ValidateTickSize function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


468-483: Ensure compatibility with new math library in ValidateMinNotional function.

The parameter type in the ValidateMinNotional function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


Line range hint 486-497: Ensure compatibility with new math library in ValidateMarginRatio function.

The parameter type in the ValidateMarginRatio function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


530-551: Ensure new validation function is used appropriately.

The new validation function validateAdmins should be checked for appropriate usage throughout the codebase.


Line range hint 580-588: Ensure compatibility with new math library in validateInjRewardStakedRequirementThreshold function.

The parameter type in the validateInjRewardStakedRequirementThreshold function is updated to use math.Int. Ensure compatibility with the rest of the codebase.


Line range hint 610-621: Ensure compatibility with new math library in validateLiquidatorRewardShareRate function.

The parameter type in the validateLiquidatorRewardShareRate function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


640-648: Ensure compatibility with new math library in validateAtomicMarketOrderFeeMultiplier function.

The parameter type in the validateAtomicMarketOrderFeeMultiplier function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.

chain/exchange/types/key.go (16)

9-9: Ensure compatibility with the new math library.

The import of the new math library from cosmossdk.io should be checked for compatibility with the rest of the codebase.


115-118: Ensure new prefixes are used appropriately.

The new prefixes for grant authorizations should be checked for appropriate usage throughout the codebase.


280-280: Ensure compatibility with new math library in GetSubaccountOrderKey function.

The parameter type in the GetSubaccountOrderKey function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


285-285: Ensure compatibility with new math library in GetSubaccountOrderIterationKey function.

The parameter type in the GetSubaccountOrderIterationKey function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


317-317: Ensure compatibility with new math library in GetPaddedPrice function.

The parameter type in the GetPaddedPrice function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


328-336: Ensure compatibility with new math library in GetPriceFromPaddedPrice function.

The return type in the GetPriceFromPaddedPrice function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


339-339: Ensure compatibility with new math library in GetLimitOrderByPriceKeyPrefix function.

The parameter type in the GetLimitOrderByPriceKeyPrefix function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


385-385: Ensure compatibility with new math library in GetConditionalOrderByTriggerPriceKeyPrefix function.

The parameter type in the GetConditionalOrderByTriggerPriceKeyPrefix function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


390-390: Ensure compatibility with new math library in SpotMarketDirectionPriceHashPrefix function.

The parameter type in the SpotMarketDirectionPriceHashPrefix function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


526-526: Ensure compatibility with new math library in GetSpotOrderbookLevelsForPriceKey function.

The parameter type in the GetSpotOrderbookLevelsForPriceKey function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


532-532: Ensure compatibility with new math library in GetDerivativeOrderbookLevelsForPriceKey function.

The parameter type in the GetDerivativeOrderbookLevelsForPriceKey function is updated to use math.LegacyDec. Ensure compatibility with the rest of the codebase.


536-538: Ensure compatibility with new math library in GetGrantAuthorizationKey function.

The function GetGrantAuthorizationKey is introduced to handle grant authorizations. Ensure compatibility with the rest of the codebase.


540-542: Ensure compatibility with new math library in GetGrantAuthorizationIteratorPrefix function.

The function GetGrantAuthorizationIteratorPrefix is introduced to handle grant authorizations. Ensure compatibility with the rest of the codebase.


544-546: Ensure compatibility with new math library in GetTotalGrantAmountKey function.

The function GetTotalGrantAmountKey is introduced to handle grant authorizations. Ensure compatibility with the rest of the codebase.


548-550: Ensure compatibility with new math library in GetActiveGrantKey function.

The function GetActiveGrantKey is introduced to handle grant authorizations. Ensure compatibility with the rest of the codebase.


552-554: Ensure compatibility with new math library in GetLastValidGrantDelegationCheckTimeKey function.

The function GetLastValidGrantDelegationCheckTimeKey is introduced to handle grant authorizations. Ensure compatibility with the rest of the codebase

chain/exchange/types/proposal.go (12)

59-63: LGTM!

The function SafeIsPositiveInt correctly uses math.Int instead of sdkmath.Int.


67-71: LGTM!

The function SafeIsPositiveDec correctly uses math.LegacyDec instead of sdk.Dec.


75-79: LGTM!

The function SafeIsNonNegativeDec correctly uses math.LegacyDec instead of sdk.Dec.


83-85: LGTM!

The function IsZeroOrNilInt correctly uses math.Int instead of sdkmath.Int.


87-89: LGTM!

The function IsZeroOrNilDec correctly uses math.LegacyDec instead of sdk.Dec.


259-266: LGTM!

The function ValidateBasic in SpotMarketParamUpdateProposal correctly includes validation for the new parameter minNotional.

Also applies to: 296-315


502-511: LGTM!

The function ValidateBasic in DerivativeMarketParamUpdateProposal correctly includes validation for the new parameters minNotional, ticker, and adminInfo.

Also applies to: 551-582


Line range hint 608-613:
LGTM!

The function NewMarketForcedSettlementProposal correctly uses math.LegacyDec instead of sdk.Dec.


Line range hint 216-229:
LGTM! But verify the function usage in the codebase.

The function NewSpotMarketParamUpdateProposal has been correctly updated to include new parameters minNotional and ticker, and to use math.LegacyDec instead of sdk.Dec.

However, ensure that all function calls to NewSpotMarketParamUpdateProposal match the new signature.

Verification successful

No issues found with the function usage.

The function NewSpotMarketParamUpdateProposal is not called anywhere else in the codebase. Therefore, there are no calls to verify against the new signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewSpotMarketParamUpdateProposal` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'NewSpotMarketParamUpdateProposal'

Length of output: 744


Script:

#!/bin/bash
# Description: Verify all function calls to `NewSpotMarketParamUpdateProposal` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go 'NewSpotMarketParamUpdateProposal\(' -A 3

Length of output: 525


Script:

#!/bin/bash
# Description: Verify all function calls to `NewSpotMarketParamUpdateProposal` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg 'NewSpotMarketParamUpdateProposal\(' -A 3

Length of output: 515


Line range hint 432-467:
LGTM! But verify the function usage in the codebase.

The function NewDerivativeMarketParamUpdateProposal has been correctly updated to include new parameters minNotional, ticker, and adminInfo, and to use math.LegacyDec instead of sdk.Dec.

However, ensure that all function calls to NewDerivativeMarketParamUpdateProposal match the new signature.


Line range hint 783-800:
LGTM! But verify the function usage in the codebase.

The function NewPerpetualMarketLaunchProposal has been correctly updated to include the new parameter minNotional, and to use math.LegacyDec instead of sdk.Dec.

However, ensure that all function calls to NewPerpetualMarketLaunchProposal match the new signature.


Line range hint 1446-1465:
LGTM! But verify the function usage in the codebase.

The function NewBinaryOptionsMarketLaunchProposal has been correctly updated to include the new parameter minNotional, and to use math.LegacyDec instead of sdk.Dec.

However, ensure that all function calls to NewBinaryOptionsMarketLaunchProposal match the new signature.

Verification successful

No issues found with the function signature update.

The function NewBinaryOptionsMarketLaunchProposal has been correctly updated to include the new parameter minNotional and to use math.LegacyDec instead of sdk.Dec. There are no calls to this function in the codebase, so no further updates are necessary.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewBinaryOptionsMarketLaunchProposal` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'NewBinaryOptionsMarketLaunchProposal'

Length of output: 728


Script:

#!/bin/bash
# Description: Verify all function calls to `NewBinaryOptionsMarketLaunchProposal` match the new signature.

# Test: Search for the function calls. Expect: Only occurrences of the new signature.
rg --type go 'NewBinaryOptionsMarketLaunchProposal\(' -A 5

Length of output: 601


Script:

#!/bin/bash
# Description: Verify all function calls to `NewBinaryOptionsMarketLaunchProposal` match the new signature.

# Test: Search for any occurrences of the function. Expect: Only occurrences of the new signature.
rg --type go 'NewBinaryOptionsMarketLaunchProposal'

Length of output: 258

chain/exchange/types/msgs.go (5)

194-255: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to MsgUpdateDerivativeMarket are correctly implemented.


119-160: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to MsgUpdateSpotMarket are correctly implemented.


Line range hint 576-621:
LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to MsgDecreasePositionMargin are correctly implemented.

Verification successful

Function MsgDecreasePositionMargin is correctly implemented and integrated within the codebase.

The search results show that MsgDecreasePositionMargin is defined and used appropriately in various parts of the codebase, including message handling and protobuf definitions. No issues were found in the implementation.

  • File: chain/exchange/types/msgs.go
    • Definition and methods of MsgDecreasePositionMargin are correctly implemented.
  • File: chain/exchange/types/tx.pb.go
    • Protobuf message definitions and gRPC service methods for MsgDecreasePositionMargin are correctly implemented.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `MsgDecreasePositionMargin` are correctly implemented.

# Test: Search for the function usage. Expect: Only occurrences of the correct implementation.
rg --type go -A 5 $'MsgDecreasePositionMargin'

Length of output: 18434


Line range hint 1080-1104:
LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to MsgActivateStakeGrant are correctly implemented.


Line range hint 1043-1067:
LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to MsgAuthorizeStakeGrants are correctly implemented.

Verification successful

Function usage of MsgAuthorizeStakeGrants verified.

The function MsgAuthorizeStakeGrants and its related methods are correctly implemented across the codebase, including msgs.go and tx.pb.go.

  • msgs.go: Core implementation and methods.
  • tx.pb.go: Protobuf definitions and related methods.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `MsgAuthorizeStakeGrants` are correctly implemented.

# Test: Search for the function usage. Expect: Only occurrences of the correct implementation.
rg --type go -A 5 $'MsgAuthorizeStakeGrants'

Length of output: 15757

chain/exchange/types/market.go (8)

14-14: LGTM!

The change to use math.LegacyNewDec(-1) for BinaryOptionsMarketRefundFlagPrice is correct and aligns with the new mathematical library.


18-18: LGTM!

The change to use math.LegacyDec for the MarkPrice field in the DerivativeMarketInfo struct is correct and aligns with the new mathematical library.


93-115: LGTM!

The changes to use math.LegacyDec for the methods GetMakerFeeRate, GetTakerFeeRate, GetRelayerFeeShareRate, GetMinPriceTickSize, GetMinQuantityTickSize, and GetMinNotional in SpotMarket are correct and align with the new mathematical library.


156-162: LGTM!

The changes to use math.LegacyDec for the methods GetMinQuantityTickSize and GetMinNotional in DerivativeMarket are correct and align with the new mathematical library.


213-229: LGTM!

The changes to use math.LegacyDec for the methods GetMakerFeeRate, GetTakerFeeRate, GetRelayerFeeShareRate, GetInitialMarginRatio, and GetMinPriceTickSize in DerivativeMarket are correct and align with the new mathematical library.


Line range hint 260-285: LGTM!

The changes to use math.LegacyDec for the methods GetInitialMarginRatio, GetMinPriceTickSize, GetMinQuantityTickSize, and GetMinNotional in BinaryOptionsMarket are correct and align with the new mathematical library.


295-303: LGTM!

The changes to use math.LegacyDec for the methods GetMakerFeeRate, GetTakerFeeRate, and GetRelayerFeeShareRate in BinaryOptionsMarket are correct and align with the new mathematical library.


174-187: LGTM!

The new String method for the MarketType enum is correctly implemented and enhances the readability and usability of market type instances.

chain/peggy/types/types.go (1)

253-253: LGTM!

The change to initialize sum using sdkmath.ZeroInt() in the GetFees method of the OutgoingTxBatch struct is correct and aligns with the new mathematical library.

Comment on lines +40 to +57
// NewInterfaceRegistry returns a new InterfaceRegistry
func NewInterfaceRegistry() types.InterfaceRegistry {
registry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdktypes.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdktypes.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
})
if err != nil {
panic(err)
}
return registry
}
Copy link

Choose a reason for hiding this comment

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

Consider improving error handling.

The NewInterfaceRegistry function correctly initializes the InterfaceRegistry. However, using panic for error handling is not recommended in production code. Consider returning an error instead.

-  registry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
+  registry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
-  if err != nil {
-    panic(err)
-  }
+  if err != nil {
+    return nil, err
+  }
  return registry
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
// NewInterfaceRegistry returns a new InterfaceRegistry
func NewInterfaceRegistry() types.InterfaceRegistry {
registry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdktypes.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdktypes.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
})
if err != nil {
panic(err)
}
return registry
}
// NewInterfaceRegistry returns a new InterfaceRegistry
func NewInterfaceRegistry() (types.InterfaceRegistry, error) {
registry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdktypes.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdktypes.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
})
if err != nil {
return nil, err
}
return registry, nil
}

Comment on lines +5 to +11
const (
TickerPerm = 1 << iota
MinPriceTickSizePerm = 1 << iota
MinQuantityTickSizePerm = 1 << iota
MinNotionalPerm = 1 << iota
InitialMarginRationPerm = 1 << iota
MaintenanceMarginRationPerm = 1 << iota
Copy link

Choose a reason for hiding this comment

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

Fix typographical errors in constant names.

There are typographical errors in the constant names InitialMarginRationPerm and MaintenanceMarginRationPerm. They should be InitialMarginRatioPerm and MaintenanceMarginRatioPerm.

-	InitialMarginRationPerm     = 1 << iota
-	MaintenanceMarginRationPerm = 1 << iota
+	InitialMarginRatioPerm     = 1 << iota
+	MaintenanceMarginRatioPerm = 1 << iota
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
const (
TickerPerm = 1 << iota
MinPriceTickSizePerm = 1 << iota
MinQuantityTickSizePerm = 1 << iota
MinNotionalPerm = 1 << iota
InitialMarginRationPerm = 1 << iota
MaintenanceMarginRationPerm = 1 << iota
const (
TickerPerm = 1 << iota
MinPriceTickSizePerm = 1 << iota
MinQuantityTickSizePerm = 1 << iota
MinNotionalPerm = 1 << iota
InitialMarginRatioPerm = 1 << iota
MaintenanceMarginRatioPerm = 1 << iota

Comment on lines +42 to +67
func (p MarketAdminPermissions) CheckDerivativeMarketPermissions(msg *MsgUpdateDerivativeMarket) error {
if msg.HasTickerUpdate() && !p.HasPerm(TickerPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update ticker")
}

if msg.HasMinPriceTickSizeUpdate() && !p.HasPerm(MinPriceTickSizePerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update min_price_tick_size")
}

if msg.HasMinQuantityTickSizeUpdate() && !p.HasPerm(MinQuantityTickSizePerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update min_quantity_tick_size")
}

if msg.HasMinNotionalUpdate() && !p.HasPerm(MinNotionalPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update market min_notional")
}

if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRationPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update initial_margin_ratio")
}

if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRationPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update maintenance_margin_ratio")
}

return nil
Copy link

Choose a reason for hiding this comment

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

Fix typographical errors in constant names.

The function uses constants InitialMarginRationPerm and MaintenanceMarginRationPerm which have typographical errors. They should be InitialMarginRatioPerm and MaintenanceMarginRatioPerm.

-	if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRationPerm) {
+	if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRatioPerm) {
-	if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRationPerm) {
+	if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRatioPerm) {
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
func (p MarketAdminPermissions) CheckDerivativeMarketPermissions(msg *MsgUpdateDerivativeMarket) error {
if msg.HasTickerUpdate() && !p.HasPerm(TickerPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update ticker")
}
if msg.HasMinPriceTickSizeUpdate() && !p.HasPerm(MinPriceTickSizePerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update min_price_tick_size")
}
if msg.HasMinQuantityTickSizeUpdate() && !p.HasPerm(MinQuantityTickSizePerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update min_quantity_tick_size")
}
if msg.HasMinNotionalUpdate() && !p.HasPerm(MinNotionalPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update market min_notional")
}
if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRationPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update initial_margin_ratio")
}
if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRationPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update maintenance_margin_ratio")
}
return nil
func (p MarketAdminPermissions) CheckDerivativeMarketPermissions(msg *MsgUpdateDerivativeMarket) error {
if msg.HasTickerUpdate() && !p.HasPerm(TickerPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update ticker")
}
if msg.HasMinPriceTickSizeUpdate() && !p.HasPerm(MinPriceTickSizePerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update min_price_tick_size")
}
if msg.HasMinQuantityTickSizeUpdate() && !p.HasPerm(MinQuantityTickSizePerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update min_quantity_tick_size")
}
if msg.HasMinNotionalUpdate() && !p.HasPerm(MinNotionalPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update market min_notional")
}
if msg.HasInitialMarginRatioUpdate() && !p.HasPerm(InitialMarginRatioPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update initial_margin_ratio")
}
if msg.HasMaintenanceMarginRatioUpdate() && !p.HasPerm(MaintenanceMarginRatioPerm) {
return errors.Wrap(ErrInvalidAccessLevel, "admin does not have permission to update maintenance_margin_ratio")
}
return nil

@aarmoa aarmoa merged commit 907ab57 into master Jul 30, 2024
4 checks passed
@aarmoa aarmoa deleted the release/v1_51_chain_upgrade_1_13_master branch July 30, 2024 19:08
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.

4 participants