From 437f5f9fd3118acf453fcb6964254c9fb74d5b53 Mon Sep 17 00:00:00 2001 From: ZenGround0 Date: Fri, 1 Oct 2021 15:04:13 -0400 Subject: [PATCH 1/2] Better logging --- actors/builtin/miner/miner_actor.go | 5 ++++- actors/builtin/power/power_actor.go | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/actors/builtin/miner/miner_actor.go b/actors/builtin/miner/miner_actor.go index 8b1207756..e899ccec1 100644 --- a/actors/builtin/miner/miner_actor.go +++ b/actors/builtin/miner/miner_actor.go @@ -2211,6 +2211,7 @@ func processEarlyTerminations(rt Runtime, rewardSmoothed smoothing.FilterEstimat } // Burn penalty. + rt.Log(rtt.DEBUG, "storage provider %s penalized %d for sector termination", rt.Receiver(), penalty) burnFunds(rt, penalty) // Return pledge. @@ -2262,6 +2263,7 @@ func handleProvingDeadline(rt Runtime, err = st.ApplyPenalty(depositToBurn) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to apply penalty") + rt.Log(rtt.DEBUG, "storage provider %s penalized %d for expired pre commits", rt.Receiver(), depositToBurn) } // Record whether or not we _had_ early terminations in the queue before this method. @@ -2285,6 +2287,7 @@ func handleProvingDeadline(rt Runtime, err = st.ApplyPenalty(penaltyTarget) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to apply penalty") + rt.Log(rtt.DEBUG, "storage provider %s penalized %d for continued fault", rt.Receiver(), penaltyTarget) penaltyFromVesting, penaltyFromBalance, err := st.RepayPartialDebtInPriorityOrder(store, currEpoch, rt.CurrentBalance()) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to unlock penalty") @@ -2660,7 +2663,7 @@ func resolveWorkerAddress(rt Runtime, raw addr.Address) addr.Address { func burnFunds(rt Runtime, amt abi.TokenAmount) { if amt.GreaterThan(big.Zero()) { - rt.Log(rtt.INFO, "burnFunds called with amt=%d attoFIL. receiver address %v", amt, rt.Receiver()) + rt.Log(rtt.DEBUG, "storage provder %s called burnFunds with amt=%d attoFIL", rt.Receiver(), amt) code := rt.Send(builtin.BurntFundsActorAddr, builtin.MethodSend, nil, amt, &builtin.Discard{}) builtin.RequireSuccess(rt, code, "failed to burn funds") } diff --git a/actors/builtin/power/power_actor.go b/actors/builtin/power/power_actor.go index 6a35c0cf0..a2f995c0b 100644 --- a/actors/builtin/power/power_actor.go +++ b/actors/builtin/power/power_actor.go @@ -356,7 +356,7 @@ func (a Actor) processBatchProofVerifies(rt Runtime, rewret reward.ThisEpochRewa rt.StateTransaction(&st, func() { store := adt.AsStore(rt) if st.ProofValidationBatch == nil { - rt.Log(rtt.WARN, "ProofValidationBatch was nil, quitting verification") + rt.Log(rtt.DEBUG, "ProofValidationBatch was nil, quitting verification") return } mmap, err := adt.AsMultimap(store, *st.ProofValidationBatch, builtin.DefaultHamtBitwidth, ProofValidationBatchAmtBitwidth) @@ -499,7 +499,7 @@ func (a Actor) processDeferredCronEvents(rt Runtime, rewret reward.ThisEpochRewa err = events.RemoveAll(epochKey(epoch)) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to clear cron events at %v", epoch) } else { - rt.Log(rtt.INFO, "no epoch events were loaded") + rt.Log(rtt.DEBUG, "no epoch events were loaded") } } @@ -527,10 +527,9 @@ func (a Actor) processDeferredCronEvents(rt Runtime, rewret reward.ThisEpochRewa ) // If a callback fails, this actor continues to invoke other callbacks // and persists state removing the failed event from the event queue. It won't be tried again. - // Failures are unexpected here but will result in removal of miner power - // A log message would really help here. + // Failures are unexpected here but will result in removal of miner power as a defensive measure. if code != exitcode.Ok { - rt.Log(rtt.WARN, "OnDeferredCronEvent failed for miner %s: exitcode %d", event.MinerAddr, code) + rt.Log(rtt.ERROR, "OnDeferredCronEvent failed for miner %s: exitcode %d", event.MinerAddr, code) failedMinerCrons = append(failedMinerCrons, event.MinerAddr) } } From d5e2492e30cbc65759f205083547a26e256ebfde Mon Sep 17 00:00:00 2001 From: ZenGround0 Date: Fri, 1 Oct 2021 15:32:17 -0400 Subject: [PATCH 2/2] Fix directives --- actors/builtin/miner/miner_actor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actors/builtin/miner/miner_actor.go b/actors/builtin/miner/miner_actor.go index e899ccec1..8ba7a35a2 100644 --- a/actors/builtin/miner/miner_actor.go +++ b/actors/builtin/miner/miner_actor.go @@ -2211,7 +2211,7 @@ func processEarlyTerminations(rt Runtime, rewardSmoothed smoothing.FilterEstimat } // Burn penalty. - rt.Log(rtt.DEBUG, "storage provider %s penalized %d for sector termination", rt.Receiver(), penalty) + rt.Log(rtt.DEBUG, "storage provider %s penalized %s for sector termination", rt.Receiver(), penalty) burnFunds(rt, penalty) // Return pledge. @@ -2263,7 +2263,7 @@ func handleProvingDeadline(rt Runtime, err = st.ApplyPenalty(depositToBurn) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to apply penalty") - rt.Log(rtt.DEBUG, "storage provider %s penalized %d for expired pre commits", rt.Receiver(), depositToBurn) + rt.Log(rtt.DEBUG, "storage provider %s penalized %s for expired pre commits", rt.Receiver(), depositToBurn) } // Record whether or not we _had_ early terminations in the queue before this method. @@ -2287,7 +2287,7 @@ func handleProvingDeadline(rt Runtime, err = st.ApplyPenalty(penaltyTarget) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to apply penalty") - rt.Log(rtt.DEBUG, "storage provider %s penalized %d for continued fault", rt.Receiver(), penaltyTarget) + rt.Log(rtt.DEBUG, "storage provider %s penalized %s for continued fault", rt.Receiver(), penaltyTarget) penaltyFromVesting, penaltyFromBalance, err := st.RepayPartialDebtInPriorityOrder(store, currEpoch, rt.CurrentBalance()) builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to unlock penalty") @@ -2663,7 +2663,7 @@ func resolveWorkerAddress(rt Runtime, raw addr.Address) addr.Address { func burnFunds(rt Runtime, amt abi.TokenAmount) { if amt.GreaterThan(big.Zero()) { - rt.Log(rtt.DEBUG, "storage provder %s called burnFunds with amt=%d attoFIL", rt.Receiver(), amt) + rt.Log(rtt.DEBUG, "storage provder %s burning %s", rt.Receiver(), amt) code := rt.Send(builtin.BurntFundsActorAddr, builtin.MethodSend, nil, amt, &builtin.Discard{}) builtin.RequireSuccess(rt, code, "failed to burn funds") }