@@ -18,9 +18,11 @@ import (
1818
1919var SendManualPDPCmd = & cli.Command {
2020 Name : "send-manual-pdp" ,
21- Usage : "Send a manual PDP deal on-chain" ,
22- Description : `Create/reuse a proof set and add a piece to it on-chain via PDPVerifier.
23- Example: singularity deal send-manual-pdp --client f1xxx --provider t410fxxx --piece-cid bagaxxxx --piece-size 1048576 --eth-rpc http://localhost:5700/rpc/v1` ,
21+ Usage : "Send a manual PDP deal via the FWSS-pull flow" ,
22+ Description : `Push a single piece to an SP via Curio's /pdp/piece/pull, then trigger the
23+ SP's on-chain commit (createDataSet+addPieces if no assembling set yet, or addPieces
24+ into the existing one). Useful for e2e/diagnostic testing of the FWSS pull path.
25+ Example: singularity deal send-manual-pdp --client f1xxx --provider t410fxxx --piece-cid bagaxxxx --piece-size 1048576 --eth-rpc http://localhost:5700/rpc/v1 --source-url-base https://static.example.org` ,
2426 Flags : []cli.Flag {
2527 & cli.StringFlag {
2628 Name : "client" ,
@@ -34,12 +36,12 @@ var SendManualPDPCmd = &cli.Command{
3436 },
3537 & cli.StringFlag {
3638 Name : "piece-cid" ,
37- Usage : "Piece CID (commp)" ,
39+ Usage : "Piece CID (commp v1 )" ,
3840 Required : true ,
3941 },
4042 & cli.Int64Flag {
4143 Name : "piece-size" ,
42- Usage : "Piece size in bytes" ,
44+ Usage : "Padded piece size in bytes" ,
4345 Required : true ,
4446 },
4547 & cli.StringFlag {
@@ -48,10 +50,21 @@ var SendManualPDPCmd = &cli.Command{
4850 EnvVars : []string {"ETH_RPC_URL" },
4951 Required : true ,
5052 },
51- & cli.Uint64Flag {
52- Name : "confirmation-depth" ,
53- Usage : "Blocks to wait for tx confirmation" ,
54- Value : 5 ,
53+ & cli.StringFlag {
54+ Name : "source-url-base" ,
55+ Usage : "HTTPS base where Curio fetches the piece (sourceUrl = <base>/piece/<pieceCidV2>)" ,
56+ EnvVars : []string {"PDP_SOURCE_URL_BASE" },
57+ Required : true ,
58+ },
59+ & cli.StringFlag {
60+ Name : "record-keeper" ,
61+ Usage : "FWSS contract address. Defaults to network FWSS from go-synapse." ,
62+ EnvVars : []string {"PDP_RECORD_KEEPER" },
63+ },
64+ & cli.DurationFlag {
65+ Name : "pull-timeout" ,
66+ Usage : "How long to wait for Curio to finish each phase" ,
67+ Value : 5 * time .Minute ,
5568 },
5669 },
5770 Action : func (c * cli.Context ) error {
@@ -61,13 +74,17 @@ var SendManualPDPCmd = &cli.Command{
6174 }
6275 defer closer .Close ()
6376
64- pdp , err := dealpusher .NewOnChainPDP (c .Context , db , c .String ("eth-rpc" ))
77+ pdp , err := dealpusher .NewOnChainPDP (c .Context , dealpusher.OnChainPDPConfig {
78+ DB : db ,
79+ RPCURL : c .String ("eth-rpc" ),
80+ SourceURLBase : c .String ("source-url-base" ),
81+ RecordKeeper : c .String ("record-keeper" ),
82+ })
6583 if err != nil {
6684 return errors .WithStack (err )
6785 }
6886 defer pdp .Close ()
6987
70- // load wallet
7188 var walletObj model.Wallet
7289 err = db .WithContext (c .Context ).Where ("address = ?" , c .String ("client" )).First (& walletObj ).Error
7390 if errors .Is (err , gorm .ErrRecordNotFound ) {
@@ -86,56 +103,40 @@ var SendManualPDPCmd = &cli.Command{
86103 return errors .WithStack (err )
87104 }
88105
89- provider := c .String ("provider" )
90-
91- cfg := dealpusher.PDPSchedulingConfig {
92- BatchSize : 1 ,
93- MaxPiecesPerProofSet : 1024 ,
94- ConfirmationDepth : c .Uint64 ("confirmation-depth" ),
95- PollingInterval : 5 * time .Second ,
96- }
97-
98- // ensure proof set exists (or create one)
99- fmt .Println ("ensuring proof set..." )
100- proofSetID , err := pdp .EnsureProofSet (c .Context , evmSigner , provider , cfg )
101- if err != nil {
102- return errors .Wrap (err , "failed to ensure proof set" )
103- }
104- fmt .Printf ("proof set ID: %d\n " , proofSetID )
105-
106- // parse piece cid
107106 pieceCID , err := cid .Parse (c .String ("piece-cid" ))
108107 if err != nil {
109108 return errors .Wrap (err , "invalid piece CID" )
110109 }
111-
112- // add piece to proof set
113- fmt .Println ("submitting add-roots tx..." )
114110 pieceSize := c .Int64 ("piece-size" )
115- queuedTx , err := pdp .QueueAddRoots (c .Context , evmSigner , proofSetID , []cid.Cid {pieceCID }, []int64 {pieceSize }, cfg )
116- if err != nil {
117- return errors .Wrap (err , "failed to add roots" )
111+
112+ cfg := dealpusher.PDPSchedulingConfig {
113+ BatchSize : 1 ,
114+ MaxPiecesPerProofSet : 1024 ,
115+ PullTimeout : c .Duration ("pull-timeout" ),
118116 }
119- fmt .Printf ("tx: %s\n " , queuedTx .Hash )
120117
121- // wait for confirmation
122- fmt .Println ("waiting for confirmation..." )
123- receipt , err := pdp .WaitForConfirmations (c .Context , queuedTx .Hash , cfg .ConfirmationDepth , cfg .PollingInterval )
118+ fmt .Println ("pushing piece to SP via /pdp/piece/pull + on-chain commit..." )
119+ result , err := pdp .PullPiecesToFWSS (
120+ c .Context ,
121+ evmSigner ,
122+ c .String ("provider" ),
123+ []dealpusher.PDPPieceInput {{PieceCID : pieceCID , PieceSize : pieceSize }},
124+ cfg ,
125+ )
124126 if err != nil {
125- return errors .Wrap (err , "tx failed" )
127+ return errors .Wrap (err , "FWSS pull push failed" )
126128 }
127- fmt .Printf ("confirmed at block %d (gas : %d) \n " , receipt . BlockNumber , receipt . GasUsed )
129+ fmt .Printf ("data set ID : %d\n " , result . DataSetID )
128130
129- // save deal record
130- proofSetIDCopy := proofSetID
131+ dataSetIDCopy := result .DataSetID
131132 dealModel := & model.Deal {
132133 State : model .DealProposed ,
133134 DealType : model .DealTypePDP ,
134- Provider : provider ,
135+ Provider : c . String ( " provider" ) ,
135136 PieceCID : model .CID (pieceCID ),
136137 PieceSize : pieceSize ,
137138 WalletID : & walletObj .ID ,
138- ProofSetID : & proofSetIDCopy ,
139+ ProofSetID : & dataSetIDCopy ,
139140 }
140141 if err := db .WithContext (c .Context ).Create (dealModel ).Error ; err != nil {
141142 return errors .Wrap (err , "failed to save deal" )
0 commit comments