You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a Dash Platform user, I want duplicate identity key errors to be caught during validation (returning a proper ConsensusError) rather than during execution (returning a raw internal error), so that my wallet application can display a clear, structured error message.
Problem
validate_unique_identity_public_key_hashes_not_in_state() only checks the unique key hash set via has_any_of_unique_public_key_hashes(). However, the insertion code in insert_unique_public_key_hash_reference_to_identity_operations_v0() checks both unique AND non-unique sets before inserting.
This asymmetry creates a bypass:
Identity with key K is registered → K goes into the non-unique set
Another identity tries to register with the same key K
Pre-validation checks unique set only → K not there → validation passes ✅
Insertion checks non-unique set → K exists → execution fails 💥
Error surfaces as StateTransitionExecutionResult::InternalError(string) instead of a ConsensusError
The SDK client receives a gRPC Internal error with a raw string message instead of a structured ConsensusError::BasicError(DuplicatedIdentityPublicKeyIdBasicError).
Suggested Fix
In packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs, extend the validation to also call has_any_of_non_unique_public_key_hashes() (or equivalent) and return a DuplicatedIdentityPublicKeyIdBasicError if the key exists in either set.
changed the title [-]fix(drive-abci): pre-validation should check non-unique key hash set for duplicates[/-][+]fix(drive-abci): duplicate identity key bypasses pre-validation, returns internal error instead of ConsensusError[/+]on Mar 20, 2026
{
"code": 13,
"message": "<base64 of CBOR containing the error text below>",
"consensus_error": null
}
⚠️consensus_error: null is the smoking gun — Drive never created a ConsensusError, so the SDK cannot decode a structured error.
Decoded human-readable message:
storage: identity: a unique key with that hash already exists:
the key already exists in the non unique set
[70, 101, 149, 157, 72, 129, 155, 242, 168, 48, 11, 145, 180, 252, 122, 134, 152, 55, 135, 242]
IdentityError::UniqueKeyAlreadyExists(String)
→ #[from] conversions up to drive_abci::Error::Drive(DriveError)
→ .to_string() at process_raw_state_transitions/v0/mod.rs:502 ← type info destroyed here
→ StateTransitionExecutionResult::InternalError(error_string)
→ gRPC Internal (code 13) with drive-error-data-bin metadata
→ SDK: DriveInternalError(String) instead of ConsensusError
Activity
[-]fix(drive-abci): pre-validation should check non-unique key hash set for duplicates[/-][+]fix(drive-abci): duplicate identity key bypasses pre-validation, returns internal error instead of ConsensusError[/+]lklimek commentedon Apr 13, 2026
Reproduce with more precise reproduction scenario (actual data).
lklimek commentedon Apr 13, 2026
Detailed Reproduction Scenario & Test Vectors
Extracted from the original discovery session (DET session
37f94bec, 2026-03-20).Reproduction Steps
validate_unique_identity_public_key_hashes_not_in_state) checks only the unique set → K not found → validation passes ✅insert_unique_public_key_hash_reference_to_identity_operations_v0) checks both unique AND non-unique sets → finds K → execution fails 💥.to_string()atprocess_raw_state_transitions/v0/mod.rs:502, destroying type informationInternal(code 13) with base64-encoded CBOR instead of a structuredConsensusErrorTest Vectors
Duplicate public key hash (
[u8; 20]):Hex:
46659d48819bf2a8300b91b4fc7a86983887f2Raw gRPC error received by SDK:
Decoded
drive-error-data-binmetadata (CBOR → JSON):{ "code": 13, "message": "<base64 of CBOR containing the error text below>", "consensus_error": null }Decoded human-readable message:
Validation Asymmetry (Root Cause)
validate_unique_identity_public_key_hashes_not_in_state)insert_unique_public_key_hash_reference_to_identity)Error Propagation Chain
Key Files
.../validate_unique_identity_public_key_hashes_in_state/v0/mod.rshas_any_of_unique_public_key_hashes().../insert_unique_public_key_hash_reference_to_identity/v0/mod.rs.../process_raw_state_transitions/v0/mod.rs:502.to_string()destroys type information.../fetch_by_public_key_hashes/has_any_of_unique_public_key_hashes/v0/mod.rsunique_key_hashes_tree_path🤖 Co-authored by Claudius the Magnificent AI Agent
lklimek commentedon Apr 13, 2026
Key from identity A
Adding to identity B
Drive log
DET log