From f10cee05b9c78f79fc80f692545d3ba3fe339201 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Wed, 30 Apr 2025 12:46:06 +0400 Subject: [PATCH] add no-datacap flag to extend claim cmd --- cmd/boost/direct_deal.go | 11 ++++++++++- cmd/boost/util/util.go | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/boost/direct_deal.go b/cmd/boost/direct_deal.go index 0980722ab..be697bda7 100644 --- a/cmd/boost/direct_deal.go +++ b/cmd/boost/direct_deal.go @@ -522,6 +522,10 @@ If the client id different then claim can be extended up to maximum 5 years from Name: "all", Usage: "automatically extend TermMax of all claims for specified miner[s] to --term-max (default: 5 years from claim start epoch)", }, + &cli.BoolFlag{ + Name: "no-datacap", + Usage: "will only extend the claim expiration without requiring a datacap i.e. made with --wallet address", + }, &cli.StringSliceFlag{ Name: "miner", Usage: "storage provider address[es]", @@ -556,6 +560,11 @@ If the client id different then claim can be extended up to maximum 5 years from all := cctx.Bool("all") wallet := cctx.String("wallet") tmax := cctx.Int64("term-max") + noDatacap := cctx.Bool("no-datacap") + + if !all && noDatacap { + return fmt.Errorf("can't use --no-datacap flag without --all flag") + } // No miner IDs and no arguments if len(miners) == 0 && cctx.Args().Len() == 0 { @@ -654,7 +663,7 @@ If the client id different then claim can be extended up to maximum 5 years from log.Debugw("selected wallet", "wallet", walletAddr) - msgs, err := util.CreateExtendClaimMsg(ctx, gapi, claimMap, miners, walletAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), cctx.Int("batch-size")) + msgs, err := util.CreateExtendClaimMsg(ctx, gapi, claimMap, miners, walletAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), noDatacap, cctx.Int("batch-size")) if err != nil { return err } diff --git a/cmd/boost/util/util.go b/cmd/boost/util/util.go index 609bd94cd..b8bf772ad 100644 --- a/cmd/boost/util/util.go +++ b/cmd/boost/util/util.go @@ -133,7 +133,7 @@ type PieceInfos struct { // 6. Extend all claims for multiple miner IDs with different client address (2 messages) // 7. Extend specified claims for a miner ID with different client address (2 messages) // 8. Extend specific claims for specific miner ID with different client address (2 messages) -func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg13.ClaimId]ProvInfo, miners []string, wallet address.Address, tmax abi.ChainEpoch, all, assumeYes bool, batchSize int) ([]*types.Message, error) { +func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg13.ClaimId]ProvInfo, miners []string, wallet address.Address, tmax abi.ChainEpoch, all, assumeYes, noDatacap bool, batchSize int) ([]*types.Message, error) { ac, err := api.StateLookupID(ctx, wallet, types.EmptyTSK) if err != nil { return nil, err @@ -174,6 +174,9 @@ func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg claim := c // If the client is not the original client - burn datacap if claim.Client != wid { + if noDatacap { + continue + } // The new duration should be greater than the original deal duration and claim should not already be expired if head.Height()+tmax-claim.TermStart > claim.TermMax-claim.TermStart && claim.TermStart+claim.TermMax > head.Height() { req := verifreg13.ClaimExtensionRequest{