Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Default Hyperliquid venue ID may never be created #108

@terwey

Description

@terwey

recomma/storage/storage.go

Lines 179 to 191 in ed1cb9c

// Check if a venue with this (type, wallet) already exists (possibly with a different ID)
existingVenue, err := s.queries.GetVenueByTypeAndWallet(ctx, sqlcgen.GetVenueByTypeAndWalletParams{
Type: defaultHyperliquidVenueType,
Wallet: wallet,
})
if err == nil {
// A venue with this (type, wallet) already exists.
// If it has a different ID than the default, we should use it instead of trying to create a duplicate.
if existingVenue.ID != string(defaultHyperliquidVenueID) {
// There's already a user-defined venue with this type and wallet.
// No need to create a separate default venue - just return success.
return nil
}

When an existing venue with the same (type, wallet) is found, the new logic returns early without inserting or updating the default row (hyperliquid:default). Downstream code (e.g. EnsureDefaultVenueWallet, order identifier construction, and default venue lookups) expects this well-known ID to exist. If an operator already has a venue for the primary wallet under a different ID, startup will skip the upsert and later lookups by hyperliquid:default will fail with sql.ErrNoRows. Instead of returning immediately, the routine should reconcile the existing venue into the default ID or update it in place so the canonical identifier always exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions