Skip to content

Add tools wkp descriptors command and update WKP generator with source_code_info support#148

Merged
maoueh merged 4 commits into
developfrom
feature/tools-wkp-descriptors
Jun 18, 2026
Merged

Add tools wkp descriptors command and update WKP generator with source_code_info support#148
maoueh merged 4 commits into
developfrom
feature/tools-wkp-descriptors

Conversation

@maoueh

@maoueh maoueh commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds firecore tools wkp descriptors [output-file] — exports all well-known blockchain protobuf descriptors as a self-contained binary google.protobuf.FileDescriptorSet. Output is deterministic (stable topological + alphabetical ordering) for CI regenerate-and-diff workflows. Supports - for stdout; default filename is well-known-descriptors.binpb. 22 files, ~109 KB, covers 12 chain block types (Ethereum, Solana, Near, Bitcoin, Cosmos, Antelope, Beacon, Starknet, Stellar, Tron, Arweave, ACME) plus Google well-known types.
  • Updates proto/generator to use the BSR Connect API (buf.registry.module.v1.FileDescriptorSetService/GetFileDescriptorSet) instead of the Reflect v1beta1 API. A single call now returns the resolved commit ID (restored in documentation URL comments in generated files) and the FileDescriptorSet with source_code_info included (includeSourceCodeInfo: true), restoring proto field/message comments that were previously stripped by the reflection protocol.
  • BUFBUILD_AUTH_TOKEN is now optional for public modules. Generator logging switched to the StreamingFast zlog library; all error handling uses cli.NoError/cli.Ensure. Deduplication across modules uses a name-keyed map and warns on content mismatch (version skew).

Test plan

  • go test ./cmd/tools/wkp/... — 9 tests covering export round-trip, determinism, self-contained registry validation, Ethereum block type resolution, no-duplicate-files, topological order, block type name list, write-to-file, and source_code_info status
  • go build ./... — clean build
  • firecore tools wkp descriptors /tmp/out.binpb — runs end-to-end and logs file count + byte size
  • Regenerate WKP files with updated generator and confirm generated .go files now contain exact commit hashes in documentation URL comments and the embedded descriptors carry source_code_info

@sduchesneau

sduchesneau commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Vulnerabilities of ghcr.io/streamingfast/firehose-core:a040e0e-amd64

📦 Image Reference ghcr.io/streamingfast/firehose-core:a040e0e-amd64
digestsha256:0d7fd5d6c2baee88d240986abef6308f7265150bc71b1121e3ba5a9669b99dfc
vulnerabilitiescritical: 0 high: 0 medium: 0 low: 0
platformlinux/amd64
size161 MB
packages505
📦 Base Image ubuntu:24.04
also known as
  • c136481b8f4cd58cb213a22ee358ea1047bc963a338c61cdccb518e233409f86
  • noble
  • noble-20260509.1
digestsha256:023f8a753c22258c9fe2d0005a7d28258038da7d620e9f93e9ad78aa266f9f11
vulnerabilitiescritical: 0 high: 1 medium: 25 low: 11

@maoueh maoueh force-pushed the feature/tools-wkp-descriptors branch from 4e90e77 to d500805 Compare June 8, 2026 20:14
@maoueh maoueh changed the base branch from master to develop June 8, 2026 20:15
@maoueh maoueh requested a review from UlysseCorbeil June 18, 2026 02:19
maoueh added 2 commits June 17, 2026 22:20
New command `firecore tools wkp descriptors [output-file]` exports all
well-known blockchain protobuf descriptors as a self-contained, binary
google.protobuf.FileDescriptorSet. The set includes every transitive
import so consumers can build a descriptor registry with no external
resolution. Output is deterministic (stable topological + alphabetical
ordering) for CI "is it up to date?" regenerate-and-diff workflows.

The WKP generator is updated to use the BSR Connect API
(buf.registry.module.v1.FileDescriptorSetService/GetFileDescriptorSet)
instead of the Reflect v1beta1 API. A single call now returns both the
resolved commit ID (used in the documentation URL comment in each
generated file) and the FileDescriptorSet with source_code_info
included via includeSourceCodeInfo:true, restoring proto field/message
comments that were previously stripped by the reflection protocol.

BUFBUILD_AUTH_TOKEN is now optional (public modules are freely
accessible; a warning is emitted when absent). Deduplication across
modules uses a name-keyed map and warns when the same file path appears
with different content (BSR module version skew). Logging switched from
the standard library to the StreamingFast logging library (zlog) and
all error handling uses cli.NoError/cli.Ensure throughout.
Upgrades testcontainers-go from v0.40.0 to v0.42.0, which dropped
github.com/docker/docker in favour of the split github.com/moby/moby/api
and github.com/moby/moby/client modules. Updates the single direct import
in relayer/relayer_e2e_test.go from docker/docker to moby/moby/api.

Removes GHSA-x744-4wpc-v9h2, GHSA-x86f-5xw2-fm2r, and GHSA-rg2x-37c3-w2rh
flagged by the dependency-review CI check.
@maoueh maoueh force-pushed the feature/tools-wkp-descriptors branch from d500805 to e70e677 Compare June 18, 2026 02:20
Comment thread cmd/tools/wkp/tools_wkp_descriptors.go Outdated
req.Header.Set("Authorization", "Bearer "+authToken)
}

resp, err := http.DefaultClient.Do(req)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a timeout in case the BSR hangs ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A context now sets a 60s timeout for the whole operation.

- Remove unexported blockTypeNames() helper and its test — not needed
  by the command itself, was test-only utility with no clear owner
- Add 60s context timeout to BSR HTTP request in fetchFileDescriptorSet
  to prevent generator hanging indefinitely on slow/unresponsive BSR
testcontainers-go v0.42 uses moby/moby/api types which redesigned
Port (now a struct) and PortBinding (HostIP is netip.Addr). Update
HostConfig.PortBindings to use network.PortMap/PortBinding and cast
nat.Port to string for wait.ForListeningPort.
@maoueh maoueh merged commit 799729b into develop Jun 18, 2026
8 checks passed
@maoueh maoueh deleted the feature/tools-wkp-descriptors branch June 18, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants