Documentation
¶
Overview ¶
Package scan ports Scanner of contracts/solana/reporter/scan.ts. A pass lists the open transfers and one audit page, reviews them in concurrent chunks, each decided from one Akash height and one finalized Solana snapshot, writes the review events and hands the planned messages to a Queuer (spec §5.2). It also runs the broadcaster's follow-up reviews (spec §6.6).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPassAborted = errors.New("follow-up review skipped: the pass ended on a light-client pin mismatch")
ErrPassAborted is what Review and ReviewRefundHead return, without writing an alert or counting anything, once a pass has found a light-client pin mismatch: at once until the next pass begins, and before the next review or {id, error} event of a follow-up already running, which never resumes. The pass's own alert and error stay its last output (spec §5.6).
Functions ¶
Types ¶
type Options ¶
type Options struct {
Reporter string
// Broadcast marks review events "broadcast" instead of "preview".
Broadcast bool
Workers int
PageSize int
AuditPerScan int
// Clock times the follow-up reviews' height retries; nil means the system clock.
Clock clock.Clock
// RetryInterval is how long a follow-up review waits before asking again for a high enough snapshot; zero means
// one second, the tracker's refresh rate.
RetryInterval time.Duration
Metrics *metrics.Metrics
}
Options configures a Scanner.
type Queuer ¶
Queuer takes the messages a review planned. Queue reports whether the message was taken; false means it was skipped or deferred.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner runs passes and follow-up reviews. Pass must not run concurrently with itself; Review and ReviewRefundHead may run alongside a pass.
func (*Scanner) OnChange ¶
OnChange writes the light-client-changed alert. The observer calls it under its follow lock, before any review decided under the new client; it must not call back into the observer.
func (*Scanner) Pass ¶
Pass runs one pass and returns its failures. ctx bounds the reviews: once it ends, no new chunk or transfer review starts. Once the reviews end, settle, when set, runs once and its failures count; then the summary is written if the pass reached its reviews, or else the pass error.
func (*Scanner) Review ¶
Review reviews ids in chunks of up to 96, each from a snapshot at least minHeight high, writing the normal review events and queuing what it plans. IDs that are no longer open are skipped. After a pass that ended on a pin mismatch, it returns ErrPassAborted.
func (*Scanner) ReviewRefundHead ¶
ReviewRefundHead reviews the refund head of a snapshot at least minHeight high as a one-transfer chunk. A snapshot without a refund head reviews nothing. After a pass that ended on a pin mismatch, it returns ErrPassAborted.