Documentation
¶
Overview ¶
Package pipeline is one BRC-22 submission through the host: parse, SPV with overlay-bridge pkg/spv, the fee floor, then the engine's admission (topic managers, the BEEF blob, the index rows), each stage timed for R1 and each object's work counted for R2.
Verification runs here, before the engine, on the raw bytes, and the engine is told so through the context: its Verifier (Engine.Verifier, in go-overlay-services from v1.3.10) accepts a transaction this pipeline already verified and verifies anything else itself, with the same verifier. There is one Go verifier in the stack and it runs once per object.
An object the bridge on this machine already verified (its SPV marker accepted by the HTTP layer, internal/bridgetrust) comes in through SubmitBridgeVerified: the same verification minus the scripts. Everything else, GASP catch-up and ordered replay included, comes in through Submit and is verified in full.
Index ¶
- type Error
- type Kind
- type Pipeline
- func (p *Pipeline) EngineVerifier(ctx context.Context, tx *transaction.Transaction, txid *chainhash.Hash) error
- func (p *Pipeline) Hold() (release func())
- func (p *Pipeline) Retire()
- func (p *Pipeline) Submit(ctx context.Context, raw []byte, topics []string) (overlay.Steak, error)
- func (p *Pipeline) SubmitBridgeVerified(ctx context.Context, raw []byte, topics []string) (overlay.Steak, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind string
Kind classifies a failed submission; the HTTP layer maps it to a status.
const ( KindMalformed Kind = metrics.ResultMalformed KindRefused Kind = metrics.ResultRefused KindPending Kind = metrics.ResultPending KindError Kind = metrics.ResultError )
Kinds, matching the overlay_go_submits_total result labels.
type Pipeline ¶
type Pipeline struct {
Engine *engine.Engine
Tracker chaintracker.ChainTracker
// Network and Finality configure pkg/spv (ruling R-g: finality ignore).
Network spv.Network
Finality spv.FinalityPolicy
// VerifyTimeout bounds one verification; zero is pkg/spv's 5 s.
VerifyTimeout time.Duration
// MinFeeSatPerKB refuses a subject paying less; 0 measures the fee stage
// and refuses nothing (the TypeScript engine checks no fee).
MinFeeSatPerKB uint64
// CommitTimeout bounds the engine's part of a submission. The engine runs
// on a context detached from the client's, so a client that hangs up
// cannot abandon the store writes halfway.
CommitTimeout time.Duration
Metrics *metrics.Metrics
Log *slog.Logger
// Modules names the module that mounts each carried topic: the module
// label of a submission's stage and admission timings. A topic missing
// here reads as metrics.ModuleNone.
Modules map[string]string
// Prechecks are the topics' managers that decide before the topic's
// lock (pkg/module Prechecker).
Prechecks map[string]module.Prechecker
// contains filtered or unexported fields
}
Pipeline submits objects into one engine.
func (*Pipeline) EngineVerifier ¶
func (p *Pipeline) EngineVerifier(ctx context.Context, tx *transaction.Transaction, txid *chainhash.Hash) error
EngineVerifier is the engine's Verifier. It accepts a subject this pipeline verified (the same parsed BEEF travels in the context) and verifies anything else in full with pkg/spv, so a submission that reaches the engine some other way (GASP, a future in-process caller) is never admitted unverified.
func (*Pipeline) Hold ¶ added in v0.12.0
func (p *Pipeline) Hold() (release func())
Hold stops admissions at the engine's door and returns once every admission inside has left it, with the release: what a checkpoint holds while it copies the index and the modules' state directories, so the copy never splits an admission. Parsing and verification go on; an object that reaches the door waits there (the lock stage). Release once.
func (*Pipeline) Retire ¶ added in v0.19.0
func (p *Pipeline) Retire()
Retire marks the pipeline replaced by a reload, under its hold: an admission that waited at the door then answers unavailable, so its sender sends it again to the host that replaced this one. Call it before the hold's release.
func (*Pipeline) Submit ¶
Submit runs one object through the host, verified in full. topics must already be validated against the carried set.
func (*Pipeline) SubmitBridgeVerified ¶ added in v0.10.0
func (p *Pipeline) SubmitBridgeVerified(ctx context.Context, raw []byte, topics []string) (overlay.Steak, error)
SubmitBridgeVerified is Submit for an object whose overlay-bridge SPV marker the HTTP layer accepted (internal/bridgetrust: trust on, loopback, the HMAC over these bytes checks). SPV runs every check but the scripts: the bridge ran pkg/spv, this host's verifier, over the same bytes. Nothing but POST /submit calls it.