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
Tests pin what happens to a contender whose domain document has an empty label:
ContenderRequest reads it as label: None and keeps created_at;
the C contender built from it has a null label pointer, and has_created_at / created_at stay as decoded;
the contender stays in the list. It is not dropped, and only its display label is missing.
Current Behavior
#5718 moved the contender decode into rs-sdk. ContenderRequest::from_document filters an empty label to None, and ffi_contender turns None into a null pointer. The list conversion used to allocate an empty C string instead. No test covers the empty-label case.
A valid DPNS document cannot have an empty label: DPNS v1–v3 require minLength: 3, and Drive-ABCI enforces it when the document is created. The tests are defensive. Null already means "did not decode", and the Swift readers already handle it.
Possible Solution
rs-sdk: a unit test in contender_request.rs that builds a domain document with label: "" and asserts label == None and created_at unchanged.
rs-sdk-ffi: a test in contender_document.rs that passes a ContenderRequest with label: None to ffi_contender and asserts a null label, the timestamp fields as given, and the identity id kept. It frees the contender afterwards.
Alternatives Considered
Reject empty labels explicitly in rs-sdk-ffi. That check already happens in rs-sdk, the layer that owns the decode, so a second check in the FFI would duplicate it.
Activity