Can now specify a range of partitions to make a bad proof for
This commit is contained in:
parent
e49a9b790b
commit
ca21235a4f
@ -370,12 +370,16 @@ var sendInvalidWindowPoStCmd = &cli.Command{
|
|||||||
Usage: "Actually send transaction performing the action",
|
Usage: "Actually send transaction performing the action",
|
||||||
Value: false,
|
Value: false,
|
||||||
},
|
},
|
||||||
|
&cli.Int64SliceFlag{
|
||||||
|
Name: "partitions",
|
||||||
|
Usage: "list of partitions to compact sectors in",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "actor",
|
Name: "actor",
|
||||||
Usage: "TODO",
|
Usage: "TODO",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ArgsUsage: "",
|
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
if !cctx.Bool("really-do-it") {
|
if !cctx.Bool("really-do-it") {
|
||||||
fmt.Println("Pass --really-do-it to actually execute this action")
|
fmt.Println("Pass --really-do-it to actually execute this action")
|
||||||
@ -402,10 +406,10 @@ var sendInvalidWindowPoStCmd = &cli.Command{
|
|||||||
|
|
||||||
deadline, err := api.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
deadline, err := api.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||||
|
|
||||||
//buf := new(bytes.Buffer)
|
partitionIndices := cctx.Int64Slice("partitions")
|
||||||
//if err := maddr.MarshalCBOR(buf); err != nil {
|
if len(partitionIndices) <= 0 {
|
||||||
// return xerrors.Errorf("failed to marshal address to cbor: %w", err)
|
return fmt.Errorf("must include at least one partition to compact")
|
||||||
//}
|
}
|
||||||
|
|
||||||
chainHead, err := api.ChainHead(ctx)
|
chainHead, err := api.ChainHead(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -419,15 +423,26 @@ var sendInvalidWindowPoStCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("getting proof size: %w", err)
|
return xerrors.Errorf("getting proof size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var partitions []miner.PoStPartition
|
||||||
|
var proofs []proof.PoStProof
|
||||||
|
|
||||||
|
emptyProof := proof.PoStProof{
|
||||||
|
PoStProof: minfo.WindowPoStProofType,
|
||||||
|
ProofBytes: make([]byte, 0, proofSize)}
|
||||||
|
|
||||||
|
for _, partition := range partitionIndices {
|
||||||
|
newPartition := miner.PoStPartition{
|
||||||
|
Index: uint64(partition),
|
||||||
|
Skipped: bitfield.New(),
|
||||||
|
}
|
||||||
|
partitions = append(partitions, newPartition)
|
||||||
|
proofs = append(proofs, emptyProof)
|
||||||
|
}
|
||||||
|
|
||||||
params := miner.SubmitWindowedPoStParams{
|
params := miner.SubmitWindowedPoStParams{
|
||||||
Deadline: deadline.Index,
|
Deadline: deadline.Index,
|
||||||
Partitions: []miner.PoStPartition{{
|
Partitions: partitions,
|
||||||
Index: 0,
|
Proofs: proofs,
|
||||||
Skipped: bitfield.New(),
|
|
||||||
}},
|
|
||||||
Proofs: []proof.PoStProof{{
|
|
||||||
PoStProof: minfo.WindowPoStProofType,
|
|
||||||
ProofBytes: make([]byte, 0, proofSize)}},
|
|
||||||
ChainCommitEpoch: deadline.Challenge,
|
ChainCommitEpoch: deadline.Challenge,
|
||||||
ChainCommitRand: checkRand,
|
ChainCommitRand: checkRand,
|
||||||
}
|
}
|
||||||
@ -437,6 +452,7 @@ var sendInvalidWindowPoStCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("serializing params: %w", err)
|
return xerrors.Errorf("serializing params: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("submitting bad PoST for %d paritions\n", len(partitionIndices))
|
||||||
smsg, err := api.MpoolPushMessage(ctx, &types.Message{
|
smsg, err := api.MpoolPushMessage(ctx, &types.Message{
|
||||||
From: minfo.Worker,
|
From: minfo.Worker,
|
||||||
To: maddr,
|
To: maddr,
|
||||||
|
Loading…
Reference in New Issue
Block a user