Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Better logging (#1503)
Browse files Browse the repository at this point in the history
* Better logging
* Fix directives

Co-authored-by: ZenGround0 <ZenGround0@users.noreply.github.com>
  • Loading branch information
ZenGround0 and ZenGround0 authored Oct 1, 2021
1 parent 6f279e6 commit c3afe7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion actors/builtin/miner/miner_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@ func processEarlyTerminations(rt Runtime, rewardSmoothed smoothing.FilterEstimat
}

// Burn penalty.
rt.Log(rtt.DEBUG, "storage provider %s penalized %s for sector termination", rt.Receiver(), penalty)
burnFunds(rt, penalty)

// Return pledge.
Expand Down Expand Up @@ -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 %s for expired pre commits", rt.Receiver(), depositToBurn)
}

// Record whether or not we _had_ early terminations in the queue before this method.
Expand All @@ -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 %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")
Expand Down Expand Up @@ -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 burning %s", rt.Receiver(), amt)
code := rt.Send(builtin.BurntFundsActorAddr, builtin.MethodSend, nil, amt, &builtin.Discard{})
builtin.RequireSuccess(rt, code, "failed to burn funds")
}
Expand Down
9 changes: 4 additions & 5 deletions actors/builtin/power/power_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit c3afe7f

Please sign in to comment.