Refactored Kate RPC module to remove code duplication across query_rows, query_proof, and query_multiproof methods.#783
Open
letmehateu wants to merge 5 commits intoavailproject:mainfrom
Open
Conversation
Author
|
@jakubcech hello, can you check please my PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request type
Please add the labels corresponding to the type of changes your PR introduces:
Description
This PR refactors the Kate RPC module to eliminate code duplication across query methods.
Problem:
Three methods (
query_rows,query_proof,query_multiproof) contained duplicated validation and conversion logic:Solution:
Extracted common logic into three helper methods:
ensure_has_commitments()- validates that block has non-empty commitmentsvalidate_cells_limit()- checks that requested cell count doesn't exceed configured limitcells_to_positions()- convertsCellsto position tuples(row, col)Impact:
Related Issues
N/A
Testing Performed
cargo clippyChecklist
cargo test.cargo fmt.cargo build --releaseandcargo build --release --features runtime-benchmarks.cargo clippy.