this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: sig-verify benchmarks, updated results with k256 5×52 field

add signature verification benchmark infrastructure:
- zig: capture_sigs corpus builder, three-tier bench (full/crypto/preparsed)
- go: equivalent three-tier bench using dcrd/secp256k1
- justfile: capture-sigs, bench-sigs commands

update README: reframe as relay infrastructure benchmarks covering
both decode and verify. update sig-verify numbers (zig and go now
roughly even). add synthesis in "when this matters" section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz 3385d653 bcc61c43

+1072 -24
+1
.gitignore
··· 9 9 # go 10 10 go/atproto-bench 11 11 go-raw/atproto-bench-go-raw 12 + go-sigs/atproto-bench-sigs 12 13 13 14 # python 14 15 python/.venv/
+15 -15
README.md
··· 1 1 # atproto-bench 2 2 3 - SDK-level firehose benchmarks for AT Protocol. 3 + SDK-level benchmarks for AT Protocol relay infrastructure. 4 4 5 - decodes a corpus of real firehose frames. same corpus, verified work parity via block counts and error counts. 5 + measures the two CPU-bound bottlenecks a relay hits on every incoming commit: **decode** (CBOR + CAR + DAG-CBOR + CID verification) and **signature verification** (ECDSA). same corpora across all SDKs, verified work parity via block counts, error counts, and entry counts. 6 6 7 7 ## what this measures 8 8 ··· 147 147 148 148 | SDK | variant | verifies/sec (median) | entries | P-256 | secp256k1 | errors | 149 149 |-----|---------|--------:|-----:|-----:|-----:|-----:| 150 - | go ([indigo](https://github.com/bluesky-social/indigo)) | full pipeline | 15,123 | 3,072 | 0 | 3,072 | 0 | 151 - | go (indigo) | crypto-only | 14,969 | 3,072 | 0 | 3,072 | 0 | 152 - | go (indigo) | preparsed-key | 17,501 | 3,072 | 0 | 3,072 | 0 | 153 - | zig ([zat](https://tangled.sh/@zzstoatzz.io/zat) + [k256](https://tangled.sh/@zzstoatzz.io/k256)) | full pipeline | 9,830 | 3,072 | 0 | 3,072 | 0 | 154 - | zig (zat + k256) | crypto-only | 9,827 | 3,072 | 0 | 3,072 | 0 | 155 - | zig (zat + k256) | preparsed-key | 10,327 | 3,072 | 0 | 3,072 | 0 | 156 - 157 - Go leads by ~1.5x at the full pipeline level. the preparsed-key tier isolates pure ECDSA math: Go's SEC1 decompression is relatively expensive (~17% of crypto-only time), so the pure math gap is actually **1.7x**. 150 + | zig ([zat](https://tangled.sh/@zzstoatzz.io/zat) + [k256](https://tangled.sh/@zzstoatzz.io/k256)) | full pipeline | 16,251 | 3,072 | 0 | 3,072 | 0 | 151 + | zig (zat + k256) | crypto-only | 16,688 | 3,072 | 0 | 3,072 | 0 | 152 + | zig (zat + k256) | preparsed-key | 19,263 | 3,072 | 0 | 3,072 | 0 | 153 + | go ([indigo](https://github.com/bluesky-social/indigo)) | full pipeline | 15,462 | 3,072 | 0 | 3,072 | 0 | 154 + | go (indigo) | crypto-only | 15,315 | 3,072 | 0 | 3,072 | 0 | 155 + | go (indigo) | preparsed-key | 18,347 | 3,072 | 0 | 3,072 | 0 | 158 156 159 - indigo uses [decred/dcrd](https://github.com/decred/dcrd/tree/master/dcrec/secp256k1) — a highly optimized secp256k1 implementation with specialized 10×26-bit field arithmetic and NAF point multiplication. k256 v0.0.2 uses the same 10×26-bit field representation, GLV endomorphism, precomputed base point tables, and Jacobian point arithmetic. the remaining gap is a mix of stdlib scalar operations and normalize overhead in the Fe26 field arithmetic. 157 + roughly even. both use optimized secp256k1 implementations with GLV endomorphism and precomputed tables — k256 ports [libsecp256k1](https://github.com/bitcoin-core/secp256k1)'s field arithmetic, indigo uses [decred/dcrd](https://github.com/decred/dcrd/tree/master/dcrec/secp256k1). 160 158 161 159 the crypto-only vs full-pipeline numbers being nearly identical confirms ECDSA is the bottleneck, not CBOR re-encoding overhead. the preparsed-key tier shows key parsing is a small but measurable cost — relevant for relay implementations that cache public keys per-DID. 162 160 ··· 191 189 192 190 ## when this matters 193 191 194 - **for live firehose consumption: usually no.** at ~500-1000 events/sec (full bluesky network), any of these SDKs decode fast enough. 192 + **for live firehose consumption: usually no.** at ~500-1000 events/sec (full bluesky network), any of these SDKs handle the load. 195 193 196 194 **where it matters:** 197 - - **backfill / replay** — processing months of historical data. decode throughput determines catch-up speed. 198 - - **relays at scale** — routing events to many downstream consumers. every microsecond counts when multiplied. 195 + - **backfill / replay** — processing months of historical data. decode + verify throughput determines catch-up speed. 196 + - **relays at scale** — routing events to many downstream consumers. every microsecond of decode + verify overhead compounds across fan-out. 199 197 - **memory** — smaller value types mean less memory per in-flight frame. 198 + 199 + **the overall picture:** decode throughput varies ~15x across SDKs (dominated by CBOR/memory architecture choices). signature verification is roughly even between the two SDKs that implement it — both use optimized secp256k1 libraries and the math is the same. for relay workloads, decode is the differentiator; sig-verify is table stakes. 200 200 201 201 ## SDKs tested 202 202 203 203 | lang | SDK | version | CBOR engine | CAR engine | 204 204 |------|-----|---------|-------------|------------| 205 - | zig | [zat](https://tangled.sh/@zzstoatzz.io/zat) v0.2.2 + [k256](https://tangled.sh/@zzstoatzz.io/k256) v0.0.2 | — | hand-rolled | hand-rolled (+ SHA-256 CID verify, size limits) | 205 + | zig | [zat](https://tangled.sh/@zzstoatzz.io/zat) v0.2.2 + [k256](https://tangled.sh/@zzstoatzz.io/k256) v0.0.3 | — | hand-rolled | hand-rolled (+ SHA-256 CID verify, size limits) | 206 206 | rust | raw (minicbor + bumpalo) | — | [minicbor](https://crates.io/crates/minicbor) (zero-copy) | hand-rolled (sync) | 207 207 | rust | [jacquard](https://github.com/rsform/jacquard) | 0.9 | [ciborium](https://crates.io/crates/ciborium) (header) + [serde_ipld_dagcbor](https://crates.io/crates/serde_ipld_dagcbor) (body) | [iroh-car](https://crates.io/crates/iroh-car) (async) | 208 208 | go | raw (fxamacker/cbor) | — | [fxamacker/cbor](https://github.com/fxamacker/cbor) | hand-rolled (sync, no CID verify) |
+70
go-sigs/go.mod
··· 1 + module atproto-bench-sigs 2 + 3 + go 1.25.1 4 + 5 + require github.com/bluesky-social/indigo v0.0.0-20260220055544-bf41e2ee75ab 6 + 7 + require ( 8 + github.com/beorn7/perks v1.0.1 // indirect 9 + github.com/cespare/xxhash/v2 v2.2.0 // indirect 10 + github.com/earthboundkid/versioninfo/v2 v2.24.1 // indirect 11 + github.com/go-logr/logr v1.4.1 // indirect 12 + github.com/go-logr/stdr v1.2.2 // indirect 13 + github.com/gogo/protobuf v1.3.2 // indirect 14 + github.com/google/uuid v1.4.0 // indirect 15 + github.com/hashicorp/golang-lru v1.0.2 // indirect 16 + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect 17 + github.com/ipfs/bbloom v0.0.4 // indirect 18 + github.com/ipfs/go-block-format v0.2.0 // indirect 19 + github.com/ipfs/go-blockservice v0.5.2 // indirect 20 + github.com/ipfs/go-cid v0.4.1 // indirect 21 + github.com/ipfs/go-datastore v0.6.0 // indirect 22 + github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect 23 + github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect 24 + github.com/ipfs/go-ipfs-exchange-interface v0.2.1 // indirect 25 + github.com/ipfs/go-ipfs-util v0.0.3 // indirect 26 + github.com/ipfs/go-ipld-cbor v0.1.0 // indirect 27 + github.com/ipfs/go-ipld-format v0.6.0 // indirect 28 + github.com/ipfs/go-ipld-legacy v0.2.1 // indirect 29 + github.com/ipfs/go-log v1.0.5 // indirect 30 + github.com/ipfs/go-log/v2 v2.5.1 // indirect 31 + github.com/ipfs/go-merkledag v0.11.0 // indirect 32 + github.com/ipfs/go-metrics-interface v0.0.1 // indirect 33 + github.com/ipfs/go-verifcid v0.0.3 // indirect 34 + github.com/ipld/go-car v0.6.1-0.20230509095817-92d28eb23ba4 // indirect 35 + github.com/ipld/go-codec-dagpb v1.6.0 // indirect 36 + github.com/ipld/go-ipld-prime v0.21.0 // indirect 37 + github.com/jbenet/goprocess v0.1.4 // indirect 38 + github.com/klauspost/cpuid/v2 v2.2.7 // indirect 39 + github.com/mattn/go-isatty v0.0.20 // indirect 40 + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect 41 + github.com/minio/sha256-simd v1.0.1 // indirect 42 + github.com/mr-tron/base58 v1.2.0 // indirect 43 + github.com/multiformats/go-base32 v0.1.0 // indirect 44 + github.com/multiformats/go-base36 v0.2.0 // indirect 45 + github.com/multiformats/go-multibase v0.2.0 // indirect 46 + github.com/multiformats/go-multihash v0.2.3 // indirect 47 + github.com/multiformats/go-varint v0.0.7 // indirect 48 + github.com/opentracing/opentracing-go v1.2.0 // indirect 49 + github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f // indirect 50 + github.com/prometheus/client_golang v1.17.0 // indirect 51 + github.com/prometheus/client_model v0.5.0 // indirect 52 + github.com/prometheus/common v0.45.0 // indirect 53 + github.com/prometheus/procfs v0.12.0 // indirect 54 + github.com/spaolacci/murmur3 v1.1.0 // indirect 55 + github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e // indirect 56 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect 57 + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect 58 + go.opentelemetry.io/otel v1.21.0 // indirect 59 + go.opentelemetry.io/otel/metric v1.21.0 // indirect 60 + go.opentelemetry.io/otel/trace v1.21.0 // indirect 61 + go.uber.org/atomic v1.11.0 // indirect 62 + go.uber.org/multierr v1.11.0 // indirect 63 + go.uber.org/zap v1.26.0 // indirect 64 + golang.org/x/crypto v0.21.0 // indirect 65 + golang.org/x/sys v0.22.0 // indirect 66 + golang.org/x/time v0.3.0 // indirect 67 + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect 68 + google.golang.org/protobuf v1.33.0 // indirect 69 + lukechampine.com/blake3 v1.2.1 // indirect 70 + )
+324
go-sigs/go.sum
··· 1 + github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 + github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 3 + github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= 4 + github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 5 + github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 6 + github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 7 + github.com/bluesky-social/indigo v0.0.0-20260220055544-bf41e2ee75ab h1:Cs35T2tAN3Q6mMH5mBaY09nmCNOn/GkZS1F7jfMxlR8= 8 + github.com/bluesky-social/indigo v0.0.0-20260220055544-bf41e2ee75ab/go.mod h1:VG/LeqLGNI3Ew7lsYixajnZGFfWPv144qbUddh+Oyag= 9 + github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= 10 + github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 11 + github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 12 + github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= 13 + github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= 14 + github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 15 + github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 16 + github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 17 + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= 18 + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= 19 + github.com/earthboundkid/versioninfo/v2 v2.24.1 h1:SJTMHaoUx3GzjjnUO1QzP3ZXK6Ee/nbWyCm58eY3oUg= 20 + github.com/earthboundkid/versioninfo/v2 v2.24.1/go.mod h1:VcWEooDEuyUJnMfbdTh0uFN4cfEIg+kHMuWB2CDCLjw= 21 + github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= 22 + github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= 23 + github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 24 + github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= 25 + github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 26 + github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 27 + github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 28 + github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= 29 + github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 30 + github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 31 + github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 32 + github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 33 + github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= 34 + github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= 35 + github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 36 + github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= 37 + github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 38 + github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= 39 + github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= 40 + github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= 41 + github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= 42 + github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= 43 + github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= 44 + github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= 45 + github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= 46 + github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= 47 + github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= 48 + github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ= 49 + github.com/ipfs/go-bitswap v0.11.0/go.mod h1:05aE8H3XOU+LXpTedeAS0OZpcO1WFsj5niYQH9a1Tmk= 50 + github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= 51 + github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= 52 + github.com/ipfs/go-blockservice v0.5.2 h1:in9Bc+QcXwd1apOVM7Un9t8tixPKdaHQFdLSUM1Xgk8= 53 + github.com/ipfs/go-blockservice v0.5.2/go.mod h1:VpMblFEqG67A/H2sHKAemeH9vlURVavlysbdUI632yk= 54 + github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= 55 + github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= 56 + github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= 57 + github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= 58 + github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= 59 + github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= 60 + github.com/ipfs/go-ipfs-blockstore v1.3.1 h1:cEI9ci7V0sRNivqaOr0elDsamxXFxJMMMy7PTTDQNsQ= 61 + github.com/ipfs/go-ipfs-blockstore v1.3.1/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= 62 + github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= 63 + github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= 64 + github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= 65 + github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= 66 + github.com/ipfs/go-ipfs-ds-help v1.1.1 h1:B5UJOH52IbcfS56+Ul+sv8jnIV10lbjLF5eOO0C66Nw= 67 + github.com/ipfs/go-ipfs-ds-help v1.1.1/go.mod h1:75vrVCkSdSFidJscs8n4W+77AtTpCIAdDGAwjitJMIo= 68 + github.com/ipfs/go-ipfs-exchange-interface v0.2.1 h1:jMzo2VhLKSHbVe+mHNzYgs95n0+t0Q69GQ5WhRDZV/s= 69 + github.com/ipfs/go-ipfs-exchange-interface v0.2.1/go.mod h1:MUsYn6rKbG6CTtsDp+lKJPmVt3ZrCViNyH3rfPGsZ2E= 70 + github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA= 71 + github.com/ipfs/go-ipfs-exchange-offline v0.3.0/go.mod h1:MOdJ9DChbb5u37M1IcbrRB02e++Z7521fMxqCNRrz9s= 72 + github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY= 73 + github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= 74 + github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc= 75 + github.com/ipfs/go-ipfs-routing v0.3.0/go.mod h1:dKqtTFIql7e1zYsEuWLyuOU+E0WJWW8JjbTPLParDWo= 76 + github.com/ipfs/go-ipfs-util v0.0.3 h1:2RFdGez6bu2ZlZdI+rWfIdbQb1KudQp3VGwPtdNCmE0= 77 + github.com/ipfs/go-ipfs-util v0.0.3/go.mod h1:LHzG1a0Ig4G+iZ26UUOMjHd+lfM84LZCrn17xAKWBvs= 78 + github.com/ipfs/go-ipld-cbor v0.1.0 h1:dx0nS0kILVivGhfWuB6dUpMa/LAwElHPw1yOGYopoYs= 79 + github.com/ipfs/go-ipld-cbor v0.1.0/go.mod h1:U2aYlmVrJr2wsUBU67K4KgepApSZddGRDWBYR0H4sCk= 80 + github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U= 81 + github.com/ipfs/go-ipld-format v0.6.0/go.mod h1:g4QVMTn3marU3qXchwjpKPKgJv+zF+OlaKMyhJ4LHPg= 82 + github.com/ipfs/go-ipld-legacy v0.2.1 h1:mDFtrBpmU7b//LzLSypVrXsD8QxkEWxu5qVxN99/+tk= 83 + github.com/ipfs/go-ipld-legacy v0.2.1/go.mod h1:782MOUghNzMO2DER0FlBR94mllfdCJCkTtDtPM51otM= 84 + github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= 85 + github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= 86 + github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= 87 + github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= 88 + github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= 89 + github.com/ipfs/go-merkledag v0.11.0 h1:DgzwK5hprESOzS4O1t/wi6JDpyVQdvm9Bs59N/jqfBY= 90 + github.com/ipfs/go-merkledag v0.11.0/go.mod h1:Q4f/1ezvBiJV0YCIXvt51W/9/kqJGH4I1LsA7+djsM4= 91 + github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= 92 + github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= 93 + github.com/ipfs/go-peertaskqueue v0.8.0 h1:JyNO144tfu9bx6Hpo119zvbEL9iQ760FHOiJYsUjqaU= 94 + github.com/ipfs/go-peertaskqueue v0.8.0/go.mod h1:cz8hEnnARq4Du5TGqiWKgMr/BOSQ5XOgMOh1K5YYKKM= 95 + github.com/ipfs/go-verifcid v0.0.3 h1:gmRKccqhWDocCRkC+a59g5QW7uJw5bpX9HWBevXa0zs= 96 + github.com/ipfs/go-verifcid v0.0.3/go.mod h1:gcCtGniVzelKrbk9ooUSX/pM3xlH73fZZJDzQJRvOUw= 97 + github.com/ipld/go-car v0.6.1-0.20230509095817-92d28eb23ba4 h1:oFo19cBmcP0Cmg3XXbrr0V/c+xU9U1huEZp8+OgBzdI= 98 + github.com/ipld/go-car v0.6.1-0.20230509095817-92d28eb23ba4/go.mod h1:6nkFF8OmR5wLKBzRKi7/YFJpyYR7+oEn1DX+mMWnlLA= 99 + github.com/ipld/go-codec-dagpb v1.6.0 h1:9nYazfyu9B1p3NAgfVdpRco3Fs2nFC72DqVsMj6rOcc= 100 + github.com/ipld/go-codec-dagpb v1.6.0/go.mod h1:ANzFhfP2uMJxRBr8CE+WQWs5UsNa0pYtmKZ+agnUw9s= 101 + github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E= 102 + github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ= 103 + github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= 104 + github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= 105 + github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= 106 + github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= 107 + github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= 108 + github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= 109 + github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= 110 + github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= 111 + github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 112 + github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= 113 + github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= 114 + github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8= 115 + github.com/koron/go-ssdp v0.0.3/go.mod h1:b2MxI6yh02pKrsyNoQUsk4+YNikaGhe4894J+Q5lDvA= 116 + github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 117 + github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 118 + github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 119 + github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 120 + github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 121 + github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 122 + github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 123 + github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= 124 + github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= 125 + github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= 126 + github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= 127 + github.com/libp2p/go-libp2p v0.22.0 h1:2Tce0kHOp5zASFKJbNzRElvh0iZwdtG5uZheNW8chIw= 128 + github.com/libp2p/go-libp2p v0.22.0/go.mod h1:UDolmweypBSjQb2f7xutPnwZ/fxioLbMBxSjRksxxU4= 129 + github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw= 130 + github.com/libp2p/go-libp2p-asn-util v0.2.0/go.mod h1:WoaWxbHKBymSN41hWSq/lGKJEca7TNm58+gGJi2WsLI= 131 + github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= 132 + github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= 133 + github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= 134 + github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= 135 + github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= 136 + github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= 137 + github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg= 138 + github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= 139 + github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE= 140 + github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= 141 + github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo= 142 + github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc= 143 + github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 144 + github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 145 + github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 146 + github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= 147 + github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= 148 + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= 149 + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= 150 + github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= 151 + github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= 152 + github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= 153 + github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= 154 + github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= 155 + github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= 156 + github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= 157 + github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= 158 + github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= 159 + github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= 160 + github.com/multiformats/go-multiaddr v0.7.0 h1:gskHcdaCyPtp9XskVwtvEeQOG465sCohbQIirSyqxrc= 161 + github.com/multiformats/go-multiaddr v0.7.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= 162 + github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= 163 + github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= 164 + github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= 165 + github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= 166 + github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= 167 + github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= 168 + github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= 169 + github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= 170 + github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= 171 + github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= 172 + github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o= 173 + github.com/multiformats/go-multistream v0.3.3/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= 174 + github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= 175 + github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= 176 + github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= 177 + github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= 178 + github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 179 + github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 180 + github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 181 + github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f h1:VXTQfuJj9vKR4TCkEuWIckKvdHFeJH/huIFJ9/cXOB0= 182 + github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= 183 + github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= 184 + github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= 185 + github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= 186 + github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= 187 + github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= 188 + github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= 189 + github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= 190 + github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= 191 + github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 192 + github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= 193 + github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= 194 + github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 195 + github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 196 + github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= 197 + github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= 198 + github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= 199 + github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= 200 + github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= 201 + github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= 202 + github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= 203 + github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 204 + github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 205 + github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 206 + github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 207 + github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 208 + github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= 209 + github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 210 + github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= 211 + github.com/warpfork/go-testmark v0.12.1 h1:rMgCpJfwy1sJ50x0M0NgyphxYYPMOODIJHhsXyEHU0s= 212 + github.com/warpfork/go-testmark v0.12.1/go.mod h1:kHwy7wfvGSPh1rQJYKayD4AbtNaeyZdcGi9tNJTaa5Y= 213 + github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= 214 + github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= 215 + github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e h1:28X54ciEwwUxyHn9yrZfl5ojgF4CBNLWX7LR0rvBkf4= 216 + github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so= 217 + github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 218 + github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 219 + github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= 220 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= 221 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= 222 + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= 223 + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 224 + go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= 225 + go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= 226 + go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= 227 + go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= 228 + go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= 229 + go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= 230 + go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= 231 + go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= 232 + go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= 233 + go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= 234 + go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= 235 + go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= 236 + go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= 237 + go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= 238 + go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= 239 + go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= 240 + go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= 241 + go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= 242 + go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= 243 + go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= 244 + go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= 245 + go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= 246 + golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 247 + golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 248 + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 249 + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 250 + golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= 251 + golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= 252 + golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 253 + golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 254 + golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 255 + golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 256 + golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 257 + golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= 258 + golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 259 + golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 260 + golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 261 + golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 262 + golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 263 + golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 264 + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= 265 + golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= 266 + golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= 267 + golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 268 + golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 269 + golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 270 + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 271 + golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= 272 + golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 273 + golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 274 + golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 275 + golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 276 + golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 277 + golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 278 + golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 279 + golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 280 + golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 281 + golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 282 + golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= 283 + golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 284 + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 285 + golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 286 + golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 287 + golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= 288 + golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 289 + golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 290 + golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 291 + golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 292 + golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 293 + golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 294 + golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 295 + golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 296 + golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 297 + golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 298 + golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 299 + golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= 300 + golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= 301 + golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 302 + golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 303 + golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 304 + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 305 + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= 306 + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= 307 + google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= 308 + google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 309 + gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 310 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 311 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 312 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 313 + gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 314 + gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 315 + gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 316 + gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 317 + gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 318 + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 319 + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 320 + gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 321 + gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 322 + honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 323 + lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= 324 + lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
+55 -2
go/main.go
··· 7 7 import ( 8 8 "bytes" 9 9 "encoding/binary" 10 + "encoding/json" 10 11 "fmt" 11 12 "io" 12 13 "os" ··· 67 68 } 68 69 fmt.Println() 69 70 70 - benchDecode(corpus) 71 + results := benchDecode(corpus) 72 + writeDecodeJSON(corpus, results) 71 73 72 74 fmt.Println() 73 75 } ··· 113 115 return result 114 116 } 115 117 116 - func benchDecode(corpus *corpusInfo) { 118 + func benchDecode(corpus *corpusInfo) []passResult { 117 119 for i := 0; i < warmupPasses; i++ { 118 120 for _, frame := range corpus.frames { 119 121 _ = decodeFull(frame) ··· 140 142 } 141 143 142 144 reportResult("decode", corpus, passResults) 145 + return passResults 143 146 } 144 147 145 148 func reportResult(name string, corpus *corpusInfo, passResults []passResult) { ··· 172 175 name, medianFps, throughputMb, totalBlocks, blocksPerFrame, totalErrors) 173 176 fmt.Printf("%-14s variance: min=%.0f median=%.0f max=%.0f frames/sec\n", 174 177 "", minFps, medianFps, maxFps) 178 + } 179 + 180 + type decodeBenchJSON struct { 181 + Benchmark string `json:"benchmark"` 182 + SDK string `json:"sdk"` 183 + Variant string `json:"variant"` 184 + Corpus decodeCorpusJSON `json:"corpus"` 185 + Passes []decodePassJSON `json:"passes"` 186 + MedianFPS float64 `json:"median_frames_per_sec"` 187 + MinFPS float64 `json:"min_frames_per_sec"` 188 + MaxFPS float64 `json:"max_frames_per_sec"` 189 + } 190 + 191 + type decodeCorpusJSON struct { 192 + Frames int `json:"frames"` 193 + TotalBytes int `json:"total_bytes"` 194 + } 195 + 196 + type decodePassJSON struct { 197 + FramesPerSec float64 `json:"frames_per_sec"` 198 + Blocks int `json:"blocks"` 199 + Errors int `json:"errors"` 200 + } 201 + 202 + func writeDecodeJSON(corpus *corpusInfo, results []passResult) { 203 + fpsValues := make([]float64, len(results)) 204 + var passes []decodePassJSON 205 + for i, r := range results { 206 + fps := float64(r.frames) / r.elapsed.Seconds() 207 + fpsValues[i] = fps 208 + passes = append(passes, decodePassJSON{FramesPerSec: fps, Blocks: r.blocks, Errors: r.errors}) 209 + } 210 + sort.Float64s(fpsValues) 211 + 212 + j := decodeBenchJSON{ 213 + Benchmark: "decode", 214 + SDK: "go (indigo)", 215 + Variant: "decode", 216 + Corpus: decodeCorpusJSON{Frames: len(corpus.frames), TotalBytes: corpus.totalBytes}, 217 + Passes: passes, 218 + MedianFPS: fpsValues[measuredPasses/2], 219 + MinFPS: fpsValues[0], 220 + MaxFPS: fpsValues[measuredPasses-1], 221 + } 222 + 223 + data, err := json.MarshalIndent(j, "", " ") 224 + if err != nil { 225 + return 226 + } 227 + _ = os.WriteFile(filepath.Join(fixturesDir, "decode-go.json"), data, 0644) 175 228 } 176 229 177 230 func loadCorpus(name string) (*corpusInfo, error) {
+34
justfile
··· 45 45 bench-python: _ensure-fixtures 46 46 cd python && uv run bench.py 47 47 48 + # --- signature verification --- 49 + 50 + # capture signed commits + public keys from firehose (~10s) 51 + capture-sigs: 52 + cd zig && zig build run-capture-sigs 53 + 54 + # run all sig verify benchmarks 55 + bench-sigs: _ensure-sigs-fixtures 56 + @echo "============================================" 57 + @echo " atproto sig-verify benchmarks" 58 + @echo "============================================" 59 + @echo "" 60 + @echo "corpus: sig-verify-corpus.bin ($(wc -c < fixtures/sig-verify-corpus.bin | tr -d ' ') bytes)" 61 + @echo "" 62 + @echo "--------------------------------------------" 63 + cd zig && zig build run-bench-sigs -Doptimize=ReleaseFast 64 + @echo "--------------------------------------------" 65 + cd go-sigs && go run . 66 + @echo "============================================" 67 + 68 + bench-sigs-zig: _ensure-sigs-fixtures 69 + cd zig && zig build run-bench-sigs -Doptimize=ReleaseFast 70 + 71 + bench-sigs-go: _ensure-sigs-fixtures 72 + cd go-sigs && go run . 73 + 74 + # --- build/clean --- 75 + 48 76 # build all (no run) 49 77 build: 50 78 cd zig && zig build 51 79 cd rust && cargo build --release 52 80 cd rust-raw && cargo build --release 53 81 cd go && go build . 82 + cd go-sigs && go build . 54 83 55 84 # clean build artifacts 56 85 clean: ··· 58 87 cd rust && cargo clean 59 88 cd rust-raw && cargo clean 60 89 rm -f go/atproto-bench 90 + rm -f go-sigs/atproto-bench-sigs 61 91 rm -rf python/.venv 62 92 63 93 _ensure-fixtures: 64 94 @test -f fixtures/firehose-frames.bin \ 65 95 || (echo "fixtures not found — run 'just capture' first" && exit 1) 96 + 97 + _ensure-sigs-fixtures: 98 + @test -f fixtures/sig-verify-corpus.bin \ 99 + || (echo "sig corpus not found — run 'just capture-sigs' first" && exit 1)
+44
zig/build.zig
··· 50 50 const run_bench = b.addRunArtifact(bench); 51 51 const bench_step = b.step("run-bench", "run benchmarks"); 52 52 bench_step.dependOn(&run_bench.step); 53 + 54 + // signature corpus capture tool — needs websocket + zat for DID resolution 55 + const capture_sigs = b.addExecutable(.{ 56 + .name = "capture-sigs", 57 + .root_module = b.createModule(.{ 58 + .root_source_file = b.path("src/capture_sigs.zig"), 59 + .target = target, 60 + .optimize = optimize, 61 + .imports = &.{ 62 + .{ .name = "zat", .module = zat_mod }, 63 + .{ .name = "websocket", .module = ws_mod }, 64 + }, 65 + }), 66 + }); 67 + b.installArtifact(capture_sigs); 68 + 69 + const run_capture_sigs = b.addRunArtifact(capture_sigs); 70 + const capture_sigs_step = b.step("run-capture-sigs", "capture sig verify corpus from live network"); 71 + capture_sigs_step.dependOn(&run_capture_sigs.step); 72 + 73 + // k256 — optimized secp256k1 verification 74 + const k256_mod = b.dependency("k256", .{ 75 + .target = target, 76 + .optimize = optimize, 77 + }).module("k256"); 78 + 79 + // signature verification benchmark 80 + const bench_sigs = b.addExecutable(.{ 81 + .name = "bench-sigs", 82 + .root_module = b.createModule(.{ 83 + .root_source_file = b.path("src/bench_sigs.zig"), 84 + .target = target, 85 + .optimize = optimize, 86 + .imports = &.{ 87 + .{ .name = "zat", .module = zat_mod }, 88 + .{ .name = "k256", .module = k256_mod }, 89 + }, 90 + }), 91 + }); 92 + b.installArtifact(bench_sigs); 93 + 94 + const run_bench_sigs = b.addRunArtifact(bench_sigs); 95 + const bench_sigs_step = b.step("run-bench-sigs", "run sig verify benchmarks"); 96 + bench_sigs_step.dependOn(&run_bench_sigs.step); 53 97 }
+1 -2
zig/build.zig.zon
··· 9 9 .hash = "zat-0.2.0-5PuC7mAuBADmN7OZkGvymjk9jq4akxdl-IlHSo8r25pr", 10 10 }, 11 11 .k256 = .{ 12 - .url = "https://tangled.sh/zzstoatzz.io/k256/archive/v0.0.3", 13 - .hash = "k256-0.0.1-w2pjn-QJAQAS5JQzWWjrU09iXKCEdhqLC-T06n84boZR", 12 + .path = "../../k256", 14 13 }, 15 14 }, 16 15 .paths = .{
+89 -5
zig/src/bench.zig
··· 52 52 } 53 53 54 54 // with CID hash verification (production-correct, comparable to go/indigo) 55 - benchDecodeFrame(allocator, corpus, .{ .verify_cid_hashes = true }) catch |err| { 55 + const verify_results = benchDecodeFrame(allocator, corpus, .{ .verify_cid_hashes = true }) catch |err| blk: { 56 56 std.debug.print("decode+verify (reuse): SKIP ({s})\n", .{@errorName(err)}); 57 + break :blk null; 57 58 }; 58 59 59 - benchDecodeFrame(allocator, corpus, .{ .verify_cid_hashes = false }) catch |err| { 60 + const decode_results = benchDecodeFrame(allocator, corpus, .{ .verify_cid_hashes = false }) catch |err| blk: { 60 61 std.debug.print("decode (reuse): SKIP ({s})\n", .{@errorName(err)}); 62 + break :blk null; 61 63 }; 62 64 63 - benchDecodeFrameAlloc(allocator, corpus, .{ .verify_cid_hashes = false }) catch |err| { 65 + const alloc_results = benchDecodeFrameAlloc(allocator, corpus, .{ .verify_cid_hashes = false }) catch |err| blk: { 64 66 std.debug.print("decode (alloc): SKIP ({s})\n", .{@errorName(err)}); 67 + break :blk null; 65 68 }; 69 + 70 + // write JSON output 71 + writeDecodeJson(allocator, corpus, verify_results, decode_results, alloc_results); 66 72 67 73 std.debug.print("\n", .{}); 68 74 } ··· 114 120 } 115 121 116 122 /// arena reuse: production allocation pattern — one arena, reset per frame. 117 - fn benchDecodeFrame(allocator: Allocator, corpus: CorpusInfo, options: DecodeOptions) !void { 123 + fn benchDecodeFrame(allocator: Allocator, corpus: CorpusInfo, options: DecodeOptions) ![measured_passes]PassResult { 118 124 const label = if (options.verify_cid_hashes) "decode+v (reuse)" else "decode (reuse)"; 119 125 var arena = std.heap.ArenaAllocator.init(allocator); 120 126 defer arena.deinit(); ··· 152 158 } 153 159 154 160 reportResult(label, corpus, &pass_results, total_blocks, total_errors); 161 + return pass_results; 155 162 } 156 163 157 164 /// arena per-frame: fair cross-language comparison — fresh alloc/free per frame. 158 - fn benchDecodeFrameAlloc(allocator: Allocator, corpus: CorpusInfo, options: DecodeOptions) !void { 165 + fn benchDecodeFrameAlloc(allocator: Allocator, corpus: CorpusInfo, options: DecodeOptions) ![measured_passes]PassResult { 159 166 const label = if (options.verify_cid_hashes) "decode+v (alloc)" else "decode (alloc)"; 160 167 for (0..warmup_passes) |_| { 161 168 for (corpus.frames) |frame| { ··· 192 199 } 193 200 194 201 reportResult(label, corpus, &pass_results, total_blocks, total_errors); 202 + return pass_results; 195 203 } 196 204 197 205 fn reportResult( ··· 238 246 median_fps, 239 247 max_fps, 240 248 }); 249 + } 250 + 251 + fn writeDecodeJson( 252 + allocator: Allocator, 253 + corpus: CorpusInfo, 254 + verify_results: ?[measured_passes]PassResult, 255 + decode_results: ?[measured_passes]PassResult, 256 + alloc_results: ?[measured_passes]PassResult, 257 + ) void { 258 + const variants = [_]struct { name: []const u8, file: []const u8, results: ?[measured_passes]PassResult }{ 259 + .{ .name = "decode+verify", .file = fixtures_dir ++ "/decode-verify-zig.json", .results = verify_results }, 260 + .{ .name = "decode-reuse", .file = fixtures_dir ++ "/decode-reuse-zig.json", .results = decode_results }, 261 + .{ .name = "decode-alloc", .file = fixtures_dir ++ "/decode-alloc-zig.json", .results = alloc_results }, 262 + }; 263 + 264 + for (variants) |v| { 265 + const results = v.results orelse continue; 266 + const json = buildDecodeJson(allocator, v.name, corpus, &results) catch continue; 267 + defer allocator.free(json); 268 + const file = std.fs.cwd().createFile(v.file, .{}) catch continue; 269 + defer file.close(); 270 + file.writeAll(json) catch continue; 271 + } 272 + } 273 + 274 + fn buildDecodeJson( 275 + allocator: Allocator, 276 + variant: []const u8, 277 + corpus: CorpusInfo, 278 + pass_results: []const PassResult, 279 + ) ![]u8 { 280 + var fps_values: [measured_passes]f64 = undefined; 281 + for (pass_results, 0..) |r, i| { 282 + const elapsed_s = @as(f64, @floatFromInt(r.elapsed_ns)) / 1_000_000_000.0; 283 + fps_values[i] = @as(f64, @floatFromInt(r.frames)) / elapsed_s; 284 + } 285 + std.mem.sort(f64, &fps_values, {}, std.sort.asc(f64)); 286 + 287 + var buf: std.ArrayListUnmanaged(u8) = .{}; 288 + errdefer buf.deinit(allocator); 289 + const w = buf.writer(allocator); 290 + 291 + try w.print( 292 + \\{{ 293 + \\ "benchmark": "decode", 294 + \\ "sdk": "zig (zat)", 295 + \\ "variant": "{s}", 296 + \\ "corpus": {{ "frames": {d}, "total_bytes": {d} }}, 297 + \\ "passes": [ 298 + \\ 299 + , .{ variant, corpus.frames.len, corpus.total_bytes }); 300 + 301 + for (pass_results, 0..) |r, i| { 302 + const elapsed_s = @as(f64, @floatFromInt(r.elapsed_ns)) / 1_000_000_000.0; 303 + const fps = @as(f64, @floatFromInt(r.frames)) / elapsed_s; 304 + try w.print( 305 + \\ {{ "frames_per_sec": {d:.0}, "blocks": {d}, "errors": {d} }} 306 + , .{ fps, r.blocks, r.errors }); 307 + if (i < pass_results.len - 1) try w.writeAll(","); 308 + try w.writeAll("\n"); 309 + } 310 + 311 + try w.print( 312 + \\ ], 313 + \\ "median_frames_per_sec": {d:.0}, 314 + \\ "min_frames_per_sec": {d:.0}, 315 + \\ "max_frames_per_sec": {d:.0} 316 + \\}} 317 + \\ 318 + , .{ 319 + fps_values[measured_passes / 2], 320 + fps_values[0], 321 + fps_values[measured_passes - 1], 322 + }); 323 + 324 + return try buf.toOwnedSlice(allocator); 241 325 } 242 326 243 327 fn loadCorpus(allocator: Allocator, path: []const u8) !CorpusInfo {
+439
zig/src/capture_sigs.zig
··· 1 + //! capture signed commits + public keys from live AT Protocol firehose. 2 + //! 3 + //! connects to firehose, extracts signed commit blocks from CAR data, 4 + //! resolves DIDs via PLC directory to get signing keys, validates each 5 + //! entry by verifying the signature, writes corpus to ../fixtures/sig-verify-corpus.bin. 6 + //! 7 + //! corpus format: 8 + //! [u32 BE entry_count] 9 + //! per entry: 10 + //! [u8 curve_type] // 0 = P-256, 1 = secp256k1 11 + //! [u16 BE signed_len][signed_bytes...] // signed commit CBOR (with sig field) 12 + //! [u16 BE pubkey_len][pubkey_bytes...] // compressed public key (33 bytes typical) 13 + 14 + const std = @import("std"); 15 + const zat = @import("zat"); 16 + const websocket = @import("websocket"); 17 + 18 + const Allocator = std.mem.Allocator; 19 + const cbor = zat.cbor; 20 + const car = zat.car; 21 + 22 + const fixtures_dir = "../fixtures"; 23 + const capture_duration_s = 10; 24 + const ns_per_s = std.time.ns_per_s; 25 + const max_resolve_threads = 16; 26 + 27 + const CorpusEntry = struct { 28 + curve_type: u8, // 0 = P-256, 1 = secp256k1 29 + signed_bytes: []const u8, // full signed commit CBOR 30 + pubkey_bytes: []const u8, // compressed public key (33 bytes) 31 + }; 32 + 33 + const RawCommit = struct { 34 + did: []const u8, 35 + signed_bytes: []const u8, 36 + }; 37 + 38 + const CachedKey = struct { 39 + curve_type: u8, 40 + raw: []const u8, 41 + }; 42 + 43 + pub fn main() !void { 44 + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .{}; 45 + defer _ = gpa.deinit(); 46 + const allocator = gpa.allocator(); 47 + 48 + std.debug.print("capturing signed commits from firehose...\n", .{}); 49 + 50 + // phase 1: capture raw firehose frames 51 + const raw_frames = try captureRawFrames(allocator); 52 + defer { 53 + for (raw_frames) |f| allocator.free(f); 54 + allocator.free(raw_frames); 55 + } 56 + std.debug.print("\ncaptured {d} raw frames\n", .{raw_frames.len}); 57 + 58 + // phase 2: extract signed commits from frames 59 + var commits: std.ArrayListUnmanaged(RawCommit) = .{}; 60 + defer { 61 + for (commits.items) |c| { 62 + allocator.free(c.did); 63 + allocator.free(c.signed_bytes); 64 + } 65 + commits.deinit(allocator); 66 + } 67 + 68 + for (raw_frames) |frame| { 69 + var arena = std.heap.ArenaAllocator.init(allocator); 70 + defer arena.deinit(); 71 + 72 + if (extractSignedCommit(arena.allocator(), frame)) |raw| { 73 + try commits.append(allocator, .{ 74 + .did = try allocator.dupe(u8, raw.did), 75 + .signed_bytes = try allocator.dupe(u8, raw.signed_bytes), 76 + }); 77 + } 78 + } 79 + std.debug.print("extracted {d} signed commits\n", .{commits.items.len}); 80 + 81 + // phase 3: resolve unique DIDs concurrently 82 + std.debug.print("resolving DIDs...\n", .{}); 83 + 84 + // collect unique DIDs 85 + var unique_set = std.StringHashMapUnmanaged(usize){}; 86 + defer unique_set.deinit(allocator); 87 + var unique_dids: std.ArrayListUnmanaged([]const u8) = .{}; 88 + defer unique_dids.deinit(allocator); 89 + 90 + for (commits.items) |commit| { 91 + const gop = try unique_set.getOrPut(allocator, commit.did); 92 + if (!gop.found_existing) { 93 + gop.value_ptr.* = unique_dids.items.len; 94 + try unique_dids.append(allocator, commit.did); 95 + } 96 + } 97 + 98 + const n_dids = unique_dids.items.len; 99 + const n_threads = @min(max_resolve_threads, n_dids); 100 + std.debug.print("{d} unique DIDs, {d} threads\n", .{ n_dids, n_threads }); 101 + 102 + // pre-allocate results (one per unique DID) 103 + const resolve_results = try allocator.alloc(?CachedKey, n_dids); 104 + defer { 105 + for (resolve_results) |r| { 106 + if (r) |key| allocator.free(key.raw); 107 + } 108 + allocator.free(resolve_results); 109 + } 110 + @memset(resolve_results, null); 111 + 112 + // spawn worker threads for concurrent DID resolution 113 + if (n_threads > 0) { 114 + var threads: [max_resolve_threads]std.Thread = undefined; 115 + for (0..n_threads) |t| { 116 + const start = t * n_dids / n_threads; 117 + const end = (t + 1) * n_dids / n_threads; 118 + threads[t] = try std.Thread.spawn(.{}, resolveWorker, .{ 119 + allocator, unique_dids.items, resolve_results, start, end, 120 + }); 121 + } 122 + for (0..n_threads) |t| { 123 + threads[t].join(); 124 + } 125 + } 126 + 127 + var resolved: usize = 0; 128 + var resolve_errors: usize = 0; 129 + for (resolve_results) |r| { 130 + if (r != null) resolved += 1 else resolve_errors += 1; 131 + } 132 + std.debug.print("resolved {d}/{d} DIDs ({d} errors)\n", .{ resolved, n_dids, resolve_errors }); 133 + 134 + // build corpus entries from commits + resolved keys 135 + var entries: std.ArrayListUnmanaged(CorpusEntry) = .{}; 136 + defer { 137 + for (entries.items) |e| { 138 + allocator.free(e.signed_bytes); 139 + allocator.free(e.pubkey_bytes); 140 + } 141 + entries.deinit(allocator); 142 + } 143 + 144 + for (commits.items) |commit| { 145 + const did_idx = unique_set.get(commit.did) orelse continue; 146 + const key = resolve_results[did_idx] orelse continue; 147 + try entries.append(allocator, .{ 148 + .curve_type = key.curve_type, 149 + .signed_bytes = try allocator.dupe(u8, commit.signed_bytes), 150 + .pubkey_bytes = try allocator.dupe(u8, key.raw), 151 + }); 152 + } 153 + std.debug.print("built {d} corpus entries\n", .{entries.items.len}); 154 + 155 + // phase 4: validate — verify each signature, drop failures 156 + var valid: std.ArrayListUnmanaged(CorpusEntry) = .{}; 157 + defer valid.deinit(allocator); 158 + var verify_failures: usize = 0; 159 + 160 + for (entries.items) |entry| { 161 + var arena = std.heap.ArenaAllocator.init(allocator); 162 + defer arena.deinit(); 163 + 164 + if (verifySigEntry(arena.allocator(), entry)) { 165 + try valid.append(allocator, entry); 166 + } else { 167 + verify_failures += 1; 168 + } 169 + } 170 + 171 + var p256_count: usize = 0; 172 + var k256_count: usize = 0; 173 + for (valid.items) |e| { 174 + if (e.curve_type == 0) p256_count += 1 else k256_count += 1; 175 + } 176 + 177 + std.debug.print("validation: {d} pass, {d} fail (P-256: {d}, secp256k1: {d})\n", .{ 178 + valid.items.len, verify_failures, p256_count, k256_count, 179 + }); 180 + 181 + if (valid.items.len == 0) { 182 + std.debug.print("no valid entries — cannot write corpus\n", .{}); 183 + return; 184 + } 185 + 186 + // phase 5: write corpus 187 + try writeCorpus(valid.items); 188 + } 189 + 190 + fn writeCorpus(entries: []const CorpusEntry) !void { 191 + const path = fixtures_dir ++ "/sig-verify-corpus.bin"; 192 + const file = try std.fs.cwd().createFile(path, .{}); 193 + defer file.close(); 194 + 195 + var count_buf: [4]u8 = undefined; 196 + std.mem.writeInt(u32, &count_buf, @intCast(entries.len), .big); 197 + try file.writeAll(&count_buf); 198 + 199 + var total_bytes: usize = 4; 200 + for (entries) |entry| { 201 + try file.writeAll(&.{entry.curve_type}); 202 + total_bytes += 1; 203 + 204 + var signed_len: [2]u8 = undefined; 205 + std.mem.writeInt(u16, &signed_len, @intCast(entry.signed_bytes.len), .big); 206 + try file.writeAll(&signed_len); 207 + try file.writeAll(entry.signed_bytes); 208 + total_bytes += 2 + entry.signed_bytes.len; 209 + 210 + var pubkey_len: [2]u8 = undefined; 211 + std.mem.writeInt(u16, &pubkey_len, @intCast(entry.pubkey_bytes.len), .big); 212 + try file.writeAll(&pubkey_len); 213 + try file.writeAll(entry.pubkey_bytes); 214 + total_bytes += 2 + entry.pubkey_bytes.len; 215 + } 216 + 217 + std.debug.print("wrote {d} entries ({d} bytes) to {s}\n", .{ 218 + entries.len, total_bytes, path, 219 + }); 220 + } 221 + 222 + // --- firehose capture (reused from capture.zig pattern) --- 223 + 224 + fn captureRawFrames(allocator: Allocator) ![]const []const u8 { 225 + std.debug.print("connecting to firehose...\n", .{}); 226 + 227 + const host = "bsky.network"; 228 + var client = try websocket.Client.init(allocator, .{ 229 + .host = host, 230 + .port = 443, 231 + .tls = true, 232 + .max_size = 5 * 1024 * 1024, 233 + }); 234 + defer client.deinit(); 235 + 236 + var host_buf: [256]u8 = undefined; 237 + const host_header = try std.fmt.bufPrint(&host_buf, "Host: {s}\r\n", .{host}); 238 + 239 + try client.handshake("/xrpc/com.atproto.sync.subscribeRepos", .{ 240 + .headers = host_header, 241 + }); 242 + 243 + std.debug.print("firehose connected, capturing for ~{d}s...\n", .{capture_duration_s}); 244 + 245 + var handler = FirehoseCaptureHandler{ 246 + .allocator = allocator, 247 + .deadline = @as(i128, std.time.nanoTimestamp()) + @as(i128, capture_duration_s) * ns_per_s, 248 + }; 249 + client.readLoop(&handler) catch |err| switch (err) { 250 + error.ConnectionClosed => {}, 251 + else => return err, 252 + }; 253 + 254 + const frames = try handler.frames.toOwnedSlice(allocator); 255 + std.debug.print("\rcaptured {d} frames ({d} bytes) \n", .{ frames.len, handler.total_bytes }); 256 + return frames; 257 + } 258 + 259 + const FirehoseCaptureHandler = struct { 260 + allocator: Allocator, 261 + deadline: i128, 262 + frames: std.ArrayListUnmanaged([]const u8) = .{}, 263 + total_bytes: usize = 0, 264 + 265 + pub fn serverMessage(self: *FirehoseCaptureHandler, data: []const u8) !void { 266 + if (std.time.nanoTimestamp() >= self.deadline) { 267 + return error.ConnectionClosed; 268 + } 269 + 270 + // minimal header peek: only capture commits with ops 271 + var arena = std.heap.ArenaAllocator.init(self.allocator); 272 + defer arena.deinit(); 273 + 274 + if (!isCommitWithOps(arena.allocator(), data)) return; 275 + 276 + const duped = try self.allocator.dupe(u8, data); 277 + try self.frames.append(self.allocator, duped); 278 + self.total_bytes += data.len; 279 + 280 + std.debug.print("\rcapturing... {d} frames ({d} bytes)", .{ self.frames.items.len, self.total_bytes }); 281 + } 282 + 283 + pub fn close(_: *FirehoseCaptureHandler) void {} 284 + }; 285 + 286 + fn isCommitWithOps(allocator: Allocator, data: []const u8) bool { 287 + const header_result = cbor.decode(allocator, data) catch return false; 288 + const header = header_result.value; 289 + 290 + const t = header.getString("t") orelse return false; 291 + if (!std.mem.eql(u8, t, "#commit")) return false; 292 + 293 + const payload_data = data[header_result.consumed..]; 294 + const payload = cbor.decodeAll(allocator, payload_data) catch return false; 295 + 296 + const ops = payload.getArray("ops") orelse return false; 297 + return ops.len > 0; 298 + } 299 + 300 + // --- commit extraction --- 301 + 302 + fn extractSignedCommit(allocator: Allocator, data: []const u8) ?RawCommit { 303 + const header_result = cbor.decode(allocator, data) catch return null; 304 + const header = header_result.value; 305 + 306 + const t = header.getString("t") orelse return null; 307 + if (!std.mem.eql(u8, t, "#commit")) return null; 308 + 309 + const payload_data = data[header_result.consumed..]; 310 + const payload = cbor.decodeAll(allocator, payload_data) catch return null; 311 + 312 + const did = payload.getString("repo") orelse return null; 313 + const blocks_bytes = payload.getBytes("blocks") orelse return null; 314 + 315 + const parsed_car = car.read(allocator, blocks_bytes) catch return null; 316 + 317 + // find commit block: has both "sig" and "did" fields 318 + for (parsed_car.blocks) |block| { 319 + const value = cbor.decodeAll(allocator, block.data) catch continue; 320 + if (value.getBytes("sig") != null and value.getString("did") != null) { 321 + return .{ 322 + .did = did, 323 + .signed_bytes = block.data, 324 + }; 325 + } 326 + } 327 + 328 + return null; 329 + } 330 + 331 + // --- concurrent DID resolution --- 332 + 333 + fn resolveWorker(allocator: Allocator, dids: []const []const u8, results: []?CachedKey, start: usize, end: usize) void { 334 + var resolver = zat.DidResolver.init(allocator); 335 + defer resolver.deinit(); 336 + 337 + for (start..end) |i| { 338 + results[i] = resolveDidKey(allocator, &resolver, dids[i]); 339 + } 340 + } 341 + 342 + fn resolveDidKey(allocator: Allocator, resolver: *zat.DidResolver, did_str: []const u8) ?CachedKey { 343 + var arena = std.heap.ArenaAllocator.init(allocator); 344 + defer arena.deinit(); 345 + 346 + const did_parsed = zat.Did.parse(did_str) orelse return null; 347 + var doc = resolver.resolve(did_parsed) catch return null; 348 + defer doc.deinit(); 349 + 350 + const signing_vm = doc.signingKey() orelse return null; 351 + const decoded_mb = zat.multibase.decode(arena.allocator(), signing_vm.public_key_multibase) catch return null; 352 + const parsed_key = zat.multicodec.parsePublicKey(decoded_mb) catch return null; 353 + 354 + const curve_type: u8 = switch (parsed_key.key_type) { 355 + .p256 => 0, 356 + .secp256k1 => 1, 357 + }; 358 + 359 + return .{ 360 + .curve_type = curve_type, 361 + .raw = allocator.dupe(u8, parsed_key.raw) catch return null, 362 + }; 363 + } 364 + 365 + // --- signature verification --- 366 + 367 + fn verifySigEntry(allocator: Allocator, entry: CorpusEntry) bool { 368 + // 1. decode signed commit 369 + const commit = cbor.decodeAll(allocator, entry.signed_bytes) catch return false; 370 + 371 + // 2. extract sig bytes 372 + const sig_bytes = commit.getBytes("sig") orelse return false; 373 + if (sig_bytes.len != 64) return false; 374 + 375 + // 3. strip sig, re-encode as unsigned CBOR 376 + const map_entries = switch (commit) { 377 + .map => |m| m, 378 + else => return false, 379 + }; 380 + 381 + var unsigned_entries: std.ArrayListUnmanaged(cbor.Value.MapEntry) = .{}; 382 + defer unsigned_entries.deinit(allocator); 383 + for (map_entries) |map_entry| { 384 + if (!std.mem.eql(u8, map_entry.key, "sig")) { 385 + unsigned_entries.append(allocator, map_entry) catch return false; 386 + } 387 + } 388 + 389 + const unsigned_value: cbor.Value = .{ .map = unsigned_entries.items }; 390 + const unsigned_bytes = cbor.encodeAlloc(allocator, unsigned_value) catch return false; 391 + defer allocator.free(unsigned_bytes); 392 + 393 + // 4+5. verify signature (SHA-256 + ECDSA happens inside stdlib's verify) 394 + if (entry.curve_type == 0) { 395 + return verifyP256(unsigned_bytes, sig_bytes, entry.pubkey_bytes); 396 + } else { 397 + return verifySecp256k1(unsigned_bytes, sig_bytes, entry.pubkey_bytes); 398 + } 399 + } 400 + 401 + fn verifyP256(message: []const u8, sig_bytes: []const u8, pubkey_bytes: []const u8) bool { 402 + const Scheme = std.crypto.sign.ecdsa.EcdsaP256Sha256; 403 + const sig = Scheme.Signature.fromBytes(sig_bytes[0..64].*); 404 + if (isHighS(p256_half_order, sig.s)) return false; 405 + const pk = Scheme.PublicKey.fromSec1(pubkey_bytes) catch return false; 406 + sig.verify(message, pk) catch return false; 407 + return true; 408 + } 409 + 410 + fn verifySecp256k1(message: []const u8, sig_bytes: []const u8, pubkey_bytes: []const u8) bool { 411 + const Scheme = std.crypto.sign.ecdsa.EcdsaSecp256k1Sha256; 412 + const sig = Scheme.Signature.fromBytes(sig_bytes[0..64].*); 413 + if (isHighS(secp256k1_half_order, sig.s)) return false; 414 + const pk = Scheme.PublicKey.fromSec1(pubkey_bytes) catch return false; 415 + sig.verify(message, pk) catch return false; 416 + return true; 417 + } 418 + 419 + fn isHighS(half_order: [32]u8, s: [32]u8) bool { 420 + for (0..32) |i| { 421 + if (s[i] < half_order[i]) return false; 422 + if (s[i] > half_order[i]) return true; 423 + } 424 + return false; // equal is ok 425 + } 426 + 427 + const p256_half_order = [32]u8{ 428 + 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 429 + 0xa0, 0x75, 0x9b, 0xc5, 0xaa, 0x00, 0xe3, 0xb2, 430 + 0xde, 0x73, 0x7d, 0x56, 0xd3, 0x8b, 0xcf, 0x42, 431 + 0x79, 0xdc, 0xe5, 0x61, 0x7e, 0x31, 0x92, 0xa8, 432 + }; 433 + 434 + const secp256k1_half_order = [32]u8{ 435 + 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 436 + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 437 + 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 438 + 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, 439 + };