Conversation
The call-time IngestTx closure would fire general indexing on overlay submissions, a path master's init ordering left dormant. Defer wiring this feedback loop to Milestone 3 (microservice-split.md decision 9) so this milestone stays behavior-preserving.
…tion error semantics
Adds an HTTP tier to the spends resolution chain that queries a remote index service's txo spend endpoints (GET /:outpoint/spend, POST /spends). Read-only: PutSpend/DeleteSpend are no-ops. Configurable via the spends chain with provider "http" and http.url, so a chain like [lru, http, junglebus] is expressible without in-process co-location with the index.
bsv21 no longer imports pkg/indexer or pkg/owner. NewTokenManager and NewSyncServices take an OwnerSyncer and a new BalanceLookup func; the embedded owner.NewOwnerSync + outputStore.SearchBalance construction moves into pkg/node wiring. A new HTTPOwnerClient (pkg/bsv21/ownerclient.go) hits the index owner routes (GET /sync, GET /:owner/balance) for remote mode. Config bsv21.owner.mode (embedded|remote, default embedded) + bsv21.owner.url. Embedded requires the index service in-process; node returns a clear startup error otherwise. bsv21 routes and token metadata now tolerate a nil txo store, so a standalone mode:bsv21 process can serve its API with remote owner.
Spends and bsv21 owner/balance can now resolve against a remote index
service, so neither requires in-process co-location with the index.
GATE results:
- go test ./... green; go vet clean.
- mode:all capabilities parity vs baseline: empty diff (identical set
["admin","beef","chaintracks","ordfs","pubsub","sweep","txo"]).
- grep -rn "pkg/indexer|pkg/owner" pkg/bsv21/ : empty.
Two-process bsv21-remote smoke (mode:index on :18081, mode:bsv21 on :18082
with bsv21.owner.mode=remote -> :18081/1sat/owner):
- index A capabilities: ["admin","chaintracks","owner","pubsub","sweep","txo"]
- bsv21 B booted standalone, log: "bsv21 owner resolution: remote"
url=http://localhost:18081/1sat/owner
- bsv21 B capabilities: ["admin","bsv21","chaintracks","overlay","pubsub","sweep"]
(no txo/owner — isolated)
- B /1sat/txo/../spend and /1sat/owner/../balance -> 404 (routes absent)
- A /1sat/owner/1BitcoinEater.../balance -> {"balance":0,"count":0}
(exact shape B's HTTPOwnerClient fetches/decodes; encodings covered by
ownerclient_test against route-faithful mimics)
Note: a fresh standalone bsv21 process holds no ingested token, so the
manager makes no balance call on boot and GET /1sat/bsv21/<token> is 404;
displaying a non-zero credit end-to-end needs chain-synced token data,
beyond a boot smoke. The credits-over-HTTP fetch/decode path is proven by
ownerclient_test + the live index balance endpoint above.
Add a gateway service (pkg/gateway) that fronts a multi-process deployment
with today's public /1sat/* surface via fiber's proxy middleware. The
path->service map mirrors the prefixes node.RegisterRoutes mounts. GET
/1sat/capabilities fans out to each configured backend's capabilities
endpoint (5s per-backend timeout), unions/sorts/dedupes, and omits
unreachable backends.
Wire into pkg/node: gateway.Config (backends map), runsService("gateway")
mounts the proxy instead of local service routes and short-circuits the
service substrate; combining gateway with other modes in one process is a
startup error. mode:all never runs the gateway, so its capability surface
is unchanged (parity verified against baseline).
Admin becomes the control-plane frontend (setup wizard, config CRUD, auth
admin, log viewer, restart). Cross-service admin handlers move to the
services that own their data, mounted by pkg/node at the same public
/admin/api/* paths the UI already calls, so mode:all is unchanged.
Moves:
- store data browser (admin/data_routes.go) -> pkg/txo/admin_routes.go
- bsv21 whitelist/blacklist + token workers -> pkg/bsv21/admin_routes.go
- opns genesis crawl trigger -> pkg/opns/admin_routes.go
- active topics/lookups + topic remotes -> pkg/overlay/admin_routes.go
admin.InitializeDeps drops Overlay, Engines, Store, BSV21Sync, and
TriggerOpnsCrawl; it now holds only ConfigStore, RequestRestart, LogStore.
The crawl trigger moves to node's opns wiring (svc.OpnsCrawlTrigger). The
per-service groups mount whenever the admin control-plane runs, with
nil-safe deps, so endpoints degrade exactly as the old unconditional admin
surface did (empty lists, 503, or 500) when a service is not in-process.
Admin API paths the UI calls (admin/ui/src/api.ts + sections), all verified
working in mode:all:
kept in admin/: /admin/setup/{status,,request,check,complete,config},
/admin/api/{config,progress,progress/:id,users,users/:pubkey,
requests,requests/:pubkey/approve,requests/:pubkey,restart,logs,
logs/components}
moved (same paths): /admin/api/{whitelist,whitelist/:token,blacklist,
blacklist/:token,bsv21/workers,topics/active,lookups/active,
topics/:name/remotes,opns/crawl}, and the data browser under
/admin/api/data/*
Note: ZSetLookup calls /admin/api/zset/:val, which matches no route today
(data browser is /admin/api/data/zset/...) — a pre-existing UI mismatch,
unchanged here.
Deviation from the 4-field brief: also dropped the Overlay handle from
admin (moved topic-remotes to pkg/overlay) so admin holds zero
cross-service handles per requirement R10.
M1-M5 implemented and gate-verified on branch. mode:all parity holds (capabilities diff empty); three-process index/opns/gateway smoke passes; admin UI endpoints verified at unchanged paths. STATUS.md and the plan's requirements checklist (R1-R10) updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restructures 1sat-stack from a single monolithic server into one binary that runs any subset of its services, selected by a
modeconfig field.mode: all(the default) is the existing monolith and is verified behaviorally equivalent to master at every milestone.Milestones
cmd/serverinto an importablepkg/node;cmd/serveris now a thin caller. Addsmodeselection:all, or a comma list likeindex,opns.mode: allruns whatever is enabled (existing flags unchanged); an explicit list implies enablement.q:*sorted-set queues move behind aqueue.Queueinterface (same keys, no data migration). A queue can point at a store backend independent of the service's data store.mode: allmatches master). The pending auditor gains a rollback-event publish (see intentional/deferred below).spendsgains an HTTP tier against the index/txospend routes;bsv21drops itspkg/indexerandpkg/ownerimports and takes injected owner-sync/balance interfaces, with an HTTP mode so a standalonebsv21process can resolve fee balances from a remote index.gatewayproxy mode fronts a multi-process deployment on the existing/1sat/*surface with a merged/1sat/capabilities. Admin's cross-service routes move to the services that own them (adminkeeps no cross-service handles). Auth guards and public paths are unchanged.Verification
go test ./...green; gofmt/vet clean.mode: all/1sat/capabilitiesdiff vs a master baseline is empty at every milestone.index+opnsprocesses) routes by prefix and merges capabilities; standalonebsv21resolves balances from a remoteindexover HTTP.Intentional / deferred (not defects)
pending_auditor.go. Enabling automatic rollback of stale unconfirmed txs is a separate decision, not part of this change./chaintracks(substrate, not a mode) and/sweep(a UI) is topology-dependent and belongs to the configurator; the current route table covers the clean service modes.Per-milestone detail and the decisions behind the split are in
docs/plans/microservice-split.md,microservice-split-implementation.md, and the execution logmicroservice-split-progress.md.