Documentation
¶
Overview ¶
Package testperplatencyv1 is the Go-side orchestrator for the testperplatencyv1 bot mode -- a real-transaction latency test, not a real trading strategy. Otherwise a direct copy of package testperpv1's orchestration (itself a copy of perpfundingv1's): same allocation/upload/handshake/wallet-init flow, only MODE=testperplatencyv1 selected at upload time instead.
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=testperplatencyv1 and TEST_PROTOCOL set to whichever single protocol this run should exercise (see init.go) -- unlike testperpv1, this mode runs a CYCLE_TARGET-times repeated deposit<->withdraw loop per protocol, so TEST_PROTOCOL scopes a real run's spend to just one protocol instead of all three plus every borrow/repay leg in one go.
- Completing the handshake with the running bot instance.
- Sending a child keypair to the bot via stdin -- like testperpv1 (unlike perpfundingv1), this mode's Rust side (catscope-rust-bot/src/brain/testperplatencyv1) does use it, to sign the real deposit/withdraw transactions its evaluate() state machine builds.
The WASM bot (catscope-rust-bot/src/brain/testperplatencyv1) runs the real bootstrap -> (deposit<->withdraw x100) cycle for whichever protocol TEST_PROTOCOL selects, recording write->low-latency-read latency and reporting p50/p99 once the cycle count target is hit -- see that module's doc comment for what it proves and why the cycling exists.
Index ¶
Constants ¶
Variables ¶
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 DoTargetAllocation ¶
DoTargetAllocation builds the wire message for a target portfolio allocation update for symbol (fraction of total portfolio value, 0.0-1.0). symbol must fit in 16 bytes (matches every currently tracked symbol: SOL/BTC/ETH/XRP/BNB/SUI).
func DoWallet ¶
func DoWallet(key sgo.PrivateKey) catmsg.FixedPair
Types ¶
type Configuration ¶
type Configuration struct {
BotImage string
// TargetProtocol selects which single protocol's deposit<->withdraw
// cycle the Rust side should run ("solend"/"kamino"/"marginfi"),
// passed through as the TEST_PROTOCOL env var -- see init.go. Empty
// runs the original full 16-phase sequence (all three protocols plus
// every borrow/repay leg), matching testperpv1's unscoped behavior --
// almost never what you want for a real run, since it multiplies the
// real transaction fees spent by however many protocols/phases are
// included.
TargetProtocol string
}
type Hook ¶
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 -- see that type's doc comment. Needed for the native transfer loop's real Astralane bundled-send path (catscope-rust-bot's send_native_transfer_via_astralane) to ever see live tip data at all; without this, cmd/testperplatency.go has no SendBundlerTipUpdate method to wire startBundlerTipBroadcaster up to, and Wallet::select_tip_account never returns Some.
func Create ¶
func Create(ctx context.Context, cancel context.CancelCauseFunc, parentKey sgo.PrivateKey, config *Configuration, db *sql.DB) (Hook, error)
Create creates a testperplatencyv1 gRPC event hook. db is the already-open prefetch.db connection (see store.DB.Raw()), used to persist target allocation updates sent via SendTargetAllocation.
Source Files
¶
- eval.go
- init.go
- instance.go
- message.go
- testperplatencyv1.go