-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: migrate to v0.50 #20
Conversation
WalkthroughThe changes encompass a comprehensive update to import paths and types across various files, transitioning from Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
go.sum
is excluded by!**/*.sum
Files selected for processing (17)
- .github/workflows/unit-tests.yml (1 hunks)
- collections_test.go (1 hunks)
- examples/1.go (1 hunks)
- examples/2.go (2 hunks)
- examples/3.go (2 hunks)
- indexed_map.go (1 hunks)
- indexers.go (1 hunks)
- item.go (1 hunks)
- iter.go (5 hunks)
- keys.go (3 hunks)
- keys_test.go (2 hunks)
- keyset.go (1 hunks)
- map.go (3 hunks)
- map_test.go (2 hunks)
- sequence.go (1 hunks)
- value_encoder.go (2 hunks)
- value_encoder_test.go (2 hunks)
Files skipped from review due to trivial changes (4)
- .github/workflows/unit-tests.yml
- indexed_map.go
- item.go
- keyset.go
Additional comments not posted (22)
collections_test.go (3)
4-9
: Updated import paths to align with new package structures.
16-19
: The initialization ofNewCommitMultiStore
now includes additional parameters for logging and metrics. Ensure that these changes are reflected whereverNewCommitMultiStore
is used.Verification successful
The search results indicate that the only instance of
NewCommitMultiStore
found is incollections_test.go
, and it correctly includes the new parameters for logging and metrics.
collections_test.go
:ms := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
No other instances were found in the codebase, suggesting that the changes are correctly reflected where
NewCommitMultiStore
is used.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all instances of `NewCommitMultiStore` include the new parameters. # Test: Search for the function usage. Expect: All occurrences should include the new parameters. rg --type python $'NewCommitMultiStore'Length of output: 69
Script:
#!/bin/bash # Description: Verify that all instances of `NewCommitMultiStore` include the new parameters. # Test: Search for the function usage. Expect: All occurrences should include the new parameters. rg --type go 'NewCommitMultiStore'Length of output: 137
27-27
: UpdatedWithGasMeter
to usestoretypes.NewGasMeter
. Verify that this change is compatible with the expected behavior in the context where it's used.Verification successful
The search results show that
WithGasMeter
is used in the context of setting up asdk.Context
with aMultiStore
and aGasMeter
incollections_test.go
. Thestoretypes.NewGasMeter
function is used to create a new gas meter with a specified limit.Given this context, the change appears to be compatible with the expected behavior, as
storetypes.NewGasMeter
is correctly used to initialize the gas meter.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new `NewGasMeter` behaves as expected in all usage contexts. # Test: Search for the function usage. Expect: All occurrences should be checked for compatibility. rg --type python $'WithGasMeter'Length of output: 62
Script:
#!/bin/bash # Description: Verify that the new `NewGasMeter` behaves as expected in all usage contexts. # Test: Search for the function usage. Expect: All occurrences should be checked for compatibility. rg --type go 'WithGasMeter'Length of output: 103
Script:
#!/bin/bash # Description: Extract the relevant code block from `collections_test.go` to verify the usage of `storetypes.NewGasMeter`. # Extract 10 lines before and after the occurrence of `WithGasMeter` for context. rg --type go -A 10 -B 10 'WithGasMeter' collections_test.goLength of output: 446
sequence.go (1)
6-6
: Updated import path to align with new package structures.examples/2.go (2)
4-5
: Updated import paths to align with new package structures.
32-32
: Replacedsdk.MustNewDecFromStr
withmath.LegacyMustNewDecFromStr
to align with the newmath
package. Ensure that the behavior ofLegacyMustNewDecFromStr
matches the expectations in this context.examples/1.go (1)
4-4
: Updated import path to align with new package structures.examples/3.go (2)
4-4
: Updated import path to align with new package structures.
59-60
: Adjusted theCreateValidator
method to convert operator addresses before insertion. Verify that the address conversion and subsequent insertion behave as expected.keys_test.go (2)
11-11
: Updated import path to align with new package structures.
102-106
: Replaced references tosdk.NewDec
withmath.LegacyNewDec
andsdk.ZeroDec
withmath.LegacyZeroDec
. Ensure that these replacements are compatible with the expected behavior in the test scenarios.value_encoder_test.go (3)
93-93
: Updated theIntValueEncoder
to usemath.NewInt
. Ensure that the behavior ofNewInt
matches the expectations in the value encoding and decoding scenarios.
39-39
: Replacedsdk.MustNewDecFromStr
withmath.LegacyMustNewDecFromStr
in the test for bijectivity. Verify that the behavior ofLegacyMustNewDecFromStr
matches the expectations in this test scenario.
63-81
: Updated theIntKeyEncoder
to usemath.NewInt
instead ofsdk.NewInt
. Ensure that the behavior ofNewInt
matches the expectations in the encoding and decoding scenarios.value_encoder.go (3)
15-15
: UpdatedDecValueEncoder
to usemath.LegacyDec
. Ensure that the behavior ofLegacyDec
matches the expectations in the encoding and decoding scenarios.
69-74
: Updated thedecValueEncoder
to return"math.LegacyDec"
as its name. Verify that this change is reflected wherever theName
method is used.
52-61
: Updated thedecValueEncoder
methods to handlemath.LegacyDec
. Ensure that the error handling and data integrity are maintained during the encoding and decoding processes.Verification successful
The
Encode
andDecode
methods ofdecValueEncoder
have been updated to handlemath.LegacyDec
and include error handling. Both methods usepanic
to handle errors, which may not be ideal for all use cases, but they do ensure that errors are not silently ignored.
Encode
method:
- Marshals the
math.LegacyDec
value.- Panics with a formatted error message if marshalling fails.
- Returns the marshalled byte slice.
Decode
method:
- Unmarshals the byte slice into a
math.LegacyDec
value.- Panics with a formatted error message if unmarshalling fails.
- Returns the unmarshalled
math.LegacyDec
value.These methods maintain data integrity by ensuring that any errors during encoding or decoding are immediately surfaced.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that error handling and data integrity are maintained during the encoding and decoding processes. # Test: Search for the function usage. Expect: All occurrences should be checked for compatibility. rg --type python $'decValueEncoder'Length of output: 65
Script:
#!/bin/bash # Description: Verify that error handling and data integrity are maintained during the encoding and decoding processes. # Test: Search for the function usage. Expect: All occurrences should be checked for compatibility. rg 'decValueEncoder'Length of output: 454
Script:
#!/bin/bash # Description: Extract the full implementation of `decValueEncoder` methods to verify error handling and data integrity. # Extract the implementation of `decValueEncoder` methods. ast-grep --lang go --pattern $'type decValueEncoder struct { $$$ } func (d decValueEncoder) Encode(value math.LegacyDec) []byte { $$$ } func (d decValueEncoder) Decode(b []byte) math.LegacyDec { $$$ } func (d decValueEncoder) Stringify(value math.LegacyDec) string { $$$ } func (d decValueEncoder) Name() string { $$$ }' value_encoder.goLength of output: 1069
Script:
#!/bin/bash # Description: Extract the implementation of `decValueEncoder.Encode` and `decValueEncoder.Decode` methods to verify error handling and data integrity. # Extract the implementation of `decValueEncoder.Encode` method. ast-grep --lang go --pattern $'func (d decValueEncoder) Encode(value math.LegacyDec) []byte { $$$ }' value_encoder.go # Extract the implementation of `decValueEncoder.Decode` method. ast-grep --lang go --pattern $'func (d decValueEncoder) Decode(b []byte) math.LegacyDec { $$$ }' value_encoder.goLength of output: 910
map_test.go (1)
27-27
: Update toGetStore
method signature aligns with new package structure.map.go (1)
87-87
: UpdatedGetStore
methods inMap
andMapTransient
use new package structure correctly.Also applies to: 109-109
indexers.go (1)
4-4
: Updated import path aligns with new package structure.keys.go (1)
130-130
: UpdatedSdkDecKeyEncoder
methods usemath.LegacyDec
correctly.Also applies to: 132-132, 140-140
iter.go (1)
108-108
: UpdatediteratorFromRange
function uses new package structure correctly.Also applies to: 136-136, 154-154
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- collections_test.go (1 hunks)
- examples/1.go (2 hunks)
- examples/3.go (3 hunks)
- indexed_map.go (2 hunks)
- indexers.go (2 hunks)
- item.go (2 hunks)
- keyset.go (2 hunks)
- map.go (5 hunks)
- sequence.go (2 hunks)
- value_encoder.go (4 hunks)
Files skipped from review as they are similar to previous changes (10)
- collections_test.go
- examples/1.go
- examples/3.go
- indexed_map.go
- indexers.go
- item.go
- keyset.go
- map.go
- sequence.go
- value_encoder.go
Summary by CodeRabbit
Chores
Refactor
sdk
withstore
andmath.Legacy
across multiple files for consistency.Tests
math.LegacyNewDec
andmath.LegacyZeroDec
for decimal values.