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

Bump cosmos-sdk to v0.50.10-pio-1 (from v0.50.7-pio-1). #2175

Merged
merged 18 commits into from
Oct 14, 2024

Conversation

SpicyLemon
Copy link
Contributor

@SpicyLemon SpicyLemon commented Oct 9, 2024

Description

This PR does the following:

  1. Bumps the cosmos-sdk to v0.50.10-pio-1 (from v0.50.7-pio-1). See also: Bring in SDK changes up to v0.50.10 and Mark v0.50.10-pio-1.  cosmos-sdk#612.
  2. Uses the sdk's new GetNodeHomeDirectory helper to set the DefaultNodeHome path. Now, DefaultNodeHome will have a value that reflects the --home flag or PIO_HOME env arg and defaults to the os.UserConfigDir() otherwise.
  3. Tweak how the txConfig is created in app.New because the custom signing funcs weren't properly being propagated to it (and I added a call to .Validate() like the SDK's example, that was causing a panic without the tweak).
  4. Make our sims pay attention to the newly added SigverifyTxValue sims flag.
  5. Fixes a bug in .changelog/add-change.sh. When the section is "dependencies" and no messages are provided, it now correctly calls get-dep-changes.sh instead of erroneously calling get-valid-sections.sh.
  6. Updates the no-now-lint.sh script to also look for uses of telemetry.Now().
  7. In all our telemetry timed stuff, switch to telemetry.Now() (from time.Now()). The telemetry.Now() is supposed to be more efficient when telemetry isn't enabled.

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Added relevant changelog entries under .changelog/unreleased (see Adding Changes).
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Summary by CodeRabbit

  • New Features

    • Streamlined initialization process for the Provenance Blockchain application.
    • Enhanced transaction configuration options for improved flexibility.
    • Added persistent flags for improved command configurability.
  • Bug Fixes

    • Improved error handling during transaction configuration setup.
  • Documentation

    • Updated configuration settings for linters to enhance code quality control.
  • Tests

    • Expanded test coverage for various application components, ensuring adherence to updated standards.
  • Chores

    • Routine updates to linter settings for better code analysis and maintenance.

…r signing context because the validation was failing because the custom msg signers funcs aren't getting propagated from the interface registry to the signing context.
… the previous commit, I also updated how we set the default node home directory to match the SDK's example (using one of their helpers).
…stuff applied (and will hopefully get merged and become v0.50.10-pio-1).
…Now and add line counts to the outputs. Also, remove the app/test_helpers.go filter since that file doesn't use .Now anymore.
…ry.Now(). The telemetry verision returns an empty Time if telemetry isn't enabled which is supposed to save on a bit a processing.
…t line for an event, and a space on the rest. This makes it easier to identify where one event starts and another ends. Also, update AssertEqualEvents to output the actual events when the check fails.
…vents that the bank module emits changed a little bit (for the better).
@SpicyLemon SpicyLemon marked this pull request as ready for review October 10, 2024 22:33
@SpicyLemon SpicyLemon requested a review from a team as a code owner October 10, 2024 22:33
Copy link
Contributor

coderabbitai bot commented Oct 10, 2024

Walkthrough

The pull request updates the .golangci.yml configuration file for a Go project, modifying linter settings and operational parameters. It disables tests and selectively enables specific linters while defining exclusion rules for certain warnings. Additionally, the app/app.go file is modified to enhance the initialization of the Provenance Blockchain application, including updates to transaction configuration and the introduction of the clienthelpers package. The cmd/provenanced/cmd/root.go file is also updated to improve command configurability with new persistent flags.

Changes

File Change Summary
.golangci.yml Modified linter settings, disabled tests, and updated allowed files for depguard.
app/app.go Removed strings import, added clienthelpers package, updated transaction configuration, and refined WasmKeeper initialization.
cmd/provenanced/cmd/root.go Updated Viper environment prefix, added persistent flags for custom denom and message fee floor price.

Possibly related PRs

Suggested reviewers

  • Taztingo
  • nullpointer0x00

Poem

🐇 In the garden of code we play,
Linters dance and tests sway.
With helpers new and paths refined,
A brighter future we shall find!
Hops of joy, let’s celebrate,
For every change, we elevate! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1bac787 and a7d6d1c.

📒 Files selected for processing (1)
  • cmd/provenanced/cmd/root.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/provenanced/cmd/root.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@SpicyLemon SpicyLemon enabled auto-merge (squash) October 10, 2024 22:35
Copy link
Member

@iramiller iramiller left a comment

Choose a reason for hiding this comment

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

I am not sure how much value the telemetry is actually providing on these endpoints ... they seem like they had this added back in the very beginning/early days of our protocol and yet I am not sure we have ever used or relied on their measurements.. More likely is the monitoring of overall block execution time and if there is an outlier then going into the block and seeing what it was doing and why that might be so time consuming....

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (17)
app/prefix.go (1)

13-15: LGTM with a minor suggestion for the comment.

The addition of the EnvPrefix constant is well-documented and aligns with the PR objectives. It provides a centralized definition for the environment variable prefix, which can improve consistency across the application.

Consider slightly modifying the comment to be more specific:

- // EnvPrefix is the prefix added to config/flag names to get its environment variable name.
+ // EnvPrefix is the prefix used for environment variable names associated with application configuration.

This change more clearly indicates that the prefix is specifically for environment variables related to the application's configuration.

x/marker/abci.go (1)

Line range hint 18-53: Consider refining error handling and logging

While the changes in this PR are approved, there are a few suggestions for future improvements:

  1. The error handling at the end of the function panics if an error occurs. In a blockchain context, panicking can be disruptive. Consider a more graceful error handling approach, such as returning an error from the BeginBlocker function.

  2. The use of a closure with a mutable err variable could be improved for better readability and maintainability. Consider refactoring to use a named return error or a different iteration pattern.

  3. The logging of supply adjustments uses the Error level. If this is an expected operation, consider using Info or Debug level instead.

Here's a potential refactoring for points 1 and 2:

func BeginBlocker(ctx sdk.Context, k keeper.Keeper, bk bankkeeper.Keeper) error {
    defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker)

    return k.IterateMarkers(ctx, func(record types.MarkerAccountI) error {
        // ... (rest of the logic)
        if err != nil {
            return err
        }
        return nil
    })
}

This approach returns errors instead of panicking and simplifies the error handling within the iteration.

scripts/no-now-lint.sh (2)

21-39: LGTM: Well-implemented get_line_count function

The new get_line_count function is a robust solution for accurately counting lines, handling edge cases like empty strings or strings without trailing newlines. The detailed comments explaining why other methods are not suitable are particularly helpful.

Consider adding a brief usage example in the function's comment to make it even more developer-friendly. For instance:

# Usage: count=$(get_line_count "$var")

45-70: LGTM: Improved import detection logic

The updates to the import detection logic effectively expand the script's scope to catch potential new libraries with .Now() functions. Explicitly ignoring the vendor directory is a good practice.

Consider adding a comment explaining the reasoning behind ignoring the vendor directory. For example:

# Ignore vendor directory as it's not under our control and may contain many false positives

This would provide more context for future maintainers.

go.mod (1)

Line range hint 220-235: Consider addressing remaining TODOs and replacements

There are several TODO comments and replacements in the file that might need attention in future updates. These include:

  1. Updating async-icq once a tag is created with specific changes.
  2. Updating or changing ibc-go once a tag is made with a fix for a specific issue.
  3. Removing deprecated jwt-go dependency.
  4. Addressing upstream vulnerabilities in gin-gonic/gin.

It would be beneficial to create issues or tasks to track these items for future maintenance and updates.

.changelog/add-change.sh (1)

328-328: LGTM! Consider adding a comment for clarity.

The change to use get-dep-changes.sh for the "dependencies" section is a good improvement. It aligns with the PR objective of updating the cosmos-sdk version and likely provides more accurate changelog entries for dependency updates.

Consider adding a brief comment explaining the purpose of get-dep-changes.sh for future maintainability:

 if [[ "$section" == "dependencies" ]]; then
     [[ -n "$verbose" ]] && printf 'Using get-dep-changes.sh for new entry.\n'
-    "${where_i_am}/get-dep-changes.sh" "$num_type_flag" "$num" --id "$id" --force
+    # Use get-dep-changes.sh to generate accurate changelog entries for dependency updates
+    "${where_i_am}/get-dep-changes.sh" "$num_type_flag" "$num" --id "$id" --force
     exit $?
 fi
app/sim_test.go (3)

234-236: LGTM! Consider adding a comment for clarity.

The addition of the conditional check for simcli.FlagSigverifyTxValue is appropriate and aligns with the PR objectives. It allows the simulation to run without transaction signature verification when needed.

Consider adding a brief comment explaining the purpose of this condition for better code readability:

 if !simcli.FlagSigverifyTxValue {
+    // Disable signature verification for transactions in simulation when flag is false
     app.SetNotSigverifyTx()
 }

597-599: LGTM! Crucial consistency in state determinism test.

The addition of the conditional check for simcli.FlagSigverifyTxValue in the TestAppStateDeterminism function maintains the consistency seen throughout the file. This change is particularly important in the context of state determinism testing, as it allows verification of deterministic behavior both with and without signature verification.

Consider adding a test case that explicitly compares the state determinism with and without signature verification enabled. This could provide additional confidence in the application's behavior under different signature verification settings.


Line range hint 234-599: Overall assessment: Well-implemented and consistent changes.

The modifications in this file consistently implement the conditional check for simcli.FlagSigverifyTxValue across all simulation test functions. These changes align well with the PR objectives and enhance the flexibility of the simulation tests by allowing them to run with or without signature verification.

Key points:

  1. Consistency: The same pattern is applied uniformly across different test scenarios.
  2. Flexibility: Tests can now be run in both signature verification modes, increasing test coverage.
  3. Alignment: Changes support the new SigverifyTxValue sims flag as intended.

To further improve test coverage and confidence:

  1. Consider adding specific test cases that compare results with signature verification enabled and disabled.
  2. Document the expected behavior differences (if any) when running simulations with and without signature verification.
x/exchange/keeper/msg_server_test.go (8)

Line range hint 94-107: Simplify Generic Type Definitions for Readability

The generic type definitions for msgServerTestDef and msgServerTestCase use placeholders R, S, and F without clear context, which can reduce readability. Consider using more descriptive type parameter names to enhance code clarity.

For example, you could rename the type parameters as follows:

-type msgServerTestDef[R any, S any, F any] struct {
+type msgServerTestDef[Req any, Resp any, FollowupArgs any] struct {
     // ...
 }

-type msgServerTestCase[R any, F any] struct {
+type msgServerTestCase[Req any, FollowupArgs any] struct {
     // ...
 }

Line range hint 184-190: Handle Potential Panics in runMsgServerTestCase

In the runMsgServerTestCase function, there is a defer function intended to restore the original context after the test execution. However, if any of the setup functions or the test itself panics, the deferred function might not execute as expected. Ensure that the test environment is correctly reset even if a panic occurs.

Consider wrapping the test execution in a defer with recover() to safely handle any panics:

func runMsgServerTestCase[Req any, Resp any, FollowupArgs any](s *TestSuite, td msgServerTestDef[Req, Resp, FollowupArgs], tc msgServerTestCase[Req, FollowupArgs]) {
    s.T().Helper()
    origCtx := s.ctx
    defer func() {
        s.ctx = origCtx
        if r := recover(); r != nil {
            s.T().Errorf("Test case panicked: %v", r)
        }
    }()
    // ... rest of the test execution code
}

Line range hint 679-693: Avoid Redundant Logging in Tests

The getLogOutput method is being called within tests, which may not be necessary and could clutter test output, making it harder to diagnose failures.

If the log output is not being used for assertions or test verifications, consider removing the call to reduce unnecessary processing:

- resp, err = td.endpoint(s.ctx, &tc.msg)
- }
- s.Require().NotPanicsf(testFunc, td.endpointName)
- _ = s.getLogOutput(td.endpointName)
+ resp, err = td.endpoint(s.ctx, &tc.msg)
+ }
+ s.Require().NotPanicsf(testFunc, td.endpointName)

Line range hint 811-827: Consolidate Event Creation Helper Functions

Several helper functions for event creation, such as eventCoinSpent, eventCoinReceived, and eventTransfer, share similar structures. Consolidating them can reduce code duplication and improve maintainability.

Consider creating a generic function to build events and use it across the specific event creation functions:

func (s *TestSuite) newEvent(eventType string, attributes map[string]string) sdk.Event {
    var attrs []abci.EventAttribute
    for k, v := range attributes {
        attrs = append(attrs, s.newAttr(k, v))
    }
    return sdk.Event{
        Type:       eventType,
        Attributes: attrs,
    }
}

Then, update the specific event functions:

func (s *TestSuite) eventCoinSpent(spender sdk.AccAddress, amount string) sdk.Event {
    return s.newEvent("coin_spent", map[string]string{
        "spender": spender.String(),
        "amount":  amount,
    })
}

Line range hint 1293-1301: Check for Potential Data Races in Concurrent Test Execution

In TestMsgServer_CreateAsk, the tests are being run using s.Run, which runs subtests. If any shared resources are modified without proper synchronization, this can lead to data races.

Ensure that shared resources like s.k, s.ctx, and any shared state are accessed safely. Consider using locks or redesigning the tests to avoid concurrent writes to shared state.


Line range hint 1675-1685: Correct Misuse of Error Handling in Tests

In the test case for TestMsgServer_FillBids, the error messages are being checked using expInErr, but there is a misuse of error comparison that might lead to false positives.

Ensure that error assertions are precise and do not rely on substring matching that could match unintended errors. Use errors.Is or compare error types directly when possible.

For example:

// Instead of checking substrings
s.assertErrorContentsf(err, tc.expInErr, "%s error", td.endpointName)

// Use a specific error assertion
s.Require().ErrorIsf(err, expectedErrorType, "%s error", td.endpointName)

Line range hint 3104-3116: Use Table-Driven Tests for Parameter Update Cases

In TestMsgServer_UpdateParams, multiple test cases check different scenarios of parameter updates. Using table-driven tests can improve test readability and scalability as new test cases are added.

Refactor the test function to use a slice of test cases:

func (s *TestSuite) TestMsgServer_UpdateParams() {
    testCases := []struct {
        name      string
        setup     func()
        msg       exchange.MsgUpdateParamsRequest
        expEvents sdk.Events
    }{
        { /* test case definitions */ },
    }

    for _, tc := range testCases {
        s.Run(tc.name, func() {
            if tc.setup != nil {
                tc.setup()
            }
            // ... test execution and assertions
        })
    }
}

Line range hint 1490-1502: Remove Redundant Type Assertions

In TestMsgServer_CreateAsk, within the followup function, there are explicit type assertions that may be unnecessary.

If the types are known and assured by the context, you can remove redundant assertions to simplify the code:

- s.followup = func(_ *exchange.MsgCreateAskRequest, fargs followupArgs) {
+ s.followup = func(_, fargs followupArgs) {
     s.checkBalances(fargs.expBal)
 }

Alternatively, if type safety is a concern, ensure that the type assertions are necessary and correctly implemented.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ce5e5f2 and 9a2f724.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (18)
  • .changelog/add-change.sh (1 hunks)
  • .changelog/unreleased/dependencies/2175-bump-sdk-to-50-10.md (1 hunks)
  • .golangci.yml (1 hunks)
  • app/app.go (4 hunks)
  • app/prefix.go (1 hunks)
  • app/sim_test.go (5 hunks)
  • cmd/provenanced/cmd/root.go (1 hunks)
  • go.mod (2 hunks)
  • scripts/no-now-lint.sh (3 hunks)
  • testutil/assertions/events.go (2 hunks)
  • testutil/assertions/events_test.go (19 hunks)
  • testutil/assertions/general_test.go (2 hunks)
  • x/attribute/keeper/keeper.go (5 hunks)
  • x/exchange/keeper/msg_server_test.go (13 hunks)
  • x/marker/abci.go (1 hunks)
  • x/marker/keeper/marker.go (16 hunks)
  • x/metadata/keeper/msg_server.go (22 hunks)
  • x/metadata/keeper/query_server.go (22 hunks)
✅ Files skipped from review due to trivial changes (3)
  • .changelog/unreleased/dependencies/2175-bump-sdk-to-50-10.md
  • x/metadata/keeper/msg_server.go
  • x/metadata/keeper/query_server.go
🧰 Additional context used
🔇 Additional comments (56)
x/marker/abci.go (1)

16-16: Approved: Telemetry timing function updated

The change from time.Now() to telemetry.Now() is correct and aligns with the PR objectives. This update standardizes the telemetry timing functions across the codebase, potentially improving efficiency when telemetry is not enabled.

testutil/assertions/events.go (3)

26-28: Improved event string formatting

The changes in the EventsToStrings function enhance the readability of the output by adding a ">" character to the first line of each event. This modification makes it easier to distinguish between different events when multiple events are displayed.

The implementation is correct and improves the overall formatting without affecting the function's core functionality.


85-90: Enhanced debugging for failed event assertions

The changes in the AssertEqualEvents function significantly improve the debugging experience when event assertions fail. By logging the actual events when the assertion fails, developers can more easily identify and understand the discrepancies between expected and actual events.

This modification is particularly useful in complex test scenarios where manually comparing large sets of events can be time-consuming and error-prone. The implementation is correct and maintains the original function behavior while adding valuable debugging information.


Line range hint 1-190: Summary of changes in testutil/assertions/events.go

The modifications in this file enhance the functionality of event-related test utilities:

  1. Improved formatting in EventsToStrings for better readability of multiple events.
  2. Enhanced debugging capabilities in AssertEqualEvents by logging actual events on assertion failures.

These changes align with the PR objectives and will likely improve the development experience when working with event-related tests. The implementations are correct and maintain backwards compatibility while adding valuable features.

testutil/assertions/general_test.go (3)

83-83: Improved error message clarity.

The addition of the expected value (exp) to the error message enhances the clarity of test output. This change will make it easier to diagnose failed assertions by providing more context about what was being searched for in the output.


98-98: Consistent improvement in error message clarity.

This change mirrors the improvement made in the assertMockRunAssertResult function, maintaining consistency across assert and require functions. It enhances the clarity of test output for require assertions, making it easier to identify the specific expected value when a test fails.


83-83: Summary: Enhanced test diagnostics

These changes collectively improve the diagnostic capabilities of the test assertions by providing more detailed error messages. This aligns well with the PR's objective of enhancing test output and will make it easier for developers to identify and fix issues in failed tests.

Also applies to: 98-98

scripts/no-now-lint.sh (3)

2-4: LGTM: Updated comments accurately reflect script changes

The modifications to the comments effectively communicate the expanded scope of the script, now checking for all .Now() functions instead of just time.Now(). The addition of known libraries with .Now() functions provides valuable context for developers.

Also applies to: 16-19


Line range hint 73-95: LGTM: Enhanced .Now() usage detection

The updates to the .Now() usage detection logic effectively broaden the script's scope to catch all relevant .Now() calls from imported aliases. The existing logic for ignoring comments is maintained, ensuring accurate detection.


Line range hint 97-125: LGTM: Improved filtering logic and output formatting

The updates to the filtering logic and output formatting enhance the script's clarity and usefulness. The addition of counts in the verbose output provides valuable information to users.

Could you please provide more context about the new filter for the x/marker/client/cli/tx.go file? It would be helpful to understand the specific use case this addresses and ensure it doesn't inadvertently ignore any problematic uses of .Now().

go.mod (3)

13-13: LGTM: Minor version update for cosmossdk.io/store

The update from v1.1.0 to v1.1.1 for cosmossdk.io/store is a minor version increment, which typically includes bug fixes and small improvements. This change aligns with the PR objective of updating dependencies.


217-217: Verify the use of provenance-io fork for cosmos-sdk

The update to v0.50.10-pio-1 aligns with the main objective of this PR. However, it's important to ensure that using the provenance-io fork of cosmos-sdk instead of the main repository is intentional and necessary.

Could you please confirm if there are specific reasons for using the provenance-io fork of cosmos-sdk? Are there any custom changes or patches in this fork that are required for the project?


Line range hint 212-213: Confirm long-term plan for wasmd fork usage

The replacement of github.com/CosmWasm/wasmd with github.com/provenance-io/wasmd v0.52.0-pio-1 addresses issue #1414. While this solves an immediate problem, it's important to consider the long-term implications.

  1. Could you provide more details about issue Wasm storage via new gov proposal functionality not supported #1414 and why it requires using a fork of wasmd?
  2. Is there a plan to contribute these changes back to the main wasmd repository?
  3. How will this fork be maintained to keep up with upstream changes and security updates?
cmd/provenanced/cmd/root.go (3)

81-81: LGTM: Improved flexibility in environment prefix configuration

The change from a hardcoded "PIO" to app.EnvPrefix enhances the flexibility of the application's configuration. This is a good practice as it centralizes the environment prefix definition and makes it easier to maintain or modify in the future.


Line range hint 156-196: Request clarification on initRootCmd changes

The AI summary mentioned modifications to the initRootCmd function to ensure that the command structure remains intact. However, I don't see any changes in the provided code snippet for this function. Could you please clarify:

  1. Were there any changes made to the initRootCmd function?
  2. If changes were made, what was the purpose and impact of these changes?
  3. If no changes were made, should we update the PR description to reflect this?

Let's check for any changes in the initRootCmd function:

#!/bin/bash
# Search for changes in initRootCmd function
git diff HEAD^ HEAD -- cmd/provenanced/cmd/root.go | grep -A 20 'func initRootCmd'

Line range hint 153-154: Approve new configuration flags, but request usage details

The addition of CustomDenomFlag and CustomMsgFeeFloorPriceFlag enhances the application's configurability, which is beneficial for supporting different network setups and economic models. This is a positive change.

However, could you please provide more information on:

  1. How these flags are used within the application?
  2. Are there any validation mechanisms in place for these flags?
  3. Are there any default values or constraints for these flags that should be documented in the help text?

To ensure proper usage of these new flags, let's check for their implementation:

app/sim_test.go (3)

281-283: LGTM! Consistent implementation across test functions.

The addition of the conditional check for simcli.FlagSigverifyTxValue is consistent with the previous test function. This consistency is good for maintainability and ensures that all simulation tests behave the same way with respect to signature verification.


337-339: LGTM! Maintaining consistency across test functions.

The addition of the conditional check for simcli.FlagSigverifyTxValue is consistent with the previous test functions. This continued consistency across different types of simulation tests (full app, simple, and import/export) ensures uniform behavior with respect to signature verification.


469-471: LGTM! Consistency maintained in TestAppSimulationAfterImport.

The addition of the conditional check for simcli.FlagSigverifyTxValue remains consistent with all previous test functions. This uniformity across different simulation scenarios (including after import) ensures that the signature verification behavior is consistent throughout the testing suite.

x/attribute/keeper/keeper.go (7)

89-89: Telemetry measurement standardized.

The change from time.Now() to telemetry.Now() aligns with the goal of standardizing telemetry measurement calls. This should improve the accuracy of telemetry measurements when enabled.


97-97: Telemetry measurement standardized.

The change from time.Now() to telemetry.Now() is consistent with the goal of standardizing telemetry measurement calls. This should improve the accuracy of telemetry measurements when enabled.


105-105: Telemetry measurement standardized.

The replacement of time.Now() with telemetry.Now() aligns with the goal of standardizing telemetry measurement calls. This change should enhance the accuracy of telemetry measurements when enabled.


139-139: Telemetry measurement standardized.

The substitution of time.Now() with telemetry.Now() is in line with the objective of standardizing telemetry measurement calls. This modification should improve the precision of telemetry measurements when enabled.


218-218: Telemetry measurement standardized.

The change from time.Now() to telemetry.Now() adheres to the goal of standardizing telemetry measurement calls. This alteration should enhance the accuracy of telemetry measurements when enabled.


301-301: Telemetry measurement standardized.

The replacement of time.Now() with telemetry.Now() is consistent with the objective of standardizing telemetry measurement calls. This change should improve the precision of telemetry measurements when enabled.


374-374: Telemetry measurement standardized across all functions.

The change from time.Now() to telemetry.Now() in this function, as well as in all previously reviewed functions (GetAllAttributes, GetAllAttributesAddr, GetAttributes, SetAttribute, UpdateAttribute, UpdateAttributeExpiration), consistently implements the standardization of telemetry measurement calls.

This systematic update across the keeper's methods should result in more accurate and efficient telemetry measurements when telemetry is enabled, without affecting the core functionality of the attribute management system.

testutil/assertions/events_test.go (8)

116-117: LGTM: Improved output formatting

The addition of the > character at the beginning of the output string enhances the visual distinction of event entries. This change is consistent with the modifications described in the summary and improves readability.


124-129: LGTM: Consistent formatting improvement

The addition of the > character at the beginning of each event's output string is consistent and improves the visual separation between different events. This change enhances the readability of the test output, making it easier to distinguish between multiple events.


328-329: LGTM: Consistent formatting in test cases

The addition of the > character at the beginning of the actual output string in the test case is consistent with the previous modifications. This change improves the visual distinction of the actual output, making it easier to compare expected and actual results in the test cases.


338-340: LGTM: Consistent formatting in expected output

The addition of the > character at the beginning of the expected output string in the test case maintains consistency with the previous modifications. This change enhances the visual distinction of the expected output, facilitating easier comparison between expected and actual results in the test cases.


355-358: LGTM: Consistent formatting across various test scenarios

The addition of the > character at the beginning of the output strings for both expected and actual results is consistent across various test scenarios. These changes improve the visual distinction of the output strings in different cases, including scenarios with different attribute keys, values, and indexed attributes. The uniform application of this formatting enhancement across multiple test cases improves overall readability and consistency.

Also applies to: 367-370, 379-382, 391-394


403-405: LGTM: Consistent formatting in complex test scenarios

The addition of the > character at the beginning of the output strings for both expected and actual results is consistently applied in more complex test scenarios. These changes enhance the visual distinction of the output strings in cases involving multiple attributes and events. The uniform application of this formatting improvement across various complex test cases contributes to better readability and easier comparison of test results.

Also applies to: 414-416, 425-430


442-444: LGTM: Comprehensive and consistent formatting improvements

The addition of the > character at the beginning of the output strings for events is consistently applied across various test functions and scenarios throughout the file. These changes significantly enhance the visual distinction of event outputs in a wide range of test cases, including:

  1. Different event types and attributes
  2. Scenarios with missing or extra events
  3. Comparisons between expected and actual results
  4. Complex cases with multiple events and attributes

This comprehensive update improves the overall readability of the test output, making it easier to identify and compare events in the test results. The consistency of these changes across the entire test suite is commendable and will contribute to better maintainability and debugging of the tests.

Also applies to: 456-458, 485-490, 644-648, 757-761, 781-785, 805-809, 830-834


Line range hint 1-909: Overall assessment: Consistent and beneficial formatting improvements

This review has covered all the changes made to the testutil/assertions/events_test.go file. The modifications consistently add a > character to the beginning of event output strings across various test functions and scenarios. These changes:

  1. Enhance the visual distinction of event entries in test outputs
  2. Improve readability and ease of comparison between expected and actual results
  3. Maintain consistency throughout the entire test suite
  4. Align with the objectives stated in the PR summary

The uniform application of these formatting improvements across different test cases and functions will contribute to better maintainability and easier debugging of the test suite. No issues or concerns were identified during this review.

x/marker/keeper/marker.go (16)

20-20: LGTM: Telemetry measurement updated

The change from time.Now() to telemetry.Now() is consistent with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


38-38: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous function and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


127-127: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


172-172: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


215-215: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


255-255: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


304-304: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


344-344: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


370-370: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


407-407: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


468-468: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


519-519: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


567-567: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


625-625: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


812-812: LGTM: Telemetry measurement updated consistently

The change from time.Now() to telemetry.Now() is consistent with the previous functions and aligns with the goal of improving telemetry measurements. This modification should provide more accurate timing when telemetry is enabled, without affecting the function's core logic.


Line range hint 20-812: Overall assessment: Consistent telemetry improvements

The changes in this file are uniform and focused on improving telemetry measurements by replacing time.Now() with telemetry.Now() across multiple functions. This modification should provide more accurate timing when telemetry is enabled, without affecting the core logic of any function. The consistency of these changes across the file is commendable and aligns well with the goal of enhancing performance monitoring capabilities.

Key points:

  1. All changes are consistent and isolated to telemetry measurements.
  2. No modifications to the logic or structure of the functions.
  3. The changes should improve the accuracy of performance measurements when telemetry is enabled.

These updates are well-implemented and should contribute to better performance monitoring of the marker-related operations in the Cosmos SDK application.

app/app.go (4)

25-25: Add clienthelpers import for helper functions

The addition of the clienthelpers import is appropriate for accessing helper functions used in the code, such as GetNodeHomeDirectory.


313-317: Initialize DefaultNodeHome using clienthelpers

The updated initialization of DefaultNodeHome using clienthelpers.GetNodeHomeDirectory("Provenance") simplifies the logic and leverages the clienthelpers package effectively. Setting clienthelpers.EnvPrefix = EnvPrefix ensures the environment variable prefix is correctly applied.

Error handling is appropriate, with a panic on failure to determine the node home directory.


345-352: Configure txConfig with custom signing options

The introduction of txConfigOpts and the use of authtx.NewTxConfigWithOptions allow for flexible transaction configuration with custom EnabledSignModes and SigningOptions. This ensures that transaction signing is properly configured.

Error handling is appropriate by panicking on initialization failure.


457-459: Validate signing context to ensure correct configuration

Including txConfig.SigningContext().Validate() ensures that the signing context is properly set up, catching any misconfigurations early in the initialization process. Panicking on error is acceptable here to prevent the application from running with invalid settings.

x/exchange/keeper/msg_server_test.go (2)

Line range hint 3115-3123: Ensure Proper Handling of Default Parameters

When updating params in TestMsgServer_UpdateParams, ensure that the default parameters are handled correctly, and no unintended changes are introduced.

Review the parameter validation logic to ensure that updating with default values does not cause any side effects.

#!/bin/bash
# Description: Verify that default params are handled correctly

rg --type go 'func\s+ValidateParams' x/exchange/keeper/params.go -A 20

Check the validation rules and update the tests if necessary.


Line range hint 2765-2772: Validate Error Messages for Consistency

In the test cases for TestMsgServer_MarketCommitmentSettle, the error messages in expInErr might not reflect the actual errors thrown by the system if error messages change in the future.

Run the following script to extract all error messages related to MarketCommitmentSettle and ensure that the test cases use the correct and up-to-date error messages.

Review the output and update the test cases accordingly.

app/prefix.go Show resolved Hide resolved
.golangci.yml Show resolved Hide resolved
app/app.go Show resolved Hide resolved
@SpicyLemon SpicyLemon added this to the v1.20.0 milestone Oct 11, 2024
@SpicyLemon SpicyLemon enabled auto-merge (squash) October 11, 2024 02:33
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9a2f724 and 1bac787.

📒 Files selected for processing (2)
  • .golangci.yml (1 hunks)
  • app/app.go (4 hunks)
🧰 Additional context used
📓 Learnings (2)
.golangci.yml (1)
Learnt from: SpicyLemon
PR: provenance-io/provenance#2175
File: .golangci.yml:87-87
Timestamp: 2024-10-10T23:08:15.256Z
Learning: The `depguard` definitions in `.golangci.yml` are prefixes (unless they end with `$`), so the entry `- cosmossdk.io/client/v2` covers imports from `cosmossdk.io/client/v2` and its subpackages like `autocli`. Changing imports from `cosmossdk.io/client/v2/autocli` to `cosmossdk.io/client/v2` in `app/app.go` would result in unresolved references because the required code resides in the `autocli` package.
app/app.go (1)
Learnt from: SpicyLemon
PR: provenance-io/provenance#2175
File: app/app.go:451-452
Timestamp: 2024-10-10T23:08:46.079Z
Learning: In `app/app.go` of the Provenance Blockchain (Go), the `txConfig` needs to be initialized in two stages because early components depend on a partially completed `txConfig`. The full setup of `txConfig` requires the `BankKeeper`, which isn't available until later in the initialization process. Therefore, `txConfig` is first initialized with essential options and then finalized after `BankKeeper` is created.
🔇 Additional comments (3)
.golangci.yml (1)

87-87: LGTM: Depguard rule updated to align with new cosmos-sdk version

The change from cosmossdk.io/client/v2/autocli to cosmossdk.io/client/v2 in the depguard rules aligns with the cosmos-sdk version update to v0.50.10-pio-1 mentioned in the PR objectives. This modification allows for broader import capabilities from the v2 package.

Important notes:

  1. This change doesn't require modifications to import statements in the actual code, as the depguard definitions are prefixes.
  2. The new rule will cover cosmossdk.io/client/v2/autocli and other subpackages under cosmossdk.io/client/v2.
app/app.go (2)

313-315: Proper error handling in initialization

The error handling for DefaultNodeHome, err = clienthelpers.GetNodeHomeDirectory("Provenance") is appropriate. The code correctly panics if an error occurs during initialization, ensuring that any issues are caught early in the startup process.


447-455: Re-initialization of 'txConfig' is appropriate

The two-stage initialization of txConfig is necessary due to dependencies on app.BankKeeper. The initial txConfig provides essential options required by early components, while the complete setup occurs after app.BankKeeper is available. This approach aligns with the application's initialization requirements.

app/app.go Show resolved Hide resolved
@SpicyLemon SpicyLemon enabled auto-merge (squash) October 14, 2024 16:09
@SpicyLemon SpicyLemon merged commit 488b8a7 into main Oct 14, 2024
35 checks passed
@SpicyLemon SpicyLemon deleted the dwedul/bump-sdk-to-50-10 branch October 14, 2024 16:20
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.

3 participants