-
Notifications
You must be signed in to change notification settings - Fork 10
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 chain.get_block_txn_infos getObjectArray error. #60
Conversation
WalkthroughThe update primarily focuses on enhancing dependency versions, switching JSON processing libraries from Jackson to Fastjson, and removing redundant annotations in multiple files. No major functional changes were introduced, ensuring compatibility and improving maintainability. Changes
Poem
Tip Early access features
Note:
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 (
|
Most code diff see this url https://github.com/starcoinorg/starcoin-java/compare/fix_json_rpc_parse..fix_stc_supply |
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: 4
Outside diff range and nitpick comments (9)
src/main/java/org/starcoin/bean/EventProof.java (1)
Line range hint
3-3
: Remove unused@JsonProperty
imports.The
@JsonProperty
annotations are not used in this file and should be removed to maintain consistency.-import com.fasterxml.jackson.annotation.JsonProperty;
src/main/java/org/starcoin/bean/Ed25519.java (1)
Line range hint
3-3
: Remove unused@JsonProperty
imports.The
@JsonProperty
annotations are not used in this file and should be removed to maintain consistency.-import com.fasterxml.jackson.annotation.JsonProperty;
src/main/java/org/starcoin/bean/Authenticator.java (1)
Line range hint
3-3
: Remove unused@JsonProperty
imports.The
@JsonProperty
annotations are not used in this file and should be removed to maintain consistency.-import com.fasterxml.jackson.annotation.JsonProperty;
src/test/java/org/starcoin/api/ContractRPCClientTestCase.java (1)
Line range hint
44-44
: Fix typo in method call.Ensure the method call
getSTCTreasurBalance
is updated togetSTCTreasuryBalance
to match the corrected method name.- BigInteger balance = tokenContractRPCClient.getSTCTreasurBalance(); + BigInteger balance = tokenContractRPCClient.getSTCTreasuryBalance();src/main/java/org/starcoin/bean/RawTransaction.java (2)
Line range hint
14-14
: Ensure Consistent JSON Annotations.The use of both
@JSONField
and@JsonProperty
annotations can lead to inconsistencies. Sincecom.alibaba.fastjson
is now being used, consider removing@JsonProperty
annotations if they are no longer needed.- import com.fasterxml.jackson.annotation.JsonProperty;
[!TIP]
Codebase VerificationEnsure Correct JSON Deserialization.
The
CustomStringDeserializer
is tightly coupled with Jackson and cannot be directly used withcom.alibaba.fastjson
. You should either remove the Jackson-specific annotations or create an equivalent deserializer usingfastjson
's APIs.
src/main/java/org/starcoin/bean/RawTransaction.java
src/main/java/org/starcoin/bean/Event.java
src/main/java/org/starcoin/bean/Transaction.java
Analysis chain
Line range hint
18-18
: Ensure Correct JSON Deserialization.The
@JsonDeserialize
annotation is from Jackson. If you are moving tocom.alibaba.fastjson
, ensure there is equivalent functionality or remove the Jackson-specific annotations.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if CustomStringDeserializer is compatible with com.alibaba.fastjson. # Test: Search for CustomStringDeserializer usage. Expect: Compatibility with fastjson. rg --type java CustomStringDeserializerLength of output: 495
Script:
#!/bin/bash # Description: Check the implementation of CustomStringDeserializer for Jackson-specific dependencies. # Retrieve the implementation of CustomStringDeserializer. ast-grep --lang java --pattern 'class CustomStringDeserializer extends JsonDeserializer { $$$ }' # Search for usages of `@JSONField` to identify any custom deserialization logic in fastjson. rg --type java '@JSONField'Length of output: 11957
Script:
#!/bin/bash # Description: Retrieve the full implementation of CustomStringDeserializer for detailed analysis. # Get the full content of CustomStringDeserializer.java. cat $(fd CustomStringDeserializer.java)Length of output: 1725
src/main/java/org/starcoin/bean/Transaction.java (2)
Line range hint
14-14
: Ensure Consistent JSON Annotations.The use of both
@JSONField
and@JsonProperty
annotations can lead to inconsistencies. Sincecom.alibaba.fastjson
is now being used, consider removing@JsonProperty
annotations if they are no longer needed.- import com.fasterxml.jackson.annotation.JsonProperty;
[!TIP]
Codebase VerificationEnsure Correct JSON Deserialization
The
CustomStringDeserializer
class extends Jackson'sJsonDeserializer
, and there are no indications of it being adapted forcom.alibaba.fastjson
or anyfastjson
deserializers in the codebase. Please ensure that the deserialization functionality is properly migrated tofastjson
or equivalent.
src/main/java/org/starcoin/bean/Transaction.java
src/main/java/org/starcoin/bean/RawTransaction.java
src/main/java/org/starcoin/bean/Event.java
src/main/java/org/starcoin/bean/CustomStringDeserializer.java
Analysis chain
Line range hint
19-19
: Ensure Correct JSON Deserialization.The
@JsonDeserialize
annotation is from Jackson. If you are moving tocom.alibaba.fastjson
, ensure there is equivalent functionality or remove the Jackson-specific annotations.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if CustomStringDeserializer is compatible with com.alibaba.fastjson. # Test: Search for CustomStringDeserializer usage. Expect: Compatibility with fastjson. rg --type java CustomStringDeserializerLength of output: 495
Script:
#!/bin/bash # Description: Verify if CustomStringDeserializer or any fastjson deserializers are implemented in the codebase. # Search for CustomStringDeserializer to see if it's been adapted for fastjson rg --type java 'CustomStringDeserializer' # Search for fastjson deserializers rg --type java 'com.alibaba.fastjson.parser.deserializer'Length of output: 553
src/main/java/org/starcoin/bean/BlockHeader.java (1)
Line range hint
14-14
: Ensure Consistent JSON Annotations.The use of both
@JSONField
and@JsonIgnoreProperties
annotations can lead to inconsistencies. Sincecom.alibaba.fastjson
is now being used, consider removing@JsonIgnoreProperties
annotations if they are no longer needed.- import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (35)
- README.md (1 hunks)
- pom.xml (2 hunks)
- src/main/java/org/starcoin/api/BlockRPCClient.java (2 hunks)
- src/main/java/org/starcoin/api/ContractRPCClient.java (1 hunks)
- src/main/java/org/starcoin/api/JsonRPCClient.java (5 hunks)
- src/main/java/org/starcoin/api/StateRPCClient.java (4 hunks)
- src/main/java/org/starcoin/api/TokenContractRPCClient.java (3 hunks)
- src/main/java/org/starcoin/api/TransactionRPCClient.java (1 hunks)
- src/main/java/org/starcoin/bean/AccountProof.java (1 hunks)
- src/main/java/org/starcoin/bean/AccumulatorNode.java (1 hunks)
- src/main/java/org/starcoin/bean/Authenticator.java (2 hunks)
- src/main/java/org/starcoin/bean/BaseProof.java (1 hunks)
- src/main/java/org/starcoin/bean/Block.java (1 hunks)
- src/main/java/org/starcoin/bean/BlockBody.java (1 hunks)
- src/main/java/org/starcoin/bean/BlockGhostdagData.java (1 hunks)
- src/main/java/org/starcoin/bean/BlockHeader.java (2 hunks)
- src/main/java/org/starcoin/bean/BlockInfo.java (1 hunks)
- src/main/java/org/starcoin/bean/BlockMetadata.java (1 hunks)
- src/main/java/org/starcoin/bean/Ed25519.java (1 hunks)
- src/main/java/org/starcoin/bean/Event.java (1 hunks)
- src/main/java/org/starcoin/bean/EventFilter.java (1 hunks)
- src/main/java/org/starcoin/bean/EventProof.java (1 hunks)
- src/main/java/org/starcoin/bean/ListResourceOption.java (2 hunks)
- src/main/java/org/starcoin/bean/RawTransaction.java (1 hunks)
- src/main/java/org/starcoin/bean/StateProof.java (1 hunks)
- src/main/java/org/starcoin/bean/TokenInfo.java (1 hunks)
- src/main/java/org/starcoin/bean/Transaction.java (1 hunks)
- src/main/java/org/starcoin/bean/TransactionInfo.java (1 hunks)
- src/main/java/org/starcoin/bean/TransactionInfoWithProof.java (1 hunks)
- src/main/java/org/starcoin/bean/UserTransaction.java (1 hunks)
- src/test/java/org/starcoin/api/BlockRPCClientTest.java (1 hunks)
- src/test/java/org/starcoin/api/ContractRPCClientTestCase.java (1 hunks)
- src/test/java/org/starcoin/api/StateRPCClientTest.java (1 hunks)
- src/test/java/org/starcoin/api/TransactionRPCClientTest.java (1 hunks)
- src/test/java/org/starcoin/api/TvlTest.java (1 hunks)
Files skipped from review due to trivial changes (12)
- pom.xml
- src/main/java/org/starcoin/bean/AccountProof.java
- src/main/java/org/starcoin/bean/AccumulatorNode.java
- src/main/java/org/starcoin/bean/BaseProof.java
- src/main/java/org/starcoin/bean/Block.java
- src/main/java/org/starcoin/bean/BlockInfo.java
- src/main/java/org/starcoin/bean/ListResourceOption.java
- src/main/java/org/starcoin/bean/StateProof.java
- src/main/java/org/starcoin/bean/TransactionInfo.java
- src/main/java/org/starcoin/bean/TransactionInfoWithProof.java
- src/main/java/org/starcoin/bean/UserTransaction.java
- src/test/java/org/starcoin/api/TransactionRPCClientTest.java
Additional context used
LanguageTool
README.md
[uncategorized] ~53-~53: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:好"地"包
Context: ...m/starcoinorg/starcoin) 下载 starcoin 预编译好的包。通过如下命令启动 dev 测试网,当然你也可以启动其他网络如 barnard...(wb4)
Markdownlint
README.md
29-29: Expected: 0 or 2; Actual: 1
Trailing spaces(MD009, no-trailing-spaces)
35-35: Expected: 0 or 2; Actual: 1
Trailing spaces(MD009, no-trailing-spaces)
41-41: Expected: 0 or 2; Actual: 1
Trailing spaces(MD009, no-trailing-spaces)
47-47: Expected: 0 or 2; Actual: 1
Trailing spaces(MD009, no-trailing-spaces)
226-226: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
114-114: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines(MD022, blanks-around-headings)
115-115: null
Fenced code blocks should be surrounded by blank lines(MD031, blanks-around-fences)
16-16: null
Emphasis used instead of a heading(MD036, no-emphasis-as-heading)
27-27: null
Emphasis used instead of a heading(MD036, no-emphasis-as-heading)
33-33: null
Emphasis used instead of a heading(MD036, no-emphasis-as-heading)
39-39: null
Emphasis used instead of a heading(MD036, no-emphasis-as-heading)
45-45: null
Emphasis used instead of a heading(MD036, no-emphasis-as-heading)
29-29: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
35-35: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
41-41: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
47-47: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
56-56: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
62-62: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
86-86: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
99-99: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
115-115: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
138-138: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
171-171: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
190-190: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
197-197: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
210-210: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
234-234: null
Files should end with a single newline character(MD047, single-trailing-newline)
Gitleaks
README.md
87-87: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
88-88: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
102-102: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
118-118: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
141-141: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
174-174: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
Additional comments not posted (21)
src/main/java/org/starcoin/bean/BlockBody.java (2)
Line range hint
11-11
: Confirm the correctness of annotation change.The
@JSONField
annotation is used for JSON serialization with Alibaba FastJSON. Ensure that the new annotation provides the expected serialization behavior.
Line range hint
14-14
: Confirm the correctness of annotation change.The
@JSONField
annotation is used for JSON serialization with Alibaba FastJSON. Ensure that the new annotation provides the expected serialization behavior.src/main/java/org/starcoin/api/ContractRPCClient.java (2)
18-18
: Confirm the correctness of import statement change.The import statement for
JSONRPC2Session
has been updated to usecom.thetransactioncompany.jsonrpc2.client
. Ensure that the new library provides the expected functionality.
19-19
: Confirm the correctness of import statement change.The import statement for
JSONRPC2SessionException
has been updated to usecom.thetransactioncompany.jsonrpc2.client
. Ensure that the new library provides the expected functionality.src/test/java/org/starcoin/api/ContractRPCClientTestCase.java (1)
3-3
: Update import statement.The import statement for
JSONRPC2SessionException
has been updated to usecom.thetransactioncompany.jsonrpc2.client
.src/test/java/org/starcoin/api/TvlTest.java (1)
5-5
: Update import statement.The import statement for
JSONRPC2SessionException
has been updated to usecom.thetransactioncompany.jsonrpc2.client
.src/main/java/org/starcoin/bean/BlockGhostdagData.java (1)
Line range hint
6-6
: Update JSON serialization annotations.The JSON serialization annotations have been updated to use
@JSONField
fromcom.alibaba.fastjson.annotation
instead of@JsonProperty
fromcom.fasterxml.jackson.annotation
.src/test/java/org/starcoin/api/BlockRPCClientTest.java (1)
4-4
: LGTM!The import statement has been updated to use
JSONRPC2SessionException
fromcom.thetransactioncompany.jsonrpc2.client
.src/main/java/org/starcoin/bean/BlockMetadata.java (1)
Line range hint
1-74
: LGTM!The
BlockMetadata
class is correctly annotated with@JSONField
for JSON serialization.src/main/java/org/starcoin/api/BlockRPCClient.java (2)
18-19
: Verify the compatibility of the new JSON-RPC client dependency.The import statements for
JSONRPC2Session
andJSONRPC2SessionException
have been updated to use thecom.thetransactioncompany
package. Ensure that the new dependency is fully compatible with the existing codebase and that all necessary changes have been made.Verification successful
Verify the removal of the old JSON-RPC client dependency.
The new package
com.thetransactioncompany.jsonrpc2.client
forJSONRPC2Session
andJSONRPC2SessionException
is used consistently across the codebase. Ensure that the old package is no longer being used anywhere in the codebase.
Verify the removal of the old JSON-RPC client dependency.
The previous search did not produce any output, which suggests that the old package is not being used. To ensure thorough verification, perform a more general search for any import statements related to the old package.
The new JSON-RPC client dependency has been successfully integrated.
The import statements for
JSONRPC2Session
andJSONRPC2SessionException
have been updated to use thecom.thetransactioncompany
package, and there are no remnants of the old package in the codebase. The transition to the new dependency is complete and appears to be fully compatible with the existing code.
- The new package
com.thetransactioncompany.jsonrpc2.client
is used consistently across the codebase.- No occurrences of the old package were found.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the compatibility of the new JSON-RPC client dependency. # Test: Search for the usage of JSONRPC2Session and JSONRPC2SessionException. Expect: Only occurances of the new package. rg --type java 'JSONRPC2Session|JSONRPC2SessionException'Length of output: 14593
Script:
#!/bin/bash # Description: Verify the removal of the old JSON-RPC client dependency. # Test: Search for any usage of the old package for JSONRPC2Session and JSONRPC2SessionException. rg --type java 'old.package.name.JSONRPC2Session|old.package.name.JSONRPC2SessionException'Length of output: 93
Script:
#!/bin/bash # Description: Verify the removal of the old JSON-RPC client dependency. # Test: Search for any import statements from the old package. rg --type java 'import old.package.name.JSONRPC2Session|import old.package.name.JSONRPC2SessionException'Length of output: 107
50-50
: Verify the removal ofJsonProcessingException
from the method signature.The method signature for
getChainHeader
has been updated to throw onlyJSONRPC2SessionException
. Ensure that no JSON processing exceptions are thrown within the method.Verification successful
The removal of
JsonProcessingException
from the method signature is verified.The
getChainHeader
method inBlockRPCClient
uses thegetSubObject
method fromJsonRPCClient
, which does not throwJsonProcessingException
. Therefore, the updated method signature is correct.
BlockRPCClient.java
:
getChainHeader()
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the removal of JsonProcessingException from the method signature. # Test: Search for the usage of JsonProcessingException within the method. Expect: No occurances. rg --type java 'JsonProcessingException' src/main/java/org/starcoin/api/BlockRPCClient.javaLength of output: 91
Script:
#!/bin/bash # Extract the implementation of the getChainHeader method in BlockRPCClient.java for detailed analysis. ast-grep --lang java --pattern 'public BlockHeader getChainHeader() throws JSONRPC2SessionException { $$$ }' src/main/java/org/starcoin/api/BlockRPCClient.javaLength of output: 163
Script:
#!/bin/bash # Search for the implementation of the getChainHeader method in BlockRPCClient.java for detailed analysis. rg 'public BlockHeader getChainHeader\(\) throws JSONRPC2SessionException \{' -A 20 src/main/java/org/starcoin/api/BlockRPCClient.javaLength of output: 1027
Script:
#!/bin/bash # Search for the JsonRPCClient class and inspect its methods for handling JsonProcessingException. rg 'class JsonRPCClient' -A 50 src/main/java/org/starcoin/api/Length of output: 4510
Script:
#!/bin/bash # Search for the getSubObject method in JsonRPCClient and inspect its implementation. rg 'getSubObject' -A 20 src/main/java/org/starcoin/api/JsonRPCClient.javaLength of output: 1280
src/main/java/org/starcoin/bean/Event.java (1)
38-38
: LGTM!The addition of the
@JSONField
annotation ensures that thedecodeEventData
field is serialized/deserialized correctly using thecom.alibaba.fastjson
library.src/main/java/org/starcoin/api/JsonRPCClient.java (4)
94-94
: Verify Correctness of Jackson ParsingEnsure that
objectMapper.readValue(result.toString(), clazz)
correctly handles all expected JSON structures and edge cases.
128-129
: Verify Correctness of Sub-Object JSON ParsingEnsure that
JSONObject jb = JSON.parseObject(result.toString())
andjb.getObject(subKey, clazz)
correctly handle all expected JSON structures and edge cases.Verification successful
Verify Correctness of Sub-Object JSON Parsing
Ensure that
JSONObject jb = JSON.parseObject(result.toString())
andjb.getObject(subKey, clazz)
correctly handle all expected JSON structures and edge cases.
Verify Correctness of Sub-Object JSON Parsing
Ensure that
JSONObject jb = JSON.parseObject(result.toString())
andjb.getObject(subKey, clazz)
correctly handle all expected JSON structures and edge cases.
Verify Correctness of Sub-Object JSON Parsing
The
JSONObject jb = JSON.parseObject(result.toString())
andjb.getObject(subKey, clazz)
correctly handle all expected JSON structures and edge cases.
- The
subKey
andclazz
parameters are used appropriately within thegetSubObject
method.- The method includes checks for a successful response and non-null result before parsing the JSON object.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `JSON.parseObject` and `jb.getObject` usage. # Test: Search for the usage of `JSON.parseObject` and `jb.getObject`. Expect: Correct handling of JSON structures. rg --type java 'JSON.parseObject' rg --type java 'jb.getObject'Length of output: 1431
Script:
#!/bin/bash # Description: Verify the context and usage of `jb.getObject`. # Search for the context around the usage of `jb.getObject`. rg -A 5 -B 5 'jb.getObject' src/main/java/org/starcoin/api/JsonRPCClient.javaLength of output: 608
Script:
#!/bin/bash # Description: Verify the definitions and usages of `subKey` and `clazz` within the `getSubObject` method. # Search for the definitions and usages of `subKey` and `clazz` within `JsonRPCClient.java`. rg -A 5 -B 5 'getSubObject' src/main/java/org/starcoin/api/JsonRPCClient.javaLength of output: 1062
161-161
: Verify Correctness of JSON Array ParsingEnsure that
JSON.parseArray(result.toString(), clazz)
correctly handles all expected JSON structures and edge cases.
61-61
: Verify Correctness of JSON ParsingEnsure that
JSON.parseObject(result.toString(), clazz)
correctly handles all expected JSON structures and edge cases.src/test/java/org/starcoin/api/StateRPCClientTest.java (1)
18-18
: LGTM!The import for
com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
is consistent with the changes in the main codebase.src/main/java/org/starcoin/api/TransactionRPCClient.java (1)
18-19
: LGTM!The imports for
com.thetransactioncompany.jsonrpc2.client.JSONRPC2Session
andJSONRPC2SessionException
are consistent with the changes in the main codebase.src/main/java/org/starcoin/api/StateRPCClient.java (2)
Line range hint
88-97
: Verify removal ofJsonProcessingException
.The method
getTokenInfo
has been updated to removeJsonProcessingException
. Ensure that this does not affect the functionality and proper error handling.Verification successful
Line range hint
88-97
: Verified removal ofJsonProcessingException
.The method
getTokenInfo
has been updated to removeJsonProcessingException
. This change does not impact the functionality or error handling of the method.
- The method now only throws
JSONRPC2SessionException
, which is appropriate for the context.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the removal of `JsonProcessingException` and ensure proper error handling. # Test: Check for any exceptions or errors related to JSON processing in the codebase. rg --type java $'JsonProcessingException'Length of output: 4019
Script:
#!/bin/bash # Description: Verify the removal of `JsonProcessingException` from StateRPCClient and ensure proper error handling. # Check the history of changes in the StateRPCClient.java file to confirm the removal of JsonProcessingException. git log -p src/main/java/org/starcoin/api/StateRPCClient.javaLength of output: 12950
18-28
: Verify compatibility and correct usage of new libraries.The import statements have switched from
com.fasterxml.jackson
tocom.alibaba.fastjson
and fromorg.starcoin.jsonrpc.client
tocom.thetransactioncompany.jsonrpc2.client
. Ensure that the new libraries are compatible and correctly used in the code.README.md (1)
23-23
: Verify updated version number.The Maven dependency version has been updated to
1.2.9
. Ensure that this version is correct and compatible with the rest of the codebase.
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.JSONObject; | ||
|
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.
Tip
Codebase Verification
Inconsistent Use of JSON Processing Libraries
The codebase contains mixed usage of com.alibaba.fastjson
and com.fasterxml.jackson
for JSON processing. To maintain consistency, please ensure that all JSON processing is handled by a single library. The following files still import com.fasterxml.jackson
:
src/main/java/org/starcoin/utils/TransactionPayloadDeserializer.java
src/main/java/org/starcoin/utils/TypeTagDeserializer.java
src/main/java/org/starcoin/utils/TransactionPayloadSerializer.java
src/main/java/org/starcoin/utils/StructTagDeserializer.java
src/main/java/org/starcoin/utils/StructTagSerializer.java
src/main/java/org/starcoin/utils/ScriptFunctionSerializer.java
src/main/java/org/starcoin/utils/ScriptFunctionDeserializer.java
src/main/java/org/starcoin/utils/ParseUtil.java
src/main/java/org/starcoin/utils/ModuleIdSerializer.java
src/main/java/org/starcoin/utils/ModuleDeserializer.java
src/main/java/org/starcoin/utils/TypeTagSerializer.java
src/main/java/org/starcoin/jsonrpc/JSONRPC2Response.java
src/main/java/org/starcoin/jsonrpc/client/JSONRPC2Session.java
src/main/java/org/starcoin/api/StateRPCClient.java
src/main/java/org/starcoin/api/JsonRPCClient.java
src/main/java/org/starcoin/serde/format/jackson/VariantFormatDeserializer.java
src/main/java/org/starcoin/serde/format/jackson/utils/MappingUtils.java
src/main/java/org/starcoin/serde/format/jackson/FormatDeserializer.java
src/main/java/org/starcoin/serde/format/jackson/NamedDeserializer.java
src/main/java/org/starcoin/bean/CustomStringDeserializer.java
src/main/java/org/starcoin/bean/MultiEd25519.java
src/main/java/org/starcoin/bean/ListResource.java
src/main/java/org/starcoin/bean/Authenticator.java
src/main/java/org/starcoin/bean/Event.java
src/main/java/org/starcoin/bean/TransactionInfo.java
src/main/java/org/starcoin/bean/UserTransaction.java
src/main/java/org/starcoin/bean/TransactionInfoWithProof.java
src/main/java/org/starcoin/bean/Kind.java
src/main/java/org/starcoin/bean/Transaction.java
src/main/java/org/starcoin/bean/StateProof.java
src/main/java/org/starcoin/bean/RawTransaction.java
src/main/java/org/starcoin/bean/EventProof.java
src/main/java/org/starcoin/bean/ListResourceOption.java
src/main/java/org/starcoin/bean/TokenInfo.java
src/main/java/org/starcoin/bean/BlockInfo.java
src/main/java/org/starcoin/bean/EventFilter.java
src/main/java/org/starcoin/serde/format/jackson/ContainerFormatDeserializer.java
src/main/java/org/starcoin/bean/BlockHeader.java
src/main/java/org/starcoin/bean/BlockMetadata.java
src/main/java/org/starcoin/bean/Block.java
src/main/java/org/starcoin/bean/BlockGhostdagData.java
src/main/java/org/starcoin/bean/BaseProof.java
src/main/java/org/starcoin/bean/GetEventOption.java
src/main/java/org/starcoin/bean/EventNotificationResult.java
src/main/java/org/starcoin/serde/format/utils/SerdeGenJavaUtils.java
src/main/java/org/starcoin/bean/Resource.java
src/main/java/org/starcoin/serde/format/utils/ReferenceUtils.java
src/main/java/org/starcoin/bean/Ed25519.java
Please update these files to use com.alibaba.fastjson
or ensure that com.fasterxml.jackson
is consistently used across the entire codebase.
Analysis chain
Ensure Consistency in JSON Processing Libraries
The new imports for com.alibaba.fastjson
should be consistently used across the codebase. Verify that all JSON processing is now handled by fastjson
and not mixed with other libraries like Jackson
.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify consistent use of `com.alibaba.fastjson` for JSON processing.
# Test: Search for the usage of `com.fasterxml.jackson`. Expect: No occurrences.
rg --type java 'import com.fasterxml.jackson'
Length of output: 15778
@@ -15,8 +15,8 @@ | |||
*/ | |||
package org.starcoin.api; | |||
|
|||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException; |
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.
Tip
Codebase Verification
Missing JSON-RPC client dependency in build configuration files.
The import statement for JSONRPC2SessionException
has been updated to use the com.thetransactioncompany
package. However, the new dependency is not declared in the pom.xml
or build.gradle
files. Please ensure that the new dependency is added to the build configuration to avoid runtime issues.
pom.xml
orbuild.gradle
: Add the dependencycom.thetransactioncompany.jsonrpc2
.
Analysis chain
Verify the compatibility of the new JSON-RPC client dependency.
The import statement for JSONRPC2SessionException
has been updated to use the com.thetransactioncompany
package. Ensure that the new dependency is fully compatible with the existing codebase and that all necessary changes have been made.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the compatibility of the new JSON-RPC client dependency.
# Test: Search for the usage of JSONRPC2SessionException. Expect: Only occurances of the new package.
rg --type java 'JSONRPC2SessionException'
Length of output: 13047
Script:
#!/bin/bash
# Description: Verify the new JSON-RPC client dependency in build configuration files.
# Test: Search for the new JSON-RPC client dependency in build configuration files.
rg --type xml 'com.thetransactioncompany.jsonrpc2'
rg --type gradle 'com.thetransactioncompany.jsonrpc2'
Length of output: 253
Script:
#!/bin/bash
# Description: Verify the new JSON-RPC client dependency in build configuration files.
# Locate `pom.xml` and `build.gradle` files in the repository and search for the new JSON-RPC client dependency.
for file in $(fd -e xml -e gradle); do
echo "Checking $file"
rg 'com.thetransactioncompany.jsonrpc2' "$file"
done
Length of output: 150
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 (2)
- src/main/java/org/starcoin/bean/TokenInfo.java (1 hunks)
- src/test/java/org/starcoin/api/ContractRPCClientTestCase.java (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/main/java/org/starcoin/bean/TokenInfo.java
- src/test/java/org/starcoin/api/ContractRPCClientTestCase.java
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 (2)
- docs/index-files/index-7.html (1 hunks)
- docs/org/starcoin/api/TokenContractRPCClient.html (2 hunks)
Files skipped from review due to trivial changes (1)
- docs/org/starcoin/api/TokenContractRPCClient.html
Additional context used
Learnings (1)
docs/index-files/index-7.html (1)
Learnt from: nkysg PR: starcoinorg/starcoin-java#60 File: src/main/java/org/starcoin/api/TokenContractRPCClient.java:109-109 Timestamp: 2024-06-29T15:51:00.569Z Learning: When correcting method names in the codebase, ensure to update all references, including those in test files such as `src/test/java/org/starcoin/api/ContractRPCClientTestCase.java`.
Additional comments not posted (1)
docs/index-files/index-7.html (1)
568-568
: Verify the new method entrygetSTCTreasuryBalance
.Ensure that the method
getSTCTreasuryBalance
inTokenContractRPCClient
is correctly documented and its references are updated.Verification successful
Verify the documentation for
getSTCTreasuryBalance
inTokenContractRPCClient.java
.Ensure that the method
getSTCTreasuryBalance
inTokenContractRPCClient.java
has proper documentation and that all references are updated.
Verification successful for the new method entry
getSTCTreasuryBalance
.
- The method
getSTCTreasuryBalance
is correctly documented with Javadoc comments inTokenContractRPCClient.java
.- All references to
getSTCTreasuryBalance
are updated in the HTML documentation files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the method `getSTCTreasuryBalance` is correctly documented and its references are updated. # Test: Search for the method definition. Expect: Only occurrences of the updated method name. rg --type java $'getSTCTreasuryBalance'Length of output: 453
Script:
#!/bin/bash # Description: Verify the documentation for `getSTCTreasuryBalance` in `TokenContractRPCClient.java`. # Test: Search for the method definition along with its documentation. Expect: Proper Javadoc comments. ast-grep --lang java --pattern $'public BigInteger getSTCTreasuryBalance() throws JSONRPC2SessionException { $$$ }' --before 10 --after 0 # Test: Search for additional references to `getSTCTreasuryBalance` in the documentation files. Expect: Consistent references. rg --type html 'getSTCTreasuryBalance'Length of output: 2859
fix chain.get_block_txn_infos getObjectArray error. need revert #42
Summary by CodeRabbit
New Features
com.alibaba.fastjson
for improved performance and flexibility.jsonrpc2-client
to enhance JSON-RPC client capabilities.Bug Fixes
getSTCTreasurBalance
togetSTCTreasuryBalance
for consistency.Refactor
@JsonProperty
annotations to streamline codebase.Chores