diff --git a/CHANGELOG.md b/CHANGELOG.md index fb5b943dec..ce2e2b5d3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * In the `OrderFeeCalc` query, ensure the market exists [#1699](https://github.com/provenance-io/provenance/issues/1699). * Add publishing of docker arm64 container builds [#1634](https://github.com/provenance-io/provenance/issues/1634) * Add upgrade handler to set net asset values to markers [PR 1712](https://github.com/provenance-io/provenance/pull/1712). +* Add additional logging to trigger module [#1718](https://github.com/provenance-io/provenance/issues/1718). ### Bug Fixes diff --git a/x/trigger/keeper/event_detector.go b/x/trigger/keeper/event_detector.go index ef033a2d1e..0d64b5fdf9 100644 --- a/x/trigger/keeper/event_detector.go +++ b/x/trigger/keeper/event_detector.go @@ -15,6 +15,7 @@ func (k Keeper) DetectBlockEvents(ctx sdk.Context) { triggers = append(triggers, k.detectTimeEvents(ctx)...) for _, trigger := range triggers { + k.Logger(ctx).Debug(fmt.Sprintf("Trigger %d added to queue", trigger.Id)) k.UnregisterTrigger(ctx, trigger) k.QueueTrigger(ctx, trigger) } @@ -77,6 +78,7 @@ func (k Keeper) getMatchingTriggersUntil(ctx sdk.Context, prefix string, match f err := k.IterateEventListeners(ctx, prefix, func(trigger types.Trigger) (stop bool, err error) { event, _ := trigger.GetTriggerEventI() if match(trigger, event) { + k.Logger(ctx).Debug(fmt.Sprintf("Event detected for trigger %d", trigger.Id)) triggers = append(triggers, trigger) } return terminator(trigger, event), nil diff --git a/x/trigger/keeper/trigger_dispatcher.go b/x/trigger/keeper/trigger_dispatcher.go index ed5e9fff78..1163d85037 100644 --- a/x/trigger/keeper/trigger_dispatcher.go +++ b/x/trigger/keeper/trigger_dispatcher.go @@ -24,8 +24,10 @@ func (k Keeper) ProcessTriggers(ctx sdk.Context) { item := k.QueuePeek(ctx) triggerID := item.GetTrigger().Id gasLimit := k.GetGasLimit(ctx, triggerID) + k.Logger(ctx).Debug(fmt.Sprintf("Processing trigger %d with gas limit %d", triggerID, gasLimit)) if gasLimit+gasConsumed > MaximumQueueGas { + k.Logger(ctx).Debug(fmt.Sprintf("Exceeded MaximumQueueGas %d/%d skipping...", gasLimit+gasConsumed, MaximumQueueGas)) return } actionsProcessed++ @@ -79,6 +81,7 @@ func (k Keeper) handleMsgs(ctx sdk.Context, msgs []sdk.Msg) ([]sdk.Result, error if handler == nil { return nil, fmt.Errorf("no message handler found for message %s at position %d", sdk.MsgTypeURL(msg), i) } + k.Logger(ctx).Debug(fmt.Sprintf("Executing %s at position %d", sdk.MsgTypeURL(msg), i)) r, err := k.safeHandle(ctx, msg, handler) if err != nil { return nil, fmt.Errorf("error processing message %s at position %d: %w", sdk.MsgTypeURL(msg), i, err) @@ -87,6 +90,7 @@ func (k Keeper) handleMsgs(ctx sdk.Context, msgs []sdk.Msg) ([]sdk.Result, error if r == nil { return nil, fmt.Errorf("got nil sdk.Result for message %s at position %d", sdk.MsgTypeURL(msg), i) } + k.Logger(ctx).Debug(fmt.Sprintf("Successfully executed %s at position %d", sdk.MsgTypeURL(msg), i)) results[i] = *r }