From 668b24fb23bad33652e11e51f5f92f5d8dd7443c Mon Sep 17 00:00:00 2001 From: beck <1504068285@qq.com> Date: Sat, 4 Mar 2023 15:00:44 +0800 Subject: [PATCH 1/2] make debugging windowPoSt-failures human readable --- cmd/lotus-miner/proving.go | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/cmd/lotus-miner/proving.go b/cmd/lotus-miner/proving.go index 9ae8bdd48..9cc7105ee 100644 --- a/cmd/lotus-miner/proving.go +++ b/cmd/lotus-miner/proving.go @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" @@ -640,7 +641,42 @@ It will not send any messages to the chain.`, if err != nil { return err } - jr, err := json.Marshal(res) + + //convert sector information into easily readable information + type PoStPartition struct { + Index uint64 + Skipped []uint64 + } + type SubmitWindowedPoStParams struct { + Deadline uint64 + Partitions []PoStPartition + Proofs []proof.PoStProof + ChainCommitEpoch abi.ChainEpoch + ChainCommitRand abi.Randomness + } + var postParams []SubmitWindowedPoStParams + for _, i := range res { + var postParam SubmitWindowedPoStParams + postParam.Deadline = i.Deadline + for id, part := range i.Partitions { + postParam.Partitions[id].Index = part.Index + count, err := part.Skipped.Count() + if err != nil { + return err + } + sectors, err := part.Skipped.All(count) + if err != nil { + return err + } + postParam.Partitions[id].Skipped = sectors + } + postParam.Proofs = i.Proofs + postParam.ChainCommitEpoch = i.ChainCommitEpoch + postParam.ChainCommitRand = i.ChainCommitRand + postParams = append(postParams, postParam) + } + + jr, err := json.Marshal(postParams) if err != nil { return err } From f0ba0ebb642d701e7067e5a4c55add28a6f64abd Mon Sep 17 00:00:00 2001 From: beck <1504068285@qq.com> Date: Mon, 6 Mar 2023 18:04:55 +0800 Subject: [PATCH 2/2] indent output --- cmd/lotus-miner/proving.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/lotus-miner/proving.go b/cmd/lotus-miner/proving.go index 9cc7105ee..d58ed1250 100644 --- a/cmd/lotus-miner/proving.go +++ b/cmd/lotus-miner/proving.go @@ -676,7 +676,7 @@ It will not send any messages to the chain.`, postParams = append(postParams, postParam) } - jr, err := json.Marshal(postParams) + jr, err := json.MarshalIndent(postParams, "", " ") if err != nil { return err }