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

Add fullBlockResponse param to Access API block requests #135

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

lealobanov
Copy link
Collaborator

@lealobanov lealobanov commented Oct 24, 2024

Closes: #109

Description

  • Add fullBlockResponse boolean field to get block Access API methods
  • Defaults to false when a value is not passed

For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • New Features

    • Enhanced block retrieval methods with an optional parameter for full block responses, improving flexibility in API calls.
  • Deprecations

    • The getAccountByAddress method is now deprecated; users are encouraged to use getAccountAtLatestBlock instead for consistency.

Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

Walkthrough

The pull request modifies the AsyncFlowAccessApi and FlowAccessApi interfaces, as well as their implementations, by adding a new optional parameter fullBlockResponse with a default value of false to the methods getLatestBlock, getBlockById, and getBlockByHeight. This change enhances the functionality of these methods without breaking existing calls, ensuring backward compatibility. Additionally, the getAccountByAddress method is marked as deprecated, directing users to use getAccountAtLatestBlock instead.

Changes

File Change Summary
sdk/src/main/kotlin/org/onflow/flow/sdk/AsyncFlowAccessApi.kt Updated method signatures for getLatestBlock, getBlockById, and getBlockByHeight to include fullBlockResponse.
sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt Updated method signatures for getLatestBlock, getBlockById, and getBlockByHeight to include fullBlockResponse; marked getAccountByAddress as deprecated.
sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt Updated implementations of getLatestBlock, getBlockById, and getBlockByHeight to handle fullBlockResponse.
sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt Updated implementations of getLatestBlock, getBlockById, and getBlockByHeight to handle fullBlockResponse; marked getAccountByAddress as deprecated.
java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java Updated method signatures for getLatestBlock, getBlockById, and getBlockByHeight to include fullBlockResponse.
java-example/src/test/java/org/onflow/examples/java/getCollection/GetCollectionAccessAPIConnectorTest.java Updated test method calls to getLatestBlock to include fullBlockResponse.
java-example/src/test/java/org/onflow/examples/java/getAccountBalance/GetAccountBalanceAccessAPIConnectorTest.java Updated test method calls to getLatestBlock to include fullBlockResponse.

Assessment against linked issues

Objective Addressed Explanation
Ensure that usage of GetLatestBlockRequest is updated (#109)

Possibly related PRs

Suggested reviewers

  • jribbink
  • franklywatson

Poem

🐰 In the land of code where rabbits play,
New parameters hop in, brightening the day.
With fullBlockResponse, we fetch with delight,
Old calls still work, everything feels right.
A deprecation here, a suggestion there,
In the world of Flow, we code with care! 🌟


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.

Copy link

github-actions bot commented Oct 24, 2024

SDK Examples Unit Test Results

39 files  39 suites   6m 49s ⏱️
76 tests 76 ✔️ 0 💤 0 ❌

Results for commit abffae9.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Oct 24, 2024

Common Integration Test Results

1 files  1 suites   7s ⏱️
1 tests 1 ✔️ 0 💤 0 ❌

Results for commit abffae9.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Oct 24, 2024

Unit Test Results

  62 files  ±0    62 suites  ±0   24s ⏱️ ±0s
358 tests ±0  358 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit abffae9. ± Comparison against base commit 0166c83.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Oct 24, 2024

Integration Test Results

  6 files  ±0    6 suites  ±0   2m 49s ⏱️ -1s
33 tests ±0  33 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit abffae9. ± Comparison against base commit 0166c83.

♻️ This comment has been updated with latest results.

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

🧹 Outside diff range and nitpick comments (7)
sdk/src/main/kotlin/org/onflow/flow/sdk/AsyncFlowAccessApi.kt (2)

19-19: Consider future interface consolidation.

While the change is correct, the three block retrieval methods share identical parameter patterns. Consider introducing a common interface or base class in the future to reduce duplication and ensure consistent evolution of these related methods.

Example future refactor:

interface BlockRetrieval {
    fun getBlock(identifier: BlockIdentifier, fullBlockResponse: Boolean = false): CompletableFuture<FlowAccessApi.AccessApiCallResponse<FlowBlock?>>
}

sealed class BlockIdentifier {
    data class ByHeight(val height: Long): BlockIdentifier()
    data class ById(val id: FlowId): BlockIdentifier()
    object Latest: BlockIdentifier()
}

15-19: Add KDoc documentation for the new parameter.

Please add documentation explaining the purpose and behavior of the fullBlockResponse parameter. This will help API consumers understand when to use this parameter and what differences to expect in the response.

Example:

/**
 * @param fullBlockResponse When true, returns the complete block data. When false (default),
 *                         returns a minimal block response for better performance.
 */
sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt (2)

31-31: LGTM! Consider documenting the performance implications.

The parameter addition is consistent with other block retrieval methods. Consider adding documentation about potential performance differences between full and partial block responses to help API consumers make informed decisions.


Looking at the implementation details from the ripgrep results, I can now generate the final response.

Deprecation is correct but implementations differ slightly

The implementations in FlowAccessApiImpl.kt show that while both methods have the same signature and return type, they actually make different gRPC calls:

  • getAccountByAddress uses api.getAccount with Access.GetAccountRequest
  • getAccountAtLatestBlock uses api.getAccountAtLatestBlock with Access.GetAccountAtLatestBlockRequest

This suggests that the deprecation notice might need revision since the methods don't behave identically as claimed. The underlying gRPC calls are different, which could potentially have different behaviors or guarantees.

Locations that need attention:

  • sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt: The deprecation message stating "Behaves identically to getAccountAtLatestBlock" should be reviewed
  • sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt: The implementations show different underlying gRPC calls
🔗 Analysis chain

Line range hint 39-43: LGTM! Verify method equivalence.

The deprecation notice is clear and provides a proper migration path. The ReplaceWith directive will help IDEs automatically update usage.

Let's verify the implementation equivalence:


Let me try a different approach to verify the implementation equivalence.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for both method implementations to confirm they behave identically
ast-grep --pattern 'fun getAccountByAddress($$$) {
  $$$
}'

ast-grep --pattern 'fun getAccountAtLatestBlock($$$) {
  $$$
}'

Length of output: 241


Script:

#!/bin/bash
# Search for both method implementations using ripgrep for interface and implementation
rg "fun getAccountByAddress" -A 5
rg "fun getAccountAtLatestBlock" -A 5

Length of output: 6811

sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt (2)

Line range hint 118-134: Consider extracting common block response handling logic.

The implementation is correct, but there's duplicate error handling logic across all three block retrieval methods.

Consider extracting the common response handling logic into a private helper method:

private fun handleBlockResponse(
    response: Access.BlockResponse,
    errorMessage: String
): FlowAccessApi.AccessApiCallResponse<FlowBlock> =
    if (response.hasBlock()) {
        FlowAccessApi.AccessApiCallResponse.Success(FlowBlock.of(response.block))
    } else {
        FlowAccessApi.AccessApiCallResponse.Error(errorMessage)
    }

This would reduce duplication and make the code more maintainable.


Line range hint 192-192: Enhance deprecation notice with migration timeline.

Consider adding more context to the deprecation notice, such as when this method will be removed and why getAccountAtLatestBlock is preferred.

Example enhancement:

-@Deprecated("Behaves identically to getAccountAtLatestBlock", replaceWith = ReplaceWith("getAccountAtLatestBlock"))
+@Deprecated(
+    message = "Behaves identically to getAccountAtLatestBlock. Will be removed in version X.Y.Z.",
+    replaceWith = ReplaceWith("getAccountAtLatestBlock")
+)
sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt (1)

130-130: Consider adding KDoc documentation for the new parameter.

The fullBlockResponse parameter would benefit from documentation explaining its purpose and impact on the response.

Apply this documentation to each method:

+    /**
+     * @param fullBlockResponse When true, returns the complete block data including collections,
+     *                         guarantees, and seals. Defaults to false for backward compatibility.
+     */

Also applies to: 156-156, 186-186

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between db9e3d1 and 1e9c9fc0eefe37a8914fcbcf6971bbb5d19bdbbd.

📒 Files selected for processing (4)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/AsyncFlowAccessApi.kt (1 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt (1 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt (3 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt (2 hunks)
🔇 Additional comments (8)
sdk/src/main/kotlin/org/onflow/flow/sdk/AsyncFlowAccessApi.kt (2)

17-17: LGTM! Consistent with API pattern.

The signature change follows the same pattern as getLatestBlock and maintains proper nullability.


15-15: LGTM! Verify integration with existing clients.

The signature change maintains backward compatibility through default parameter value and follows Kotlin conventions.

Let's verify existing usage to ensure no breaking changes:

✅ Verification successful

Based on the search results, I can now generate the final response since I have sufficient information about the usage of getLatestBlock across the codebase.

✅ Signature change is safe and properly implemented

The verification shows that all existing calls to getLatestBlock() will continue to work without modification because:

  • All current usages either specify only the sealed parameter or use no parameters
  • The new fullBlockResponse parameter has a default value of false
  • The change has been consistently implemented across the interface (AsyncFlowAccessApi), implementation (AsyncFlowAccessApiImpl), and test classes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing getLatestBlock calls to verify compatibility
rg "getLatestBlock\(" --type kotlin

Length of output: 3035

sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt (2)

29-29: LGTM! Parameter signature is consistent.

The fullBlockResponse parameter addition maintains consistency with other block retrieval methods.


27-27: LGTM! Verify parameter usage in implementations.

The addition of fullBlockResponse parameter with a default value of false maintains backward compatibility while enhancing block retrieval functionality.

Let's verify the parameter usage in implementations:

#!/bin/bash
# Search for implementations of getLatestBlock to ensure consistent parameter usage
ast-grep --pattern 'fun getLatestBlock($_, $_)' 
sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt (2)

Line range hint 100-116: LGTM! Implementation maintains robust error handling.

The addition of fullBlockResponse parameter is implemented correctly while preserving the existing null-check and error handling patterns.


86-98: LGTM! Verify integration with upstream callers.

The implementation correctly incorporates the new fullBlockResponse parameter and maintains consistent error handling.

Let's verify the impact on existing callers:

sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt (2)

130-138: LGTM! The implementation is consistent across all block-related methods.

The addition of the fullBlockResponse parameter is implemented consistently across getLatestBlock, getBlockById, and getBlockByHeight methods, maintaining the same pattern of error handling and response processing.

Also applies to: 156-164, 186-194


130-138: Verify backward compatibility of existing clients.

The new parameter has been added with proper default values, but let's verify that existing clients aren't affected.

✅ Verification successful

Based on the search results, I can now generate the final response as I have sufficient information about the usage of these methods across the codebase.

The new parameter is backward compatible with existing clients

The search results confirm that the new fullBlockResponse parameter has been added with a default value of false across all block-related methods (getLatestBlock, getBlockById, getBlockByHeight). All existing client calls found in the codebase are compatible with this change because:

  • The parameter is optional with a default value of false
  • All existing calls either:
    • Use only the required parameters (e.g., getBlockById(blockId))
    • Or specify only the first optional parameter (e.g., getLatestBlock(true))
  • No existing calls would be affected by the addition of the new parameter
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing calls to these methods to ensure they work with the new parameter
echo "Searching for existing method calls..."
rg -t kotlin -t java "getLatestBlock\s*\([^)]*\)" -A 1
rg -t kotlin -t java "getBlockById\s*\([^)]*\)" -A 1
rg -t kotlin -t java "getBlockByHeight\s*\([^)]*\)" -A 1

Length of output: 12944

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 (1)
java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java (1)

Line range hint 1-48: Consider enhancing example implementation to showcase API capabilities.

Since this class is in the examples package, it should demonstrate the full capabilities of the Flow Access API. Currently, the implementation hides the new fullBlockResponse functionality by hardcoding it to false. Consider:

  1. Exposing the parameter in all method signatures
  2. Adding example usage demonstrating both full and partial block responses
  3. Adding comments explaining when to use each option

This would make the example more valuable for developers learning to use the SDK.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1e9c9fc0eefe37a8914fcbcf6971bbb5d19bdbbd and 5262ee47c990df54a1a0ee4aefed2fbb53555b08.

📒 Files selected for processing (1)
  • java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java (3 hunks)

@lealobanov lealobanov force-pushed the full-block-response-protobuf branch from 7861fe9 to aab430e Compare October 25, 2024 07:50
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: 0

🧹 Outside diff range and nitpick comments (3)
java-example/src/test/java/org/onflow/examples/java/getCollection/GetCollectionAccessAPIConnectorTest.java (2)

37-37: Consider adding parameter documentation.

The method call has been correctly updated to include the new fullBlockResponse parameter. However, consider adding a comment to explain the meaning of both boolean parameters for better maintainability.

+        // Get latest sealed block (sealed=true) without full block details (fullBlockResponse=false)
         FlowAccessApi.AccessApiCallResponse<FlowBlock> response = accessAPI.getLatestBlock(true, false);

Line range hint 37-45: Consider adding test coverage for fullBlockResponse=true.

Since this test only verifies collection guarantees, it appropriately uses fullBlockResponse=false. However, to ensure comprehensive test coverage of the new parameter, consider adding a separate test case that uses fullBlockResponse=true and verifies the additional block details are present.

Here's a suggested test method:

@Test
public void canFetchLatestBlockWithFullResponse() {
    FlowAccessApi.AccessApiCallResponse<FlowBlock> response = accessAPI.getLatestBlock(true, true);
    assertTrue(response instanceof FlowAccessApi.AccessApiCallResponse.Success);
    
    FlowBlock block = ((FlowAccessApi.AccessApiCallResponse.Success<FlowBlock>) response).getData();
    // Verify additional block details that should only be present with fullBlockResponse=true
    assertNotNull(block.getExecutionResult());
    // Add more assertions based on what constitutes a "full" block response
}
sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt (1)

130-138: Consider adding documentation for the new parameter.

While the implementation is correct, it would be helpful to add KDoc comments explaining the purpose and behavior of the fullBlockResponse parameter.

Add documentation like this to each method:

+    /**
+     * @param fullBlockResponse When true, returns the complete block data. Defaults to false for backward compatibility.
+     */
     override fun getLatestBlock(sealed: Boolean, fullBlockResponse: Boolean): CompletableFuture<FlowAccessApi.AccessApiCallResponse<FlowBlock>>

Also applies to: 207-215, 237-245

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5262ee47c990df54a1a0ee4aefed2fbb53555b08 and aab430e.

📒 Files selected for processing (6)
  • java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java (3 hunks)
  • java-example/src/test/java/org/onflow/examples/java/getCollection/GetCollectionAccessAPIConnectorTest.java (1 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/AsyncFlowAccessApi.kt (1 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt (1 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt (3 hunks)
  • sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java
  • sdk/src/main/kotlin/org/onflow/flow/sdk/AsyncFlowAccessApi.kt
  • sdk/src/main/kotlin/org/onflow/flow/sdk/FlowAccessApi.kt
  • sdk/src/main/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImpl.kt
🔇 Additional comments (2)
sdk/src/main/kotlin/org/onflow/flow/sdk/impl/AsyncFlowAccessApiImpl.kt (2)

130-138: Implementation looks good and maintains consistency!

The changes consistently implement the fullBlockResponse parameter across all block-related methods, maintaining proper error handling and following the existing patterns.

Also applies to: 207-215, 237-245


130-138: Verify the default value behavior.

The fullBlockResponse parameter's default value of false ensures backward compatibility, but let's verify this behavior in the codebase.

✅ Verification successful

Based on the search results, I can now generate the final response as I have sufficient information to verify the default value behavior:

Default value behavior for fullBlockResponse parameter is correctly implemented and used consistently

The codebase shows that:

  • All block-related methods (getLatestBlock, getBlockById, getBlockByHeight) consistently define fullBlockResponse with a default value of false in both sync and async APIs
  • All existing calls in test and example code work without explicitly passing the fullBlockResponse parameter, confirming backward compatibility
  • The implementation in AsyncFlowAccessApiImpl.kt and FlowAccessApiImpl.kt correctly handles this parameter by passing it to the underlying gRPC API
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing calls to these methods to ensure they work with the new parameter
rg -A 2 "getLatestBlock|getBlockById|getBlockByHeight" --type kotlin

Length of output: 29474

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

🧹 Outside diff range and nitpick comments (1)
java-example/src/test/java/org/onflow/examples/java/getAccountBalance/GetAccountBalanceAccessAPIConnectorTest.java (1)

42-42: Add test coverage for fullBlockResponse=true scenario.

While the parameter update is correct, consider adding a test case that verifies the behavior when fullBlockResponse is set to true, ensuring the new functionality is properly tested.

Would you like me to help generate a test case that covers the fullBlockResponse=true scenario?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aab430e and abffae9.

📒 Files selected for processing (1)
  • java-example/src/test/java/org/onflow/examples/java/getAccountBalance/GetAccountBalanceAccessAPIConnectorTest.java (2 hunks)
🔇 Additional comments (2)
java-example/src/test/java/org/onflow/examples/java/getAccountBalance/GetAccountBalanceAccessAPIConnectorTest.java (2)

61-61: LGTM! Parameter update is consistent.

The modification correctly implements the new API signature while maintaining the test's original purpose of comparing balances between the latest block and a specific height.


Line range hint 42-61: Verify consistent parameter usage across the codebase.

Let's ensure all getLatestBlock calls have been updated consistently with the new parameter.

✅ Verification successful

Based on the search results, I can now generate the final response:

All getLatestBlock calls are consistently using the updated parameters

The verification shows that:

  • Java implementations consistently use both parameters: getLatestBlock(true, false)
  • Kotlin implementations use a single parameter: getLatestBlock(true) or parameter-less getLatestBlock()
  • This is expected as Kotlin has default parameters while Java requires explicit parameters
  • The parameter ordering and values are consistent across similar use cases
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining calls to getLatestBlock that might need updating
# and verify parameter consistency across the codebase

# Search for all getLatestBlock method calls
echo "Checking getLatestBlock method calls:"
rg "getLatestBlock\(" --type java

# Search for potential test files that might need similar updates
echo -e "\nChecking for other test files that might need updates:"
fd -e java -e kt --full-path ".*Test\.java$|.*Test\.kt$" | xargs rg "getLatestBlock"

Length of output: 6190

@franklywatson franklywatson merged commit 56be671 into main Oct 25, 2024
6 checks passed
@franklywatson franklywatson deleted the full-block-response-protobuf branch October 25, 2024 16:06
@coderabbitai coderabbitai bot mentioned this pull request Oct 28, 2024
6 tasks
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.

Usage of GetLatestBlockRequest might be outdated
2 participants