-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Bug: Unvalidated Venue Emission Can Fail Silently
Description
The engine emits order work to venues based on bot-venue assignments without validating that those venues are actually registered in the emitter. If a venue assignment exists in the database but the emitter wasn't initialized (e.g., due to configuration error), emission will fail silently with only a log warning.
Location
engine/engine.go:350-360
Current Behavior
for _, ident := range emission.targets {
// ... prepare work ...
if err := e.emitter.Emit(ctx, work); err != nil {
e.logger.Warn("could not submit order", ...) // Just logs warning
}
}The resolveOrderTargets() function returns identifiers based on database assignments, but there's no guarantee those venues are registered in the QueueEmitter.
Expected Behavior
The system should either:
- Validate venue registrations before emission and fail loudly if a venue is missing
- Pre-validate all venue assignments during engine initialization
- Return errors from
Emit()calls and propagate them up the stack
Impact
- Orders may silently fail to be submitted to configured venues
- Operators won't know orders are being dropped until they check logs
- Could lead to unexpected position imbalances across venues
Reproduction Steps
- Add a bot-venue assignment to the database for
venue-X - Start the runtime without configuring
venue-Xin secrets - Process a deal - engine will attempt to emit to
venue-X - Emission fails but only logs a warning
Suggested Fix
Option 1: Pre-validate during engine initialization
func (e *Engine) ValidateVenueAssignments(ctx context.Context) error {
// Load all unique venue IDs from bot_venue_assignments
// Check each one is registered in e.emitter
// Return error if any are missing
}Option 2: Make emission errors fatal
if err := e.emitter.Emit(ctx, work); err != nil {
return fmt.Errorf("could not submit order to venue %s: %w", ident.Venue(), err)
}Branch
codex/investigate-multi-wallet-support-for-hyperliquid
Related
- Spec:
specs/multi_venue_emission.adoc - Related to venue registry implementation in
emitter/emitter.go
Metadata
Metadata
Assignees
Labels
No labels