mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 00:16:59 +00:00
The HLL aggregation side (estimate/merge/encode) existed but the construction side did not, and the Jackson wire (de)serializer silently dropped the `hll` field — so a JVM/Android relay could not actually answer COUNT with HLL. - HyperLogLog.addPubKey(): the NIP-45 construction (register index = pubkey byte at the filter offset; value = leading-zero-bits from offset+1, +1), KMP-safe. Plus HyperLogLog.builderFor(filter) and an HllBuilder that streams event pubkeys into registers and yields an approximate CountResult. - Plumb CountResult through the count path: SessionBackend.countResult / ReqResponder.countResult (default = exact count(); override for approximate/ hll); RelaySession sends the returned CountResult. - Fix CountResultSerializer/Deserializer (jvmAndroid) to write/read the `hll` hex field, matching the kotlinx serializer the native targets already use. - Tests for construction (index/value/merge-idempotence) and the wire path; RELAY.md Approximate COUNT section. https://claude.ai/code/session_016YBS2pWCBSDgAMthHzfCTr