Documentation
¶
Overview ¶
Package arbv1 is the Go-side orchestrator for the arbv1 (arbitrage v1) bot mode.
It implements the brain.Brain interface and is responsible for:
- Allocating a slot on a Catscope/Solpipe validator pipeline (bid = 0, free tier).
- Uploading a WASM bot image to the validator with MODE=arbv1.
- Completing the handshake with the running bot instance.
- Sending the child trading keypair and address-lookup-table (ALT) data to the bot via stdin so the bot can build and sign arbitrage transactions.
- Reading LatencyReportV1 structs from the bot's stdout and writing them to a latency log file for performance monitoring.
The WASM bot (catscope-rust-bot/src/brain/arbv1) does the actual DEX price graph construction and Bellman-Ford arbitrage detection. This Go brain's job is to keep the bot alive, funded, and supplied with configuration data.
Index ¶
Constants ¶
const ( BudgetChildSOL graph.Lamports = sgo.LAMPORTS_PER_SOL >> 5 BudgetChildTxFeeSOL graph.Lamports = sgo.LAMPORTS_PER_SOL >> 6 )
const ( KeyFlagEchoRequest uint8 = 1 KeyFlagEchoResponse uint8 = 2 KeyFlagWallet uint8 = 3 KeyFlagTxLatency uint8 = 4 KeyFlagLatencyReportV1 uint8 = 5 KeyFlagAddressLookupTable uint8 = 6 // KeyFlagCommonAccountUsage is shared across every brain/* package // (not just this one) -- see the doc comment above. KeyFlagCommonAccountUsage uint8 = 200 )
Variables ¶
var ( MintUSDC = sgo.MustPublicKeyFromBase58("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v") MintSOL = sgo.WrappedSol )
ErrBotNotConnectedYet is returned by SendBundlerTipUpdate while the bot hasn't finished its handshake yet -- mirrors testperpv1's own sentinel of the same name. Not an error condition RunTipBroadcaster treats specially; it just logs and retries on its next tick.
Functions ¶
func DoAddressLookupTable ¶
DoAddressLookupTable sends an ALT to the bot. value layout: key(32) | n_accounts(u16 LE) | accounts(n×32)
func DoWallet ¶
func DoWallet(key sgo.PrivateKey) catmsg.FixedPair
Types ¶
type Hook ¶ added in v0.4.16
Hook is brain.Brain plus SendBundlerTipUpdate -- returned instead of a bare brain.Brain so cmd/*.go can call SendBundlerTipUpdate on the same instance it hands to mothership.Create (a Hook value is itself a valid brain.Brain, since this interface embeds it). Mirrors testperpv1.Hook's own reasoning for its trigger-sender methods.
func Create ¶
func Create(ctx context.Context, cancel context.CancelCauseFunc, parentKey sgo.PrivateKey, config *Configuration, db *sql.DB) (Hook, error)
Create creates a helloworld gRPC event hook.
type LatencyReportV1 ¶
type LatencyReportV1 struct {
ProcessedDiff time.Duration `json:"processed_diff"`
RootDiff time.Duration `json:"commit_diff"`
AccountProcessed uint64 `json:"account_processed"`
AccountRoot uint64 `json:"account_root"`
TxProcessedFilter uint64 `json:"tx_processed_filter"`
TxProcessed uint64 `json:"tx_processed"`
TxN uint64 `json:"tx_n"`
TxP50Us uint64 `json:"tx_p50_us"`
TxP99Us uint64 `json:"tx_p99_us"`
}
func (*LatencyReportV1) Parse ¶
func (r *LatencyReportV1) Parse(value []byte) (int, error)
func (*LatencyReportV1) String ¶
func (r *LatencyReportV1) String() string
Source Files
¶
- arbv1.go
- eval.go
- init.go
- instance.go
- message.go
- state.go