-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: recipient address asset cases only #50
Conversation
WalkthroughThe changes involve significant modifications to asset-related structures and their validation logic across multiple files. The Changes
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
=======================================
Coverage 68.88% 68.88%
=======================================
Files 3 3
Lines 376 376
=======================================
Hits 259 259
Misses 94 94
Partials 23 23
Flags with carried forward coverage won't be shown. Click here to find out more. |
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 (1)
gen/go/proto/v1/asset.pb.go
is excluded by!**/*.pb.go
Files selected for processing (6)
- gen/go/proto/v1/asset.pb.validate.go (23 hunks)
- gen/ts/proto/v1/asset_pb.d.ts (6 hunks)
- gen/ts/proto/v1/asset_pb.ts (8 hunks)
- intents_test.go (9 hunks)
- proto/v1/asset.proto (4 hunks)
- userops_ext_test.go (3 hunks)
Additional comments not posted (25)
proto/v1/asset.proto (3)
Line range hint
28-38
: LGTM!The
FromAsset
message is correctly defined with appropriate validation rules.
40-53
: LGTM!The
ToAsset
message is correctly defined with appropriate validation rules.
80-100
: LGTM! But verify the impact of field renumbering.The changes to the
Intent
message are correctly implemented. However, ensure that the renumbering ofcreated_at
andexpiration_at
fields does not affect serialization and deserialization.Run the following script to verify the impact of field renumbering:
Verification successful
Field renumbering appears correct, but verify in a testing environment.
The
created_at
andexpiration_at
fields have been renumbered correctly in theproto/v1/asset.proto
file and the changes are reflected in the generated TypeScript files. Ensure to test these changes in a testing environment to confirm that serialization and deserialization are not affected.
proto/v1/asset.proto
: Fieldscreated_at = 9
andexpiration_at = 10
are present.gen/ts/proto/v1/asset_pb.d.ts
andgen/ts/proto/v1/asset_pb.ts
: Reflect the renumbered fields.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of field renumbering in the `Intent` message. # Test: Search for the usage of `created_at` and `expiration_at` fields. Expect: Only occurrences of the new field numbers. rg --type proto -A 5 $'created_at = 9' rg --type proto -A 5 $'expiration_at = 10'Length of output: 143
Script:
#!/bin/bash # Description: Verify the impact of field renumbering in the `Intent` message. # Test: Search for the usage of `created_at` and `expiration_at` fields without specifying file type. rg -A 5 'created_at = 9' rg -A 5 'expiration_at = 10'Length of output: 2104
intents_test.go (8)
88-101
: LGTM!The changes to the test case for a valid request with TOKEN assets are correctly implemented.
116-129
: LGTM!The changes to the test case for an invalid request with an invalid Ethereum address format are correctly implemented.
144-157
: LGTM!The changes to the test case for a valid operation without an expiration date are correctly implemented.
169-182
: LGTM!The changes to the test case for a valid operation with an expiration date are correctly implemented.
Line range hint
197-210
: LGTM!The changes to the test case for a valid operation with staking are correctly implemented.
Line range hint
232-245
: LGTM!The changes to the test case for a valid operation with unstaking are correctly implemented.
259-262
: LGTM!The changes to the test case for a valid operation with a correct recipient are correctly implemented.
287-290
: LGTM!The changes to the test case for an invalid operation with an incorrect recipient are correctly implemented.
gen/ts/proto/v1/asset_pb.d.ts (3)
Line range hint
101-140
: LGTM!The
FromAsset
class is correctly defined with appropriate methods for binary and JSON serialization.
142-190
: LGTM!The
ToAsset
class is correctly defined with appropriate methods for binary and JSON serialization.
Line range hint
299-369
: LGTM! But verify the impact of field renumbering.The changes to the
Intent
class are correctly implemented. However, ensure that the renumbering ofcreated_at
andexpiration_at
fields does not affect serialization and deserialization.Run the following script to verify the impact of field renumbering:
Verification successful
Field Renumbering Verified: Check Serialization/Deserialization Logic
The renumbering of
created_at
to9
andexpiration_at
to10
is consistent across the TypeScript files. Ensure that these changes do not affect serialization or deserialization processes elsewhere in the codebase.
- Files Checked:
gen/ts/proto/v1/asset_pb.d.ts
gen/ts/proto/v1/asset_pb.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of field renumbering in the `Intent` class. # Test: Search for the usage of `created_at` and `expiration_at` fields. Expect: Only occurrences of the new field numbers. rg --type ts -A 5 $'created_at = 9' rg --type ts -A 5 $'expiration_at = 10'Length of output: 1380
gen/ts/proto/v1/asset_pb.ts (3)
Line range hint
385-475
: LGTM! But verify the class usage in the codebase.The class is correctly implemented. However, ensure that all references to the old
Asset
class have been updated toFromAsset
andToAsset
.The code changes are approved.
Run the following script to verify the class usage:
Verification successful
Verification Successful: No Issues Found with Class Usage
The
FromAsset
andToAsset
classes are correctly implemented and used throughout the codebase. There are no remaining references to the oldAsset
class. The changes have been properly propagated.
- All references to the old
Asset
class have been updated toFromAsset
andToAsset
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Asset` class have been updated to `FromAsset` and `ToAsset`. # Test: Search for the old class name. Expect: No occurrences of the old class name. rg --type ts -A 5 $'Asset'Length of output: 12664
181-244
: LGTM! But verify the class usage in the codebase.The class is correctly implemented. However, ensure that all references to the new
ToAsset
class are correctly integrated.The code changes are approved.
Run the following script to verify the class usage:
Verification successful
Verification complete: The
ToAsset
class is self-contained.The
ToAsset
class is defined and used within the same file,gen/ts/proto/v1/asset_pb.ts
, and its TypeScript definition file. There are no external references found in other parts of the codebase, indicating that the class is self-contained within these generated files. No further action is needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the new `ToAsset` class are correctly integrated. # Test: Search for the new class name. Expect: Occurrences of the new class name in relevant files. rg --type ts -A 5 $'ToAsset'Length of output: 5582
Line range hint
125-179
: LGTM! But verify the class usage in the codebase.The class is correctly implemented. However, ensure that all references to the old
Asset
class have been updated toFromAsset
.The code changes are approved.
Run the following script to verify the class usage:
Verification successful
The
Asset
class has been successfully replaced byFromAsset
. The search for the specific class nameAsset
yielded no results, confirming that the old class has been removed or renamed. No further action is required.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Asset` class have been updated to `FromAsset`. # Test: Search for the old class name. Expect: No occurrences of the old class name. rg --type ts -A 5 $'Asset'Length of output: 12664
Script:
#!/bin/bash # Description: Specifically search for the old `Asset` class to confirm its replacement. # Test: Search for the specific class name `Asset`. Expect: No occurrences of the old class name. rg --type ts -A 5 $'class Asset'Length of output: 33
gen/go/proto/v1/asset.pb.validate.go (6)
Line range hint
138-221
: LGTM! But verify the method usage in the codebase.The method is correctly implemented. However, ensure that all references to the old
Asset
validation method have been updated toFromAsset
.The code changes are approved.
Run the following script to verify the method usage:
Verification successful
Transition to
FromAsset
Validation Methods VerifiedThe
FromAsset
validation methods are correctly used and referenced throughout the codebase, including in test files. No references to the oldAsset
validation method were found, indicating a successful transition. No issues were found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Asset` validation method have been updated to `FromAsset`. # Test: Search for the old method name. Expect: No occurrences of the old method name. rg --type go -A 5 $'Validate() error'Length of output: 38
Script:
#!/bin/bash # Description: Verify the usage of `FromAsset` validation methods in the codebase. # Test: Search for `FromAsset` method usages. Expect: Occurrences of `FromAsset` validation methods. rg --type go -A 5 'FromAsset'Length of output: 20234
Line range hint
775-860
: LGTM! But verify the method usage in the codebase.The method is correctly implemented. However, ensure that all references to the old
Intent
validation method have been updated.The code changes are approved.
Run the following script to verify the method usage:
Verification successful
No external usage of
Intent.Validate
andIntent.ValidateAll
methods found.The
Intent.Validate
andIntent.ValidateAll
methods are not used outside their definition file (gen/go/proto/v1/asset.pb.validate.go
). This confirms that the changes do not impact other parts of the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Intent` validation method have been updated. # Test: Search for the old method name. Expect: No occurrences of the old method name. rg --type go -A 5 $'Validate() error'Length of output: 38
Script:
#!/bin/bash # Description: Verify the usage of `Intent.Validate` and `Intent.ValidateAll` methods in the codebase. # Search for the usage of `Intent.Validate` method. rg --type go 'Intent.*\.Validate\(' -A 5 # Search for the usage of `Intent.ValidateAll` method. rg --type go 'Intent.*\.ValidateAll\(' -A 5Length of output: 538
617-701
: LGTM! But verify the method usage in the codebase.The method is correctly implemented. However, ensure that all references to the old
Loan
validation method have been updated.The code changes are approved.
Run the following script to verify the method usage:
Verification successful
No external usage of
Loan.Validate
andLoan.ValidateAll
methods found.The
Loan.Validate
andLoan.ValidateAll
methods are not used outside thegen/go/proto/v1/asset.pb.validate.go
file, indicating no outdated references exist. The implementation is consistent with the rest of the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Loan` validation method have been updated. # Test: Search for the old method name. Expect: No occurrences of the old method name. rg --type go -A 5 $'Validate() error'Length of output: 38
Script:
#!/bin/bash # Description: Verify the usage of `Loan.Validate` and `Loan.ValidateAll` methods in the codebase. # Search for the usage of `Loan.Validate` method. rg --type go 'Loan.*\.Validate\(' -A 3 # Search for the usage of `Loan.ValidateAll` method. rg --type go 'Loan.*\.ValidateAll\(' -A 3Length of output: 394
Line range hint
297-383
: LGTM! But verify the method usage in the codebase.The method is correctly implemented. However, ensure that all references to the new
ToAsset
validation method are correctly integrated.The code changes are approved.
Run the following script to verify the method usage:
Line range hint
459-541
: LGTM! But verify the method usage in the codebase.The method is correctly implemented. However, ensure that all references to the old
Stake
validation method have been updated toToAsset
.The code changes are approved.
Run the following script to verify the method usage:
Verification successful
Validation Method Usage Verified
The
Validate
method for theStake
struct is correctly implemented and used in the codebase. TheToAsset
method and related structures are used extensively, but they do not replace theStake
validation method. No further action is needed.
Validate
method is present ingen/go/proto/v1/asset.pb.validate.go
.ToAsset
is used in various parts of the codebase, including tests.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Stake` validation method have been updated to `ToAsset`. # Test: Search for the old method name. Expect: No occurrences of the old method name. rg --type go -A 5 $'Validate() error'Length of output: 38
Script:
#!/bin/bash # Description: Specifically search for the `Validate` method in the context of the `Stake` struct. # Test: Search for the `Validate` method in the context of the `Stake` struct. ast-grep --lang go --pattern $'func (m *Stake) Validate() error { $$$ }' # Additionally, search for any `ToAsset` method usage if it is supposed to replace the old validation method. rg --type go 'ToAsset'Length of output: 6191
Line range hint
889-973
: LGTM! But verify the method usage in the codebase.The method is correctly implemented. However, ensure that all references to the old
Body
validation method have been updated.The code changes are approved.
Run the following script to verify the method usage:
Verification successful
Validation Logic Correctly Implemented
The methods
GetFromAsset
,GetFromStake
, andGetFromLoan
are correctly defined and used in the validation logic. The validation checks for bothValidateAll
andValidate
methods, ensuring comprehensive validation. No issues were found with the method usage in the codebase.
gen/go/proto/v1/asset.pb.validate.go
: Validation logic forFromAsset
,FromStake
, andFromLoan
.gen/go/proto/v1/asset.pb.go
: Definitions ofGetFromAsset
,GetFromStake
, andGetFromLoan
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the old `Body` validation method have been updated. # Test: Search for the old method name. Expect: No occurrences of the old method name. rg --type go -A 5 $'Validate() error'Length of output: 38
Script:
#!/bin/bash # Description: Verify usage of specific methods related to validation in the codebase. # Search for occurrences of GetFromAsset, GetFromStake, and GetFromLoan methods. rg --type go -A 5 'GetFromAsset' rg --type go -A 5 'GetFromStake' rg --type go -A 5 'GetFromLoan'Length of output: 4193
userops_ext_test.go (2)
635-671
: LGTM! But consider adding more test cases.The test case is correctly updated to include the new fields. However, consider adding additional test cases to cover edge cases, such as invalid date formats or missing fields.
The code changes are approved.
635-671
: LGTM! But verify the function usage in the codebase.The function is correctly generating a JSON string with the new fields. However, ensure that all references to
mockIntentJSON
are updated to handle the new fields and the removal of the "extraData" field.The code changes are approved.
Run the following script to verify the function usage:
Verification successful
Function usage is consistent with the new structure.
The
mockIntentJSON
function is used consistently throughout theuserops_ext_test.go
file, and the new fields "createdAt" and "expirationAt" are handled correctly. There are no references to the removed "extraData" field.
- All occurrences of
mockIntentJSON
match the new structure.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `mockIntentJSON` match the new structure. # Test: Search for the function usage. Expect: Only occurrences of the new structure. rg --type go -A 5 $'mockIntentJSON'Length of output: 5639
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: 1
Outside diff range, codebase verification and nitpick comments (1)
README.md (1)
62-65
: Consider using a stronger verb.The Contributing section is clear and encourages community contributions. Consider using a stronger verb to enhance the wording.
-Contributions to the Protocol Registry Package are welcome! +We welcome contributions to the Protocol Registry Package!Tools
LanguageTool
[style] ~64-~64: Consider using a different verb to strengthen your wording.
Context: ...ol Registry Package are welcome! If you find any issues or have suggestions for impr...(FIND_ENCOUNTER)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- .github/workflows/release.yml (2 hunks)
- LICENSE (1 hunks)
- README.md (1 hunks)
Files skipped from review due to trivial changes (1)
- LICENSE
Additional context used
LanguageTool
README.md
[style] ~64-~64: Consider using a different verb to strengthen your wording.
Context: ...ol Registry Package are welcome! If you find any issues or have suggestions for impr...(FIND_ENCOUNTER)
actionlint
.github/workflows/release.yml
42-42: shellcheck reported issue in this script: SC2129:style:4:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
42-42: shellcheck reported issue in this script: SC2086:info:4:26: Double quote to prevent globbing and word splitting
(shellcheck)
42-42: shellcheck reported issue in this script: SC2086:info:5:22: Double quote to prevent globbing and word splitting
(shellcheck)
42-42: shellcheck reported issue in this script: SC2086:info:6:15: Double quote to prevent globbing and word splitting
(shellcheck)
Additional comments not posted (3)
README.md (2)
57-61
: LGTM!The Release section is well-structured and provides essential information for users.
66-68
: LGTM!The License section is clear and provides essential information about the licensing terms.
.github/workflows/release.yml (1)
60-73
: LGTM!The step ensures that the README.md file is updated with the latest release information.
redundent |
Summary by CodeRabbit
New Features
FromAsset
andToAsset
classes for improved asset handling.Recipient
field toToAsset
for specifying the recipient address.Bug Fixes
ExtraData
field from various structures to simplify the data model.Documentation
README.md
with new sections for releases, contributions, and licensing.Chores