mirror of
https://github.com/luxfi/indexer.git
synced 2026-09-24 00:25:37 +00:00
style: run gofmt on all files
This commit is contained in:
+26
-26
@@ -51,40 +51,40 @@ type ComputeAttestation struct {
|
||||
|
||||
// ModelRegistration represents a registered AI model
|
||||
type ModelRegistration struct {
|
||||
ID string `json:"id"`
|
||||
ModelHash string `json:"modelHash"`
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
Owner string `json:"owner"`
|
||||
Framework string `json:"framework,omitempty"`
|
||||
Parameters uint64 `json:"parameters,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Metadata json.RawMessage `json:"metadata,omitempty"`
|
||||
ID string `json:"id"`
|
||||
ModelHash string `json:"modelHash"`
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
Owner string `json:"owner"`
|
||||
Framework string `json:"framework,omitempty"`
|
||||
Parameters uint64 `json:"parameters,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Metadata json.RawMessage `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// InferenceResult represents an AI inference result
|
||||
type InferenceResult struct {
|
||||
ID string `json:"id"`
|
||||
ModelID string `json:"modelId"`
|
||||
InputHash string `json:"inputHash"`
|
||||
OutputHash string `json:"outputHash"`
|
||||
Confidence float64 `json:"confidence,omitempty"`
|
||||
Latency time.Duration `json:"latency"`
|
||||
Provider string `json:"provider"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Metadata json.RawMessage `json:"metadata,omitempty"`
|
||||
ID string `json:"id"`
|
||||
ModelID string `json:"modelId"`
|
||||
InputHash string `json:"inputHash"`
|
||||
OutputHash string `json:"outputHash"`
|
||||
Confidence float64 `json:"confidence,omitempty"`
|
||||
Latency time.Duration `json:"latency"`
|
||||
Provider string `json:"provider"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Metadata json.RawMessage `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// AIProvider represents an AI compute provider
|
||||
type AIProvider struct {
|
||||
ID string `json:"id"`
|
||||
Address string `json:"address"`
|
||||
Name string `json:"name"`
|
||||
Reputation float64 `json:"reputation"`
|
||||
Capacity uint64 `json:"capacity"`
|
||||
Active bool `json:"active"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Metadata json.RawMessage `json:"metadata,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Address string `json:"address"`
|
||||
Name string `json:"name"`
|
||||
Reputation float64 `json:"reputation"`
|
||||
Capacity uint64 `json:"capacity"`
|
||||
Active bool `json:"active"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Metadata json.RawMessage `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// AIReceipt represents a payment receipt for AI compute services
|
||||
|
||||
+21
-21
@@ -56,15 +56,15 @@ type Transfer struct {
|
||||
|
||||
// Proof represents a bridge proof for cross-chain validation
|
||||
type Proof struct {
|
||||
ID string `json:"id"`
|
||||
TransferID string `json:"transferId"`
|
||||
ProofType string `json:"proofType"` // merkle, signature, zk
|
||||
ProofData string `json:"proofData"`
|
||||
Validators []string `json:"validators,omitempty"`
|
||||
Signatures []string `json:"signatures,omitempty"`
|
||||
Verified bool `json:"verified"`
|
||||
VerifiedAt time.Time `json:"verifiedAt,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID string `json:"id"`
|
||||
TransferID string `json:"transferId"`
|
||||
ProofType string `json:"proofType"` // merkle, signature, zk
|
||||
ProofData string `json:"proofData"`
|
||||
Validators []string `json:"validators,omitempty"`
|
||||
Signatures []string `json:"signatures,omitempty"`
|
||||
Verified bool `json:"verified"`
|
||||
VerifiedAt time.Time `json:"verifiedAt,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// LockedAsset represents an asset locked in the bridge
|
||||
@@ -79,15 +79,15 @@ type LockedAsset struct {
|
||||
|
||||
// vertexData holds B-Chain specific vertex data
|
||||
type vertexData struct {
|
||||
VertexID string `json:"vertexId"`
|
||||
Type string `json:"type"`
|
||||
ParentIDs []string `json:"parentIds"`
|
||||
Height uint64 `json:"height"`
|
||||
Epoch uint32 `json:"epoch"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Status string `json:"status"`
|
||||
Transfers []Transfer `json:"transfers,omitempty"`
|
||||
Proofs []Proof `json:"proofs,omitempty"`
|
||||
VertexID string `json:"vertexId"`
|
||||
Type string `json:"type"`
|
||||
ParentIDs []string `json:"parentIds"`
|
||||
Height uint64 `json:"height"`
|
||||
Epoch uint32 `json:"epoch"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Status string `json:"status"`
|
||||
Transfers []Transfer `json:"transfers,omitempty"`
|
||||
Proofs []Proof `json:"proofs,omitempty"`
|
||||
LockedAssets []LockedAsset `json:"lockedAssets,omitempty"`
|
||||
}
|
||||
|
||||
@@ -399,9 +399,9 @@ func (a *Adapter) GetStats(ctx context.Context, db *sql.DB) (map[string]interfac
|
||||
continue
|
||||
}
|
||||
chainStats[chainID] = map[string]interface{}{
|
||||
"transfers_in": in,
|
||||
"transfers_out": out,
|
||||
"volume_locked": volume,
|
||||
"transfers_in": in,
|
||||
"transfers_out": out,
|
||||
"volume_locked": volume,
|
||||
"active_transfers": active,
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -85,12 +85,12 @@ const (
|
||||
|
||||
// Stats for DAG chain
|
||||
type Stats struct {
|
||||
TotalVertices int64 `json:"total_vertices"`
|
||||
PendingVertices int64 `json:"pending_vertices"`
|
||||
AcceptedVertices int64 `json:"accepted_vertices"`
|
||||
TotalEdges int64 `json:"total_edges"`
|
||||
ChainType ChainType `json:"chain_type"`
|
||||
LastUpdated time.Time `json:"last_updated"`
|
||||
TotalVertices int64 `json:"total_vertices"`
|
||||
PendingVertices int64 `json:"pending_vertices"`
|
||||
AcceptedVertices int64 `json:"accepted_vertices"`
|
||||
TotalEdges int64 `json:"total_edges"`
|
||||
ChainType ChainType `json:"chain_type"`
|
||||
LastUpdated time.Time `json:"last_updated"`
|
||||
}
|
||||
|
||||
// Adapter interface for chain-specific logic
|
||||
@@ -478,9 +478,9 @@ func (s *Subscriber) ClientCount() int {
|
||||
|
||||
// Poller polls for new vertices
|
||||
type Poller struct {
|
||||
idx *Indexer
|
||||
sub *Subscriber
|
||||
mu sync.Mutex
|
||||
idx *Indexer
|
||||
sub *Subscriber
|
||||
mu sync.Mutex
|
||||
lastID string
|
||||
}
|
||||
|
||||
|
||||
+17
-17
@@ -90,10 +90,10 @@ func (a *Adapter) rpcRequest(ctx context.Context, method string, params interfac
|
||||
|
||||
// PChainBlock represents a P-Chain block from RPC
|
||||
type PChainBlock struct {
|
||||
ID string `json:"id"`
|
||||
ParentID string `json:"parentID"`
|
||||
Height uint64 `json:"height"`
|
||||
Timestamp int64 `json:"timestamp"` // Unix timestamp
|
||||
ID string `json:"id"`
|
||||
ParentID string `json:"parentID"`
|
||||
Height uint64 `json:"height"`
|
||||
Timestamp int64 `json:"timestamp"` // Unix timestamp
|
||||
Txs []PChainTx `json:"txs"`
|
||||
}
|
||||
|
||||
@@ -428,15 +428,15 @@ func (a *Adapter) GetPendingValidators(ctx context.Context, netID string) ([]Val
|
||||
|
||||
// Validator represents a P-Chain validator
|
||||
type Validator struct {
|
||||
TxID string `json:"txID"`
|
||||
NodeID string `json:"nodeID"`
|
||||
StartTime string `json:"startTime"`
|
||||
EndTime string `json:"endTime"`
|
||||
StakeAmount string `json:"stakeAmount"`
|
||||
PotentialReward string `json:"potentialReward"`
|
||||
DelegationFee string `json:"delegationFee"`
|
||||
Uptime string `json:"uptime"`
|
||||
Connected bool `json:"connected"`
|
||||
TxID string `json:"txID"`
|
||||
NodeID string `json:"nodeID"`
|
||||
StartTime string `json:"startTime"`
|
||||
EndTime string `json:"endTime"`
|
||||
StakeAmount string `json:"stakeAmount"`
|
||||
PotentialReward string `json:"potentialReward"`
|
||||
DelegationFee string `json:"delegationFee"`
|
||||
Uptime string `json:"uptime"`
|
||||
Connected bool `json:"connected"`
|
||||
Delegators []Delegator `json:"delegators,omitempty"`
|
||||
}
|
||||
|
||||
@@ -494,10 +494,10 @@ func (a *Adapter) GetBlockchains(ctx context.Context) ([]Blockchain, error) {
|
||||
|
||||
// Blockchain represents a P-Chain blockchain
|
||||
type Blockchain struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
NetID string `json:"netID"`
|
||||
VMID string `json:"vmID"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
NetID string `json:"netID"`
|
||||
VMID string `json:"vmID"`
|
||||
}
|
||||
|
||||
// SyncValidators syncs validator data from RPC to database
|
||||
|
||||
+7
-7
@@ -69,14 +69,14 @@ type QuantumVertex struct {
|
||||
type QuantumStamp struct {
|
||||
ID string `json:"id"`
|
||||
VertexID string `json:"vertexId"`
|
||||
ChainID string `json:"chainId"` // Which chain this stamp is for
|
||||
BlockHeight uint64 `json:"blockHeight"` // Block height being stamped
|
||||
BlockHash []byte `json:"blockHash"` // Block hash being certified
|
||||
Entropy []byte `json:"entropy"` // Quantum random entropy
|
||||
KeyID string `json:"keyId"` // Corona key used for signing
|
||||
Signature []byte `json:"signature"` // Quantum-resistant signature
|
||||
ChainID string `json:"chainId"` // Which chain this stamp is for
|
||||
BlockHeight uint64 `json:"blockHeight"` // Block height being stamped
|
||||
BlockHash []byte `json:"blockHash"` // Block hash being certified
|
||||
Entropy []byte `json:"entropy"` // Quantum random entropy
|
||||
KeyID string `json:"keyId"` // Corona key used for signing
|
||||
Signature []byte `json:"signature"` // Quantum-resistant signature
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Certified bool `json:"certified"` // Whether stamp has been verified
|
||||
Certified bool `json:"certified"` // Whether stamp has been verified
|
||||
}
|
||||
|
||||
// CoronaKey represents a quantum-resistant signing key (Corona is LUX's post-quantum signature scheme)
|
||||
|
||||
+5
-5
@@ -1034,11 +1034,11 @@ func (t *DgraphTransaction) Rollback() error {
|
||||
}
|
||||
|
||||
// All other methods delegate to the store
|
||||
func (t *DgraphTransaction) Init(ctx context.Context) error { return nil }
|
||||
func (t *DgraphTransaction) Close() error { return nil }
|
||||
func (t *DgraphTransaction) Ping(ctx context.Context) error { return t.store.Ping(ctx) }
|
||||
func (t *DgraphTransaction) InitSchema(ctx context.Context, schema Schema) error { return nil }
|
||||
func (t *DgraphTransaction) MigrateSchema(ctx context.Context, schema Schema) error { return nil }
|
||||
func (t *DgraphTransaction) Init(ctx context.Context) error { return nil }
|
||||
func (t *DgraphTransaction) Close() error { return nil }
|
||||
func (t *DgraphTransaction) Ping(ctx context.Context) error { return t.store.Ping(ctx) }
|
||||
func (t *DgraphTransaction) InitSchema(ctx context.Context, schema Schema) error { return nil }
|
||||
func (t *DgraphTransaction) MigrateSchema(ctx context.Context, schema Schema) error { return nil }
|
||||
func (t *DgraphTransaction) StoreBlock(ctx context.Context, table string, block *Block) error {
|
||||
return t.store.StoreBlock(ctx, table, block)
|
||||
}
|
||||
|
||||
+4
-4
@@ -23,10 +23,10 @@ const (
|
||||
|
||||
// Config for storage backend
|
||||
type Config struct {
|
||||
Backend Backend
|
||||
URL string // Connection URL (postgres://, badger://, dgraph://)
|
||||
Options map[string]string // Backend-specific options
|
||||
DataDir string // For file-based backends (BadgerDB)
|
||||
Backend Backend
|
||||
URL string // Connection URL (postgres://, badger://, dgraph://)
|
||||
Options map[string]string // Backend-specific options
|
||||
DataDir string // For file-based backends (BadgerDB)
|
||||
}
|
||||
|
||||
// Store is the main storage interface for indexed data
|
||||
|
||||
+50
-50
@@ -42,76 +42,76 @@ const (
|
||||
type KeyShareStatus string
|
||||
|
||||
const (
|
||||
SharePending KeyShareStatus = "pending"
|
||||
ShareActive KeyShareStatus = "active"
|
||||
ShareRevoked KeyShareStatus = "revoked"
|
||||
ShareRotated KeyShareStatus = "rotated"
|
||||
SharePending KeyShareStatus = "pending"
|
||||
ShareActive KeyShareStatus = "active"
|
||||
ShareRevoked KeyShareStatus = "revoked"
|
||||
ShareRotated KeyShareStatus = "rotated"
|
||||
)
|
||||
|
||||
// SigningSession represents an MPC threshold signing session
|
||||
type SigningSession struct {
|
||||
ID string `json:"id"`
|
||||
Threshold uint32 `json:"threshold"` // t of n threshold
|
||||
TotalShares uint32 `json:"totalShares"` // total participants
|
||||
MessageHash string `json:"messageHash"` // hash being signed
|
||||
Participants []string `json:"participants"` // node IDs participating
|
||||
Signatures []string `json:"signatures"` // partial signatures collected
|
||||
FinalSig string `json:"finalSig,omitempty"` // combined signature
|
||||
Status SessionStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
||||
ExpiresAt time.Time `json:"expiresAt"`
|
||||
SourceChain string `json:"sourceChain,omitempty"`
|
||||
DestChain string `json:"destChain,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Threshold uint32 `json:"threshold"` // t of n threshold
|
||||
TotalShares uint32 `json:"totalShares"` // total participants
|
||||
MessageHash string `json:"messageHash"` // hash being signed
|
||||
Participants []string `json:"participants"` // node IDs participating
|
||||
Signatures []string `json:"signatures"` // partial signatures collected
|
||||
FinalSig string `json:"finalSig,omitempty"` // combined signature
|
||||
Status SessionStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
||||
ExpiresAt time.Time `json:"expiresAt"`
|
||||
SourceChain string `json:"sourceChain,omitempty"`
|
||||
DestChain string `json:"destChain,omitempty"`
|
||||
}
|
||||
|
||||
// KeyShare represents a distributed key share for MPC
|
||||
type KeyShare struct {
|
||||
ID string `json:"id"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
ShareIndex uint32 `json:"shareIndex"`
|
||||
NodeID string `json:"nodeId"`
|
||||
KeyGenID string `json:"keyGenId"` // key generation ceremony ID
|
||||
Status KeyShareStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
RotatedAt *time.Time `json:"rotatedAt,omitempty"`
|
||||
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
|
||||
ID string `json:"id"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
ShareIndex uint32 `json:"shareIndex"`
|
||||
NodeID string `json:"nodeId"`
|
||||
KeyGenID string `json:"keyGenId"` // key generation ceremony ID
|
||||
Status KeyShareStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
RotatedAt *time.Time `json:"rotatedAt,omitempty"`
|
||||
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
|
||||
}
|
||||
|
||||
// KeyGeneration represents a distributed key generation ceremony
|
||||
type KeyGeneration struct {
|
||||
ID string `json:"id"`
|
||||
Threshold uint32 `json:"threshold"`
|
||||
TotalShares uint32 `json:"totalShares"`
|
||||
PublicKey string `json:"publicKey"` // combined public key
|
||||
Participants []string `json:"participants"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Threshold uint32 `json:"threshold"`
|
||||
TotalShares uint32 `json:"totalShares"`
|
||||
PublicKey string `json:"publicKey"` // combined public key
|
||||
Participants []string `json:"participants"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
||||
}
|
||||
|
||||
// TeleportMessage represents a cross-chain teleport message
|
||||
type TeleportMessage struct {
|
||||
ID string `json:"id"`
|
||||
SourceChain string `json:"sourceChain"`
|
||||
DestChain string `json:"destChain"`
|
||||
Sender string `json:"sender"`
|
||||
Receiver string `json:"receiver"`
|
||||
Payload json.RawMessage `json:"payload"`
|
||||
Nonce uint64 `json:"nonce"`
|
||||
SessionID string `json:"sessionId,omitempty"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
SignedAt *time.Time `json:"signedAt,omitempty"`
|
||||
DeliveredAt *time.Time `json:"deliveredAt,omitempty"`
|
||||
ID string `json:"id"`
|
||||
SourceChain string `json:"sourceChain"`
|
||||
DestChain string `json:"destChain"`
|
||||
Sender string `json:"sender"`
|
||||
Receiver string `json:"receiver"`
|
||||
Payload json.RawMessage `json:"payload"`
|
||||
Nonce uint64 `json:"nonce"`
|
||||
SessionID string `json:"sessionId,omitempty"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
SignedAt *time.Time `json:"signedAt,omitempty"`
|
||||
DeliveredAt *time.Time `json:"deliveredAt,omitempty"`
|
||||
}
|
||||
|
||||
// VertexData contains T-Chain specific vertex data
|
||||
type VertexData struct {
|
||||
Session *SigningSession `json:"session,omitempty"`
|
||||
KeyShare *KeyShare `json:"keyShare,omitempty"`
|
||||
KeyGen *KeyGeneration `json:"keyGen,omitempty"`
|
||||
Message *TeleportMessage `json:"message,omitempty"`
|
||||
Session *SigningSession `json:"session,omitempty"`
|
||||
KeyShare *KeyShare `json:"keyShare,omitempty"`
|
||||
KeyGen *KeyGeneration `json:"keyGen,omitempty"`
|
||||
Message *TeleportMessage `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Adapter implements dag.Adapter for T-Chain MPC operations
|
||||
|
||||
+14
-14
@@ -45,28 +45,28 @@ const (
|
||||
type ProofType string
|
||||
|
||||
const (
|
||||
ProofGroth16 ProofType = "groth16"
|
||||
ProofPlonk ProofType = "plonk"
|
||||
ProofSTARK ProofType = "stark"
|
||||
ProofBullet ProofType = "bulletproof"
|
||||
ProofHalo2 ProofType = "halo2"
|
||||
ProofFRI ProofType = "fri" // Fast Reed-Solomon IOP
|
||||
ProofGroth16 ProofType = "groth16"
|
||||
ProofPlonk ProofType = "plonk"
|
||||
ProofSTARK ProofType = "stark"
|
||||
ProofBullet ProofType = "bulletproof"
|
||||
ProofHalo2 ProofType = "halo2"
|
||||
ProofFRI ProofType = "fri" // Fast Reed-Solomon IOP
|
||||
)
|
||||
|
||||
// ZKProof represents a zero-knowledge proof
|
||||
type ZKProof struct {
|
||||
Type ProofType `json:"type"`
|
||||
Data string `json:"data"` // Hex-encoded proof bytes
|
||||
PublicInputs []string `json:"publicInputs,omitempty"`
|
||||
VerifyingKey string `json:"verifyingKey,omitempty"`
|
||||
Type ProofType `json:"type"`
|
||||
Data string `json:"data"` // Hex-encoded proof bytes
|
||||
PublicInputs []string `json:"publicInputs,omitempty"`
|
||||
VerifyingKey string `json:"verifyingKey,omitempty"`
|
||||
}
|
||||
|
||||
// Nullifier represents a spent note marker (prevents double-spending)
|
||||
type Nullifier struct {
|
||||
Hash string `json:"hash"`
|
||||
TxID string `json:"txId"`
|
||||
Index int `json:"index"`
|
||||
SpentAt int64 `json:"spentAt,omitempty"` // Vertex height
|
||||
Hash string `json:"hash"`
|
||||
TxID string `json:"txId"`
|
||||
Index int `json:"index"`
|
||||
SpentAt int64 `json:"spentAt,omitempty"` // Vertex height
|
||||
}
|
||||
|
||||
// Commitment represents a shielded note commitment
|
||||
|
||||
Reference in New Issue
Block a user