Documentation
¶
Overview ¶
Package storage implements provable storage availability commitments for service nodes. It provides per-epoch store-root commitments, random audits, and integration with the DA infrastructure.
Index ¶
- type AuditProof
- type AuditStatus
- type ChunkProof
- type Manager
- func (m *Manager) ComputeEpochRoot(epochID uint64) [32]byte
- func (m *Manager) CreateAudit(ctx context.Context, epochID uint64, nodeID ids.NodeID, seed [32]byte) (*StorageAudit, error)
- func (m *Manager) GetAudit(auditID ids.ID) (*StorageAudit, error)
- func (m *Manager) GetCommitment(epochID uint64, nodeID ids.NodeID) (*servicenodevm.StorageCommitment, error)
- func (m *Manager) GetEpochCommitments(epochID uint64) []*servicenodevm.StorageCommitment
- func (m *Manager) GetPendingAudits(nodeID ids.NodeID) []*StorageAudit
- func (m *Manager) Load(ctx context.Context) error
- func (m *Manager) ProcessExpiredAudits(ctx context.Context) (int, error)
- func (m *Manager) SubmitAuditProof(ctx context.Context, proof *AuditProof) error
- func (m *Manager) SubmitCommitment(ctx context.Context, commit *servicenodevm.StorageCommitment) error
- type StorageAudit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditProof ¶
type AuditProof struct {
AuditID ids.ID `json:"auditID"`
NodeID ids.NodeID `json:"nodeID"`
ChunkProofs []ChunkProof `json:"chunkProofs"`
Signature []byte `json:"signature"`
Timestamp time.Time `json:"timestamp"`
ProofData []byte `json:"proofData"`
}
AuditProof represents a proof in response to a storage audit
type AuditStatus ¶
type AuditStatus string
AuditStatus represents the status of a storage audit
const ( AuditPending AuditStatus = "pending" AuditPassed AuditStatus = "passed" AuditFailed AuditStatus = "failed" AuditExpired AuditStatus = "expired" )
type ChunkProof ¶
type ChunkProof struct {
Index uint64 `json:"index"`
Data []byte `json:"data"`
MerkleProof [][]byte `json:"merkleProof"`
}
ChunkProof represents a proof for a single chunk
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles storage availability tracking and verification
func NewManager ¶
func NewManager(db database.Database, config *servicenodevm.Config) *Manager
NewManager creates a new storage manager
func (*Manager) ComputeEpochRoot ¶
ComputeEpochRoot computes the Merkle root of all commitments for an epoch
func (*Manager) CreateAudit ¶
func (m *Manager) CreateAudit(ctx context.Context, epochID uint64, nodeID ids.NodeID, seed [32]byte) (*StorageAudit, error)
CreateAudit creates a random storage audit for a node
func (*Manager) GetAudit ¶
func (m *Manager) GetAudit(auditID ids.ID) (*StorageAudit, error)
GetAudit retrieves an audit by ID
func (*Manager) GetCommitment ¶
func (m *Manager) GetCommitment(epochID uint64, nodeID ids.NodeID) (*servicenodevm.StorageCommitment, error)
GetCommitment retrieves a commitment for a node and epoch
func (*Manager) GetEpochCommitments ¶
func (m *Manager) GetEpochCommitments(epochID uint64) []*servicenodevm.StorageCommitment
GetEpochCommitments retrieves all commitments for an epoch
func (*Manager) GetPendingAudits ¶
func (m *Manager) GetPendingAudits(nodeID ids.NodeID) []*StorageAudit
GetPendingAudits returns all pending audits for a node
func (*Manager) ProcessExpiredAudits ¶
ProcessExpiredAudits marks expired audits as failed
func (*Manager) SubmitAuditProof ¶
func (m *Manager) SubmitAuditProof(ctx context.Context, proof *AuditProof) error
SubmitAuditProof submits a proof in response to an audit
func (*Manager) SubmitCommitment ¶
func (m *Manager) SubmitCommitment(ctx context.Context, commit *servicenodevm.StorageCommitment) error
SubmitCommitment records a storage commitment from a node
type StorageAudit ¶
type StorageAudit struct {
ID ids.ID `json:"id"`
EpochID uint64 `json:"epochID"`
NodeID ids.NodeID `json:"nodeID"`
Challenge [32]byte `json:"challenge"`
ChunkIndices []uint64 `json:"chunkIndices"`
StoreRoot [32]byte `json:"storeRoot"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
Status AuditStatus `json:"status"`
ResponseProof []byte `json:"responseProof,omitempty"`
RespondedAt time.Time `json:"respondedAt,omitempty"`
FailureReason string `json:"failureReason,omitempty"`
}
StorageAudit represents a random audit of stored data
func (*StorageAudit) Hash ¶
func (a *StorageAudit) Hash() [32]byte
Hash returns the hash of the audit