11package run
22
33import (
4+ "time"
5+
46 "github.com/cockroachdb/errors"
57 "github.com/data-preservation-programs/singularity/database"
68 "github.com/data-preservation-programs/singularity/service"
@@ -25,6 +27,26 @@ var DealPusherCmd = &cli.Command{
2527 Aliases : []string {"M" },
2628 DefaultText : "Unlimited" ,
2729 },
30+ & cli.IntFlag {
31+ Name : "pdp-batch-size" ,
32+ Usage : "Number of roots to include in each PDP add-roots transaction" ,
33+ Value : 128 ,
34+ },
35+ & cli.Uint64Flag {
36+ Name : "pdp-gas-limit" ,
37+ Usage : "Gas limit for PDP on-chain transactions" ,
38+ Value : 5000000 ,
39+ },
40+ & cli.Uint64Flag {
41+ Name : "pdp-confirmation-depth" ,
42+ Usage : "Number of block confirmations required for PDP transactions" ,
43+ Value : 5 ,
44+ },
45+ & cli.DurationFlag {
46+ Name : "pdp-poll-interval" ,
47+ Usage : "Polling interval for PDP transaction confirmation checks" ,
48+ Value : 30 * time .Second ,
49+ },
2850 },
2951 Action : func (c * cli.Context ) error {
3052 db , closer , err := database .OpenFromCLI (c )
@@ -39,7 +61,24 @@ var DealPusherCmd = &cli.Command{
3961 return errors .WithStack (err )
4062 }
4163
42- dm , err := dealpusher .NewDealPusher (db , c .String ("lotus-api" ), c .String ("lotus-token" ), c .Uint ("deal-attempts" ), c .Uint ("max-replication-factor" ))
64+ pdpCfg := dealpusher.PDPSchedulingConfig {
65+ BatchSize : c .Int ("pdp-batch-size" ),
66+ GasLimit : c .Uint64 ("pdp-gas-limit" ),
67+ ConfirmationDepth : c .Uint64 ("pdp-confirmation-depth" ),
68+ PollingInterval : c .Duration ("pdp-poll-interval" ),
69+ }
70+ if err := pdpCfg .Validate (); err != nil {
71+ return errors .WithStack (err )
72+ }
73+
74+ dm , err := dealpusher .NewDealPusher (
75+ db ,
76+ c .String ("lotus-api" ),
77+ c .String ("lotus-token" ),
78+ c .Uint ("deal-attempts" ),
79+ c .Uint ("max-replication-factor" ),
80+ dealpusher .WithPDPSchedulingConfig (pdpCfg ),
81+ )
4382 if err != nil {
4483 return errors .WithStack (err )
4584 }
0 commit comments