Add precompile-backed bank query client#3424
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3424 +/- ##
==========================================
+ Coverage 59.29% 59.35% +0.06%
==========================================
Files 2125 2130 +5
Lines 175629 176358 +729
==========================================
+ Hits 104144 104684 +540
- Misses 62404 62474 +70
- Partials 9081 9200 +119
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Pushed
Local verification: go test ./precompiles/query ./precompiles/bank/query ./precompiles/bank ./precompiles/addr ./sei-cosmos/x/bank/client/cli
go test ./precompiles/...The repo |
| pageRes := &sdkquery.PageResponse{NextKey: nextKey} | ||
| if countTotal && !keyPagination { | ||
| pageRes.Total = orderedLen | ||
| } |
There was a problem hiding this comment.
Pagination omits Total for key-based requests
Medium Severity
The paginate function deliberately skips setting pageRes.Total when key-based pagination is used (countTotal && !keyPagination), but the Cosmos SDK's Paginate sets Total for key-based pagination when CountTotal is true. Since the bindings (e.g., AllBalances, SpendableBalances, TotalSupply) claim ExactProtobufShape, consumers relying on Total being populated during key-based paginated queries will get a zero value instead of the actual item count, silently diverging from the original gRPC query behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 93b0b77. Configure here.
|
Pushed Local verification: go test ./precompiles/bank ./precompiles/bank/query ./precompiles/query ./sei-cosmos/x/bank/client/cli |
d750c83 to
b982569
Compare
PR SummaryMedium Risk Overview Implements the first module bindings for bank in Extends the bank precompile query surface (Solidity interface, Updates bank CLI queries to default to the precompile backend, adding Reviewed by Cursor Bugbot for commit 279b713. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 279b713. Configure here.
| } | ||
| if req.Offset > 0 && req.Key != nil { | ||
| return nil, nil, fmt.Errorf("invalid request, either offset or key is expected, got both") | ||
| } |
There was a problem hiding this comment.
Paginate offset/key check diverges from Cosmos SDK
High Severity
The Paginate function checks req.Offset > 0 && req.Key != nil to reject combined offset+key pagination, but the Cosmos SDK checks req.Offset > 0 && len(req.Key) > 0. Since ReadPageRequest constructs Key: []byte(pageKey), an unset --page-key flag produces []byte{} (not nil, length 0). Using --offset=N without --page-key will error on the precompile backend but succeed on the legacy backend, breaking parity for offset-based pagination.
Reviewed by Cursor Bugbot for commit 279b713. Configure here.


Summary
precompiles/queryClientConn bridge that maps generated QueryClient calls to EVM RPCeth_callprecompile bindingsTests
go test ./precompiles/...go test ./precompiles/query ./precompiles/bank/query ./precompiles/bank ./precompiles/addr ./sei-cosmos/x/bank/client/cliNote
Medium Risk
Introduces a new query transport layer that routes generated gRPC
QueryClientcalls through EVM RPCeth_call, and expands the bank precompile ABI; errors or ABI mismatches could break CLI/query behavior despite added tests.Overview
Switches bank CLI queries to EVM RPC.
x/bankCLI commands now build their generatedQueryClienton top of a newprecompiles/queryClientConn, configured via a new--evm-rpcflag (defaulthttp://localhost:8545) and honoring the existing height selection.Adds a shared precompile-backed query bridge + bank bindings. New
precompiles/querycode provides a registry-based method router, ABI pack/unpack helpers, and Sei↔EVM address conversion via theaddrprecompile;precompiles/bank/queryregisters bindings for key bank queries (balances, spendable, supply, params, metadata) including pagination reconstruction.Extends the bank precompile query surface. The bank precompile ABI and executor add missing retained view methods (string-address variants, spendable balances, total supply, denom metadata, params) and refactors supply handling; interfaces and tests are updated accordingly, plus an RFC documenting the migration approach.
Reviewed by Cursor Bugbot for commit d750c83. Bugbot is set up for automated code reviews on this repo. Configure here.