Repository navigation
Description
Expected Behavior
A where_json clause on an identifier-valued field — the system fields $ownerId and $id, or
any document property the contract types as byteArray/contentMediaType: application/x.dash.dpp.identifier
— matches the documents holding that identifier. A clause that cannot be evaluated is rejected,
rather than answered with an empty result.
Current Behavior
dash_sdk_document_search (and the aggregate query paths) parse where_json values with
json_to_platform_value, which maps every JSON string to Value::Text:
There is no way to express an identifier value: base58 text stays Value::Text, and the query
is built against an identifier-typed field with a text operand. Drive accepts it, evaluates it,
and returns zero rows with no error — so a caller cannot tell "no such document" from "this
filter can never match".
Verified on testnet against the identityVerify contract
(Bhptm3yBDhLkRNt7ofjpwaBHhMUKjDrQoPufKzQaxmpK, document type identityVerify), where a
document was known to exist:
where |
result |
|---|---|
[["normalizedLabel","==","<label>"]] |
the document |
[["$ownerId","==","<base58>"],["normalizedLabel","==","<label>"]] |
0 documents, grpc-status: 0 |
[["$ownerId","==","<base58>"],["normalizedParentDomainName","==","dash"],["normalizedLabel","==","<label>"]] |
0 documents, grpc-status: 0 |
The contract's indices cover the second and third shapes (ownerId,
ownerId_NormDomainName_NormLabel), so the empty result is the value comparison, not a missing
index.
Possible Solution
In json_to_platform_value, resolve the value against the field being compared instead of the
JSON type alone:
- for
$ownerIdand$id, decode the string as base58 intoValue::Identifier; - for a document property the contract types as an identifier, do the same, using the document
type already in hand when the clause is built; - when a string cannot be decoded for an identifier-typed field, return an error rather than
passing text through — an unmatchable query should fail loudly, which is what makes this class
of bug diagnosable.
Accepting an explicit form ({"base58": "..."} or a JSON array of 32 bytes) would work too, but
callers today write plain base58 strings, which is also what every other SDK surface returns for
these fields.
Both parsers need the change; sum.rs and average.rs route through build_base_query and
inherit it.
Steps to Reproduce (for bugs)
- Publish any document whose contract indexes
$ownerId. - Query it through
dash_sdk_document_searchwith
where_json = [["$ownerId","==","<owner base58>"]]. - Observe an empty
documentsarray and no error. - Repeat without the
$ownerIdclause — the document is returned.
The table above is the same check run over gRPC-web against an ENABLED testnet Evo node
(org.dash.platform.dapi.v0.Platform/getDocuments), independent of the FFI.
Context
Two call sites in dashpay/dashwallet-ios were written against this shape and both failed
silently:
- the username proof-of-identity lookup — a published
identityVerifylink never appeared on
the request-details screen, because the query filtered by$ownerIdand always came back
empty; - the DashConnect login-key response lookup, where the always-empty result makes a
create-or-replace decision always choose create, and stops the post-failure race recovery from
ever finding the document (filed as a separate issue on that repo).
Both were fixed app-side by dropping the $ownerId clause and checking ownership on the
returned document, but the FFI will keep offering the same trap: the query looks right, is
accepted, and answers with an empty set.
Your Environment
- Version used:
dashpay/platform@e096d1e89da29ef1e1ef1bbff2c02d9fb7c98083 - Environment name and version:
rs-sdk-ffivia SwiftDashSDK, iOS - Operating System and version: iOS simulator, Dash testnet
- Link to your project: https://github.com/dashpay/dashwallet-ios
Activity
romchornyi commentedon Sep 18, 2026
App-side companion issue, with the two call sites that hit this: dashpay/dashwallet-ios#1137
feat(dashpay): publish the proof-of-identity link and read it back