Summary
create_segment accepts any criteria_hash: String including an empty string. The criteria_hash field is documented as an IPFS hash of the targeting criteria. An empty hash means the segment has no resolvable definition — any consumer (targeting engine, privacy layer) that fetches the criteria from IPFS will get nothing. The segment can still have members added to it, creating a segment whose membership rules are unknown.
Location
contracts/audience-segments/src/lib.rs, create_segment
pub fn create_segment(env: Env, creator: Address, name: String, description: String,
criteria_hash: String, // ❌ empty string accepted
is_public: bool,
) -> u64 {
// no validation
Fix
if criteria_hash.len() == 0 {
panic!("criteria_hash cannot be empty");
}
Summary
create_segmentaccepts anycriteria_hash: Stringincluding an empty string. Thecriteria_hashfield is documented as an IPFS hash of the targeting criteria. An empty hash means the segment has no resolvable definition — any consumer (targeting engine, privacy layer) that fetches the criteria from IPFS will get nothing. The segment can still have members added to it, creating a segment whose membership rules are unknown.Location
contracts/audience-segments/src/lib.rs,create_segmentFix