helloworldv1

package
v0.4.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package helloworldv1 is the Go-side orchestrator for the helloworldv1 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=helloworldv1.
  • Completing the handshake with the running bot instance.
  • Sending the child trading keypair to the bot via stdin so the bot can sign transactions independently.
  • Reading LatencyReportV1 structs from the bot's stdout and writing them to a CSV-style latency log file for offline analysis.

This brain performs no live trading; the wallet-funding logic in Evaluate is disabled (if false). Its primary purpose is to verify the full Go↔WASM communication pipeline and measure validator-side latency.

Index

Constants

View Source
const (
	BudgetChildSOL      graph.Lamports = sgo.LAMPORTS_PER_SOL >> 5
	BudgetChildTxFeeSOL graph.Lamports = sgo.LAMPORTS_PER_SOL >> 6
)
View Source
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

View Source
var (
	MintUSDC = sgo.MustPublicKeyFromBase58("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
	MintSOL  = sgo.WrappedSol
)
View Source
var ErrBotNotConnectedYet = errors.New("helloworldv1: bot not connected yet")

ErrBotNotConnectedYet is returned by SendBundlerTipUpdate while the bot hasn't finished its handshake yet -- mirrors leveragedloopv1'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 added in v0.4.14

func DoAddressLookupTable(key sgo.PublicKey, accounts []sgo.PublicKey) catmsg.FixedPair

DoAddressLookupTable sends an ALT to the bot. value layout: key(32) | n_accounts(u16 LE) | accounts(n×32)

func DoEchoRequest

func DoEchoRequest(payload string) catmsg.FixedPair

func DoWallet

func DoWallet(key sgo.PrivateKey) catmsg.FixedPair

Types

type Configuration

type Configuration struct {
	BotImage        string
	LatencyFilePath string
}

type Hook added in v0.4.16

type Hook interface {
	brain.Brain
	SendBundlerTipUpdate(update bundler.TipUpdate) error
}

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 leveragedloopv1.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 added in v0.4.12

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 added in v0.4.12

func (r *LatencyReportV1) Parse(value []byte) (int, error)

func (*LatencyReportV1) String added in v0.4.12

func (r *LatencyReportV1) String() string

type TxLatency added in v0.4.12

type TxLatency struct {
	N     uint64
	P50Us uint64
	P99Us uint64
}

func (*TxLatency) Parse added in v0.4.12

func (l *TxLatency) Parse(value []byte) (int, error)

Source Files

  • eval.go
  • helloworldv1.go
  • instance.go
  • message.go
  • state.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL