Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions cmd/run/pdptracker.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package run

import (
"fmt"
"time"

"github.com/data-preservation-programs/singularity/database"
Expand All @@ -19,10 +20,7 @@ where data is verified through cryptographic challenges.
This tracker:
- Monitors proof sets for tracked wallets
- Updates deal status based on on-chain proof set state
- Tracks challenge epochs and live status

Note: Full functionality requires the go-synapse library integration.
See: https://github.com/data-preservation-programs/go-synapse`,
- Tracks challenge epochs and live status`,
Flags: []cli.Flag{
&cli.DurationFlag{
Name: "interval",
Expand All @@ -33,16 +31,22 @@ See: https://github.com/data-preservation-programs/go-synapse`,
Name: "eth-rpc",
Usage: "Ethereum RPC endpoint for FEVM (e.g., https://api.node.glif.io)",
EnvVars: []string{"ETH_RPC_URL"},
Required: true,
},
},
Action: func(c *cli.Context) error {
rpcURL := c.String("eth-rpc")
if rpcURL == "" {
return fmt.Errorf("eth-rpc is required")
}

db, closer, err := database.OpenFromCLI(c)
if err != nil {
return err
}
defer closer.Close()

pdpClient, err := pdptracker.NewPDPClient(c.Context, c.String("eth-rpc"))
pdpClient, err := pdptracker.NewPDPClient(c.Context, rpcURL)
if err != nil {
return err
}
Expand All @@ -51,7 +55,7 @@ See: https://github.com/data-preservation-programs/go-synapse`,
tracker := pdptracker.NewPDPTracker(
db,
c.Duration("interval"),
c.String("eth-rpc"),
rpcURL,
pdpClient,
false,
)
Expand Down
17 changes: 1 addition & 16 deletions service/pdptracker/pdptracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// PDP deals use proof sets managed through the PDPVerifier contract, where data is verified
// through cryptographic challenges rather than the traditional sector sealing process.
//
// Note: This package requires the go-synapse library for full functionality.
// See: https://github.com/data-preservation-programs/go-synapse
package pdptracker

import (
Expand Down Expand Up @@ -44,7 +42,6 @@ type ProofSetInfo struct {
}

// PDPClient is the interface for interacting with PDP on-chain state.
// This will be implemented using the go-synapse library once it's available.
type PDPClient interface {
// GetProofSetsForClient returns all proof sets associated with a client address
GetProofSetsForClient(ctx context.Context, clientAddress address.Address) ([]ProofSetInfo, error)
Expand Down Expand Up @@ -78,7 +75,7 @@ type PDPTracker struct {
// - db: Database connection for storing deal information
// - interval: How often to check for updates
// - rpcURL: Filecoin RPC endpoint URL
// - pdpClient: Client for interacting with PDP contracts (can be nil for stub mode)
// - pdpClient: Client for interacting with PDP contracts (can be nil to disable tracking)
// - once: If true, run only once instead of continuously
func NewPDPTracker(
db *gorm.DB,
Expand All @@ -103,14 +100,6 @@ func (*PDPTracker) Name() string {

// Start begins the PDP tracker service.
func (p *PDPTracker) Start(ctx context.Context, exitErr chan<- error) error {
if p.pdpClient == nil {
Logger.Warn("PDP client not configured - PDP tracking will be disabled until go-synapse is integrated")
if exitErr != nil {
exitErr <- nil
}
return nil
}

var regTimer *time.Timer
for {
alreadyRunning, err := healthcheck.Register(ctx, p.dbNoContext, p.workerID, model.PDPTracker, false)
Expand Down Expand Up @@ -218,10 +207,6 @@ func (p *PDPTracker) cleanup(ctx context.Context) error {
// runOnce performs a single cycle of PDP deal tracking.
// It queries wallets, fetches their PDP proof sets, and updates deal status.
func (p *PDPTracker) runOnce(ctx context.Context) error {
if p.pdpClient == nil {
return nil
}

db := p.dbNoContext.WithContext(ctx)

// Get all wallets to track
Expand Down