From 5e1fb376024fd711a145529d27a663803b0ca3b1 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 21 Mar 2024 10:39:42 +0400 Subject: [PATCH 1/8] fix Datacap TermMax --- cli/filplus.go | 51 ++++++++++++++++++++++++----------- documentation/en/cli-lotus.md | 9 ++++--- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/cli/filplus.go b/cli/filplus.go index fbb922a24a2..7d794ff9e2b 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -934,7 +934,11 @@ var filplusSignRemoveDataCapProposal = &cli.Command{ var filplusExtendClaimCmd = &cli.Command{ Name: "extend-claim", - Usage: "extend claim expiration (TermMax)", + Usage: "extends claim expiration (TermMax)", + UsageText: `Extends claim expiration (TermMax). +If the client is original client then claim can be extended to Maximum 5 years and no Datacap is required. +If the client id different then claim can be extended up to Maximum 5 years from now and Datacap is required. +`, Flags: []cli.Flag{ &cli.Int64Flag{ Name: "term-max", @@ -1162,17 +1166,22 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre for claimID, claim := range claims { claimID := claimID claim := claim - if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { - // If client is not same - needs to burn datacap - if claim.Client != wid { + // If the client is not the original client - burn datacap + if claim.Client != wid { + // 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() { newClaims = append(newClaims, verifregtypes13.ClaimExtensionRequest{ Claim: verifregtypes13.ClaimId(claimID), Provider: abi.ActorID(mid), - TermMax: tmax, + TermMax: head.Height() + tmax - claim.TermStart, }) rDataCap.Add(big.NewInt(int64(claim.Size)).Int, rDataCap.Int) - continue } + // If new duration shorter than the original duration then do nothing + continue + } + // For original client, compare duration(TermMax) and claim should be already be expired + if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { terms = append(terms, verifregtypes13.ClaimTerm{ ClaimId: verifregtypes13.ClaimId(claimID), TermMax: tmax, @@ -1204,17 +1213,22 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre if !ok { return nil, xerrors.Errorf("claim %d not found for provider %s", claimID, miners[0]) } - if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { - // If client is not same - needs to burn datacap - if claim.Client != wid { + // If the client is not the original client - burn datacap + if claim.Client != wid { + // 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() { newClaims = append(newClaims, verifregtypes13.ClaimExtensionRequest{ Claim: claimID, Provider: abi.ActorID(mid), - TermMax: tmax, + TermMax: head.Height() + tmax - claim.TermStart, }) rDataCap.Add(big.NewInt(int64(claim.Size)).Int, rDataCap.Int) - continue } + // If new duration shorter than the original duration then do nothing + continue + } + // For original client, compare duration(TermMax) and claim should be already be expired + if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { terms = append(terms, verifregtypes13.ClaimTerm{ ClaimId: claimID, TermMax: tmax, @@ -1235,17 +1249,22 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre if claim == nil { return nil, xerrors.Errorf("claim %d not found in the actor state", claimID) } - if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { - // If client is not same - needs to burn datacap - if claim.Client != wid { + // If the client is not the original client - burn datacap + if claim.Client != wid { + // 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() { newClaims = append(newClaims, verifregtypes13.ClaimExtensionRequest{ Claim: claimID, Provider: prov.ID, - TermMax: tmax, + TermMax: head.Height() + tmax - claim.TermStart, }) rDataCap.Add(big.NewInt(int64(claim.Size)).Int, rDataCap.Int) - continue } + // If new duration shorter than the original duration then do nothing + continue + } + // For original client, compare duration(TermMax) and claim should be already be expired + if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { terms = append(terms, verifregtypes13.ClaimTerm{ ClaimId: claimID, TermMax: tmax, diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index ad04b68ecb4..392cec8b69a 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -1192,7 +1192,7 @@ COMMANDS: list-claims List claims available in verified registry actor or made by provider if specified remove-expired-allocations remove expired allocations (if no allocations are specified all eligible allocations are removed) remove-expired-claims remove expired claims (if no claims are specified all eligible claims are removed) - extend-claim extend claim expiration (TermMax) + extend-claim extends claim expiration (TermMax) help, h Shows a list of commands or help for one command OPTIONS: @@ -1329,10 +1329,13 @@ OPTIONS: ### lotus filplus extend-claim ``` NAME: - lotus filplus extend-claim - extend claim expiration (TermMax) + lotus filplus extend-claim - extends claim expiration (TermMax) USAGE: - lotus filplus extend-claim [command options] ... or ... + Extends claim expiration (TermMax). + If the client is original client then claim can be extended to Maximum 5 years and no Datacap is required. + If the client id different then claim can be extended up to Maximum 5 years from now and Datacap is required. + OPTIONS: --term-max value, --tmax value The maximum period for which a provider can earn quality-adjusted power for the piece (epochs). Default is 5 years. (default: 5256000) From 138bdac39c9107e286dd1afd2fc2812fbc8191c5 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 21 Mar 2024 11:03:45 +0400 Subject: [PATCH 2/8] fix itest --- itests/direct_data_onboard_verified_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itests/direct_data_onboard_verified_test.go b/itests/direct_data_onboard_verified_test.go index 2ac6142c0db..a19b988c2d9 100644 --- a/itests/direct_data_onboard_verified_test.go +++ b/itests/direct_data_onboard_verified_test.go @@ -821,7 +821,6 @@ func TestVerifiedDDOExtendClaim(t *testing.T) { require.NotNil(t, msgs) require.Len(t, msgs, 1) - // MpoolBatchPushMessage method will take care of gas estimation and funds check smsg, err := client.MpoolPushMessage(ctx, msgs[0], nil) require.NoError(t, err) @@ -856,5 +855,6 @@ func TestVerifiedDDOExtendClaim(t *testing.T) { newclaim, err = client.StateGetClaim(ctx, miner.ActorAddr, verifreg.ClaimId(allocationId), types.EmptyTSK) require.NoError(t, err) require.NotNil(t, newclaim) - require.EqualValues(t, newclaim.TermMax, verifregtypes13.MaximumVerifiedAllocationTerm) + // New TermMax should be more than 5 years + require.Greater(t, int(newclaim.TermMax), verifregtypes13.MaximumVerifiedAllocationTerm) } From 41b41e1cd5d354e5a157a6abb57ffc1ed5610581 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 21 Mar 2024 11:47:01 +0400 Subject: [PATCH 3/8] add batching --- cli/filplus.go | 77 +++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/cli/filplus.go b/cli/filplus.go index 7d794ff9e2b..22930a97cc9 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -1276,22 +1276,27 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre var msgs []*types.Message - if len(terms) > 0 { + const batchSize = 1000 + for i := 0; i < len(terms); i += batchSize { + batchEnd := i + batchSize + if batchEnd > len(terms) { + batchEnd = len(terms) + } + + batch := terms[i:batchEnd] + params, err := actors.SerializeParams(&verifregtypes13.ExtendClaimTermsParams{ - Terms: terms, + Terms: batch, }) - if err != nil { return nil, xerrors.Errorf("failed to searialise the parameters: %s", err) } - oclaimMsg := &types.Message{ To: verifreg.Address, From: wallet, Method: verifreg.Methods.ExtendClaimTerms, Params: params, } - msgs = append(msgs, oclaimMsg) } @@ -1311,32 +1316,6 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre return nil, xerrors.Errorf("requested datacap %s is greater then the available datacap %s", rDataCap, aDataCap) } - ncparams, err := actors.SerializeParams(&verifregtypes13.AllocationRequests{ - Extensions: newClaims, - }) - - if err != nil { - return nil, xerrors.Errorf("failed to searialise the parameters: %s", err) - } - - transferParams, err := actors.SerializeParams(&datacap2.TransferParams{ - To: builtin.VerifiedRegistryActorAddr, - Amount: big.Mul(rDataCap, builtin.TokenPrecision), - OperatorData: ncparams, - }) - - if err != nil { - return nil, xerrors.Errorf("failed to serialize transfer parameters: %s", err) - } - - nclaimMsg := &types.Message{ - To: builtin.DatacapActorAddr, - From: wallet, - Method: datacap.Methods.TransferExported, - Params: transferParams, - Value: big.Zero(), - } - if !assumeYes { out := fmt.Sprintf("Some of the specified allocation have a different client address and will require %d Datacap to extend. Proceed? Yes [Y/y] / No [N/n], Ctrl+C (^C) to exit", rDataCap.Int) validate := func(input string) error { @@ -1372,7 +1351,41 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre } } - msgs = append(msgs, nclaimMsg) + // Batch in 1000 to avoid running out of gas + for i := 0; i < len(newClaims); i += batchSize { + batchEnd := i + batchSize + if batchEnd > len(newClaims) { + batchEnd = len(newClaims) + } + + batch := newClaims[i:batchEnd] + + ncparams, err := actors.SerializeParams(&verifregtypes13.AllocationRequests{ + Extensions: batch, + }) + if err != nil { + return nil, xerrors.Errorf("failed to searialise the parameters: %s", err) + } + + transferParams, err := actors.SerializeParams(&datacap2.TransferParams{ + To: builtin.VerifiedRegistryActorAddr, + Amount: big.Mul(rDataCap, builtin.TokenPrecision), + OperatorData: ncparams, + }) + + if err != nil { + return nil, xerrors.Errorf("failed to serialize transfer parameters: %s", err) + } + + nclaimMsg := &types.Message{ + To: builtin.DatacapActorAddr, + From: wallet, + Method: datacap.Methods.TransferExported, + Params: transferParams, + Value: big.Zero(), + } + msgs = append(msgs, nclaimMsg) + } } return msgs, nil From 6822b64bcea69fd3e889cca7fda0a58872d6b5f7 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 21 Mar 2024 12:19:52 +0400 Subject: [PATCH 4/8] make batch size variable --- cli/filplus.go | 10 +++++++--- itests/direct_data_onboard_verified_test.go | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cli/filplus.go b/cli/filplus.go index 22930a97cc9..6234c9b7f4d 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -970,6 +970,11 @@ If the client id different then claim can be extended up to Maximum 5 years from Usage: "number of block confirmations to wait for", Value: int(build.MessageConfidence), }, + &cli.IntFlag{ + Name: "batch-size", + Usage: "number of extend requests per batch. If set incorrectly, this will lead to out of gas error", + Value: 1000, + }, }, ArgsUsage: " ... or ...", Action: func(cctx *cli.Context) error { @@ -1073,7 +1078,7 @@ If the client id different then claim can be extended up to Maximum 5 years from } } - msgs, err := CreateExtendClaimMsg(ctx, api, claimMap, miners, clientAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes")) + msgs, err := CreateExtendClaimMsg(ctx, api, claimMap, miners, clientAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), cctx.Int("batch-size")) if err != nil { return err } @@ -1126,7 +1131,7 @@ type ProvInfo 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.FullNode, pcm map[verifregtypes13.ClaimId]ProvInfo, miners []string, wallet address.Address, tmax abi.ChainEpoch, all, assumeYes bool) ([]*types.Message, error) { +func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifregtypes13.ClaimId]ProvInfo, miners []string, wallet address.Address, tmax abi.ChainEpoch, all, assumeYes bool, batchSize int) ([]*types.Message, error) { ac, err := api.StateLookupID(ctx, wallet, types.EmptyTSK) if err != nil { @@ -1276,7 +1281,6 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre var msgs []*types.Message - const batchSize = 1000 for i := 0; i < len(terms); i += batchSize { batchEnd := i + batchSize if batchEnd > len(terms) { diff --git a/itests/direct_data_onboard_verified_test.go b/itests/direct_data_onboard_verified_test.go index a19b988c2d9..5315bedd794 100644 --- a/itests/direct_data_onboard_verified_test.go +++ b/itests/direct_data_onboard_verified_test.go @@ -816,7 +816,7 @@ func TestVerifiedDDOExtendClaim(t *testing.T) { pcm[verifregtypes13.ClaimId(allocationId)] = prov // Extend claim with same client - msgs, err := cli.CreateExtendClaimMsg(ctx, client.FullNode, pcm, []string{}, verifiedClientAddr1, (builtin.EpochsInYear*3)+3000, false, true) + msgs, err := cli.CreateExtendClaimMsg(ctx, client.FullNode, pcm, []string{}, verifiedClientAddr1, (builtin.EpochsInYear*3)+3000, false, true, 100) require.NoError(t, err) require.NotNil(t, msgs) require.Len(t, msgs, 1) @@ -834,11 +834,11 @@ func TestVerifiedDDOExtendClaim(t *testing.T) { require.EqualValues(t, newclaim.TermMax-oldclaim.TermMax, 3000) // Extend claim with non-verified client | should fail - _, err = cli.CreateExtendClaimMsg(ctx, client.FullNode, pcm, []string{}, unverifiedClient.Address, verifregtypes13.MaximumVerifiedAllocationTerm, false, true) + _, err = cli.CreateExtendClaimMsg(ctx, client.FullNode, pcm, []string{}, unverifiedClient.Address, verifregtypes13.MaximumVerifiedAllocationTerm, false, true, 100) require.ErrorContains(t, err, "does not have any datacap") // Extend all claim with verified client - msgs, err = cli.CreateExtendClaimMsg(ctx, client.FullNode, nil, []string{miner.ActorAddr.String()}, verifiedClientAddr2, verifregtypes13.MaximumVerifiedAllocationTerm, true, true) + msgs, err = cli.CreateExtendClaimMsg(ctx, client.FullNode, nil, []string{miner.ActorAddr.String()}, verifiedClientAddr2, verifregtypes13.MaximumVerifiedAllocationTerm, true, true, 100) require.NoError(t, err) require.Len(t, msgs, 1) smsg, err = client.MpoolPushMessage(ctx, msgs[0], nil) @@ -848,7 +848,7 @@ func TestVerifiedDDOExtendClaim(t *testing.T) { require.True(t, wait.Receipt.ExitCode.IsSuccess()) // Extend all claims with lower TermMax - msgs, err = cli.CreateExtendClaimMsg(ctx, client.FullNode, pcm, []string{}, verifiedClientAddr2, builtin.EpochsInYear*4, false, true) + msgs, err = cli.CreateExtendClaimMsg(ctx, client.FullNode, pcm, []string{}, verifiedClientAddr2, builtin.EpochsInYear*4, false, true, 100) require.NoError(t, err) require.Nil(t, msgs) From 040dbdcec39ecf9f330fbddffb55b4dbffbfe1f0 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 21 Mar 2024 17:40:54 +0400 Subject: [PATCH 5/8] docsgen-cli --- documentation/en/cli-lotus.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index 392cec8b69a..95721d50fdf 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -1344,6 +1344,7 @@ OPTIONS: --miner value, -m value, --provider value, -p value [ --miner value, -m value, --provider value, -p value ] storage provider address[es] --assume-yes, -y, --yes automatic yes to prompts; assume 'yes' as answer to all prompts and run non-interactively (default: false) --confidence value number of block confirmations to wait for (default: 5) + --batch-size value number of extend requests per batch. If set incorrectly, this will lead to out of gas error (default: 1000) --help, -h show help ``` From f69c62a6b8562e1e70e40e1c6d750c7e3f52a22c Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Wed, 27 Mar 2024 15:14:40 +0400 Subject: [PATCH 6/8] reduce batch size, fix batch dc --- cli/filplus.go | 79 ++++++++++++++++++++++------------- documentation/en/cli-lotus.md | 2 +- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/cli/filplus.go b/cli/filplus.go index 6234c9b7f4d..497b0ff29cd 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -973,7 +973,7 @@ If the client id different then claim can be extended up to Maximum 5 years from &cli.IntFlag{ Name: "batch-size", Usage: "number of extend requests per batch. If set incorrectly, this will lead to out of gas error", - Value: 1000, + Value: 500, }, }, ArgsUsage: " ... or ...", @@ -1150,7 +1150,7 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre } var terms []verifregtypes13.ClaimTerm - var newClaims []verifregtypes13.ClaimExtensionRequest + newClaims := make(map[verifregtypes13.ClaimExtensionRequest]big.Int) rDataCap := big.NewInt(0) // If --all is set @@ -1175,11 +1175,12 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre if claim.Client != wid { // 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() { - newClaims = append(newClaims, verifregtypes13.ClaimExtensionRequest{ + req := verifregtypes13.ClaimExtensionRequest{ Claim: verifregtypes13.ClaimId(claimID), Provider: abi.ActorID(mid), TermMax: head.Height() + tmax - claim.TermStart, - }) + } + newClaims[req] = big.NewInt(int64(claim.Size)) rDataCap.Add(big.NewInt(int64(claim.Size)).Int, rDataCap.Int) } // If new duration shorter than the original duration then do nothing @@ -1222,11 +1223,12 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre if claim.Client != wid { // 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() { - newClaims = append(newClaims, verifregtypes13.ClaimExtensionRequest{ + req := verifregtypes13.ClaimExtensionRequest{ Claim: claimID, Provider: abi.ActorID(mid), TermMax: head.Height() + tmax - claim.TermStart, - }) + } + newClaims[req] = big.NewInt(int64(claim.Size)) rDataCap.Add(big.NewInt(int64(claim.Size)).Int, rDataCap.Int) } // If new duration shorter than the original duration then do nothing @@ -1258,11 +1260,12 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre if claim.Client != wid { // 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() { - newClaims = append(newClaims, verifregtypes13.ClaimExtensionRequest{ + req := verifregtypes13.ClaimExtensionRequest{ Claim: claimID, Provider: prov.ID, TermMax: head.Height() + tmax - claim.TermStart, - }) + } + newClaims[req] = big.NewInt(int64(claim.Size)) rDataCap.Add(big.NewInt(int64(claim.Size)).Int, rDataCap.Int) } // If new duration shorter than the original duration then do nothing @@ -1281,27 +1284,30 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre var msgs []*types.Message - for i := 0; i < len(terms); i += batchSize { - batchEnd := i + batchSize - if batchEnd > len(terms) { - batchEnd = len(terms) - } + if len(terms) > 0 { + // Batch in 500 to avoid running out of gas + for i := 0; i < len(terms); i += batchSize { + batchEnd := i + batchSize + if batchEnd > len(terms) { + batchEnd = len(terms) + } - batch := terms[i:batchEnd] + batch := terms[i:batchEnd] - params, err := actors.SerializeParams(&verifregtypes13.ExtendClaimTermsParams{ - Terms: batch, - }) - if err != nil { - return nil, xerrors.Errorf("failed to searialise the parameters: %s", err) - } - oclaimMsg := &types.Message{ - To: verifreg.Address, - From: wallet, - Method: verifreg.Methods.ExtendClaimTerms, - Params: params, + params, err := actors.SerializeParams(&verifregtypes13.ExtendClaimTermsParams{ + Terms: batch, + }) + if err != nil { + return nil, xerrors.Errorf("failed to searialise the parameters: %s", err) + } + oclaimMsg := &types.Message{ + To: verifreg.Address, + From: wallet, + Method: verifreg.Methods.ExtendClaimTerms, + Params: params, + } + msgs = append(msgs, oclaimMsg) } - msgs = append(msgs, oclaimMsg) } if len(newClaims) > 0 { @@ -1355,14 +1361,27 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre } } - // Batch in 1000 to avoid running out of gas - for i := 0; i < len(newClaims); i += batchSize { + // Create a map of just keys, so we can easily batch based on the numeric keys + keys := make([]verifregtypes13.ClaimExtensionRequest, 0, len(newClaims)) + for k := range newClaims { + keys = append(keys, k) + } + + // Batch in 500 to avoid running out of gas + for i := 0; i < len(keys); i += batchSize { batchEnd := i + batchSize if batchEnd > len(newClaims) { batchEnd = len(newClaims) } - batch := newClaims[i:batchEnd] + batch := keys[i:batchEnd] + + // Calculate Datacap for this batch + dcap := big.NewInt(0) + for _, k := range batch { + dc := newClaims[k] + dcap.Add(dcap.Int, dc.Int) + } ncparams, err := actors.SerializeParams(&verifregtypes13.AllocationRequests{ Extensions: batch, @@ -1373,7 +1392,7 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre transferParams, err := actors.SerializeParams(&datacap2.TransferParams{ To: builtin.VerifiedRegistryActorAddr, - Amount: big.Mul(rDataCap, builtin.TokenPrecision), + Amount: big.Mul(dcap, builtin.TokenPrecision), OperatorData: ncparams, }) diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index 95721d50fdf..8706038a00e 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -1344,7 +1344,7 @@ OPTIONS: --miner value, -m value, --provider value, -p value [ --miner value, -m value, --provider value, -p value ] storage provider address[es] --assume-yes, -y, --yes automatic yes to prompts; assume 'yes' as answer to all prompts and run non-interactively (default: false) --confidence value number of block confirmations to wait for (default: 5) - --batch-size value number of extend requests per batch. If set incorrectly, this will lead to out of gas error (default: 1000) + --batch-size value number of extend requests per batch. If set incorrectly, this will lead to out of gas error (default: 500) --help, -h show help ``` From e9d4d2b57d7114466c15bd9a7f0c1bf242e7dfa6 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 28 Mar 2024 10:06:43 +0400 Subject: [PATCH 7/8] apply suggestion from review --- cli/filplus.go | 10 +++++----- documentation/en/cli-lotus.md | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/filplus.go b/cli/filplus.go index 497b0ff29cd..8c39c21e88c 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -936,8 +936,8 @@ var filplusExtendClaimCmd = &cli.Command{ Name: "extend-claim", Usage: "extends claim expiration (TermMax)", UsageText: `Extends claim expiration (TermMax). -If the client is original client then claim can be extended to Maximum 5 years and no Datacap is required. -If the client id different then claim can be extended up to Maximum 5 years from now and Datacap is required. +If the client is original client then claim can be extended to maximum 5 years and no Datacap is required. +If the client id different then claim can be extended up to maximum 5 years from now and Datacap is required. `, Flags: []cli.Flag{ &cli.Int64Flag{ @@ -1186,7 +1186,7 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre // If new duration shorter than the original duration then do nothing continue } - // For original client, compare duration(TermMax) and claim should be already be expired + // For original client, compare duration(TermMax) and claim should not already be expired if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { terms = append(terms, verifregtypes13.ClaimTerm{ ClaimId: verifregtypes13.ClaimId(claimID), @@ -1234,7 +1234,7 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre // If new duration shorter than the original duration then do nothing continue } - // For original client, compare duration(TermMax) and claim should be already be expired + // For original client, compare duration(TermMax) and claim should not already be expired if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { terms = append(terms, verifregtypes13.ClaimTerm{ ClaimId: claimID, @@ -1271,7 +1271,7 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre // If new duration shorter than the original duration then do nothing continue } - // For original client, compare duration(TermMax) and claim should be already be expired + // For original client, compare duration(TermMax) and claim should not already be expired if claim.TermMax < tmax && claim.TermStart+claim.TermMax > head.Height() { terms = append(terms, verifregtypes13.ClaimTerm{ ClaimId: claimID, diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index 8706038a00e..36f1e1059a3 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -1333,8 +1333,8 @@ NAME: USAGE: Extends claim expiration (TermMax). - If the client is original client then claim can be extended to Maximum 5 years and no Datacap is required. - If the client id different then claim can be extended up to Maximum 5 years from now and Datacap is required. + If the client is original client then claim can be extended to maximum 5 years and no Datacap is required. + If the client id different then claim can be extended up to maximum 5 years from now and Datacap is required. OPTIONS: From 3ba511d4730a9b513fbf718e6e83f0ef8929e02d Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 28 Mar 2024 10:22:39 +0400 Subject: [PATCH 8/8] put back TODO --- itests/direct_data_onboard_verified_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/itests/direct_data_onboard_verified_test.go b/itests/direct_data_onboard_verified_test.go index c75f7b04b89..7415570a352 100644 --- a/itests/direct_data_onboard_verified_test.go +++ b/itests/direct_data_onboard_verified_test.go @@ -880,6 +880,7 @@ func TestVerifiedDDOExtendClaim(t *testing.T) { require.NoError(t, err) require.NotNil(t, newclaim) + // TODO: check "claim-updated" event // New TermMax should be more than 5 years require.Greater(t, int(newclaim.TermMax), verifregtypes13.MaximumVerifiedAllocationTerm) }