From 9ffef0d6de6797c1f68ebd7b8847e40eafbc4e90 Mon Sep 17 00:00:00 2001 From: danb Date: Fri, 18 Aug 2023 13:39:47 -0400 Subject: [PATCH] adding debug info --- relayer/processor/path_processor_internal.go | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/relayer/processor/path_processor_internal.go b/relayer/processor/path_processor_internal.go index c9f3c5710..1f8ef40d4 100644 --- a/relayer/processor/path_processor_internal.go +++ b/relayer/processor/path_processor_internal.go @@ -1457,6 +1457,10 @@ func (pp *PathProcessor) flush(ctx context.Context) error { return fmt.Errorf("failed to query packet commitments: %w", err) } + // Debug: Print the commitments maps + fmt.Println("Commitments1:", commitments1) + fmt.Println("Commitments2:", commitments2) + // From remaining packet commitments, determine if: // 1. Packet commitment is on source, but MsgRecvPacket has not yet been relayed to destination // 2. Packet commitment is on source, and MsgRecvPacket has been relayed to destination, but MsgAcknowledgement has not been written to source to clear the packet commitment. @@ -1502,6 +1506,9 @@ func (pp *PathProcessor) flush(ctx context.Context) error { return fmt.Errorf("failed to enqueue pending messages for flush: %w", err) } + // Debug: Print the skipped map + fmt.Println("Skipped:", skipped) + pp.pathEnd1.mergeMessageCache(pathEnd1Cache, pp.pathEnd2.info.ChainID, pp.pathEnd2.inSync) pp.pathEnd2.mergeMessageCache(pathEnd2Cache, pp.pathEnd1.info.ChainID, pp.pathEnd1.inSync) @@ -1548,7 +1555,29 @@ func (pp *PathProcessor) flush(ctx context.Context) error { } // hard code test if metric is exposed. - pp.metrics.SetUnrelayedPackets("mainnet-kujira-kava", "kujira", "noble", []uint64{1, 2, 3}, []uint64{0}, totalUnrelayed) + // pp.metrics.SetUnrelayedPackets("mainnet-kujira-kava", "kujira", "noble", []uint64{1, 2, 3}, []uint64{0}, totalUnrelayed) + + // Real test + // Construct pathName from the two chain IDs + pathName := fmt.Sprintf("%s-%s", pp.pathEnd1.info.ChainID, pp.pathEnd2.info.ChainID) + + // Extract sequences from skipped packets + var srcSequences, dstSequences []uint64 + for chainID, chainSkipped := range skipped { + for channelKey, _ := range chainSkipped { + if chainID == pp.pathEnd1.info.ChainID { + srcSequences = append(srcSequences, commitments1[channelKey]...) + } else { + dstSequences = append(dstSequences, commitments2[channelKey]...) + } + } + } + + // Debug: Print the extracted sequences + fmt.Println("SrcSequences:", srcSequences) + fmt.Println("DstSequences:", dstSequences) + + pp.metrics.SetUnrelayedPackets(pathName, pp.pathEnd1.info.ChainID, pp.pathEnd2.info.ChainID, srcSequences, dstSequences, totalUnrelayed) return nil }