Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: test filterer #66

Merged
merged 4 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pkg/filterer/filterer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func (f *Filterer) GetReportableForReporters(
reportableFiltered := f.FilterForChainAndSubscription(
report.Reportable,
chain,
subscription,
chainSubscription,
)

Expand Down Expand Up @@ -84,7 +83,6 @@ func (f *Filterer) GetReportableForReporters(
func (f *Filterer) FilterForChainAndSubscription(
reportable types.Reportable,
chain *configTypes.Chain,
subscription *configTypes.Subscription,
chainSubscription *configTypes.ChainSubscription,
) types.Reportable {
// Filtering out TxError only if chain's log-node-errors = true.
Expand Down Expand Up @@ -141,7 +139,7 @@ func (f *Filterer) FilterForChainAndSubscription(

txHeight, err := strconv.ParseInt(tx.Height.Value, 10, 64)
if err != nil {
f.Logger.Fatal().Err(err).Msg("Error converting height to int64")
f.Logger.Panic().Err(err).Msg("Error converting height to int64")
}

chainLastBlockHeight, ok := f.lastBlockHeights[chain.Name]
Expand All @@ -162,7 +160,7 @@ func (f *Filterer) FilterForChainAndSubscription(
messages := make([]types.Message, 0)

for _, message := range tx.Messages {
filteredMessage := f.FilterMessage(message, subscription, chainSubscription, false)
filteredMessage := f.FilterMessage(message, chainSubscription, false)
if filteredMessage != nil {
messages = append(messages, filteredMessage)
}
Expand All @@ -186,7 +184,6 @@ func (f *Filterer) FilterForChainAndSubscription(

func (f *Filterer) FilterMessage(
message types.Message,
subscription *configTypes.Subscription,
chainSubscription *configTypes.ChainSubscription,
internal bool,
) types.Message {
Expand Down Expand Up @@ -238,15 +235,15 @@ func (f *Filterer) FilterMessage(
}
}

if len(message.GetRawMessages()) == 0 {
if len(message.GetParsedMessages()) == 0 {
return message
}

parsedInternalMessages := make([]types.Message, 0)

// Processing internal messages (such as ones in MsgExec)
for _, internalMessage := range message.GetParsedMessages() {
if internalMessageParsed := f.FilterMessage(internalMessage, subscription, chainSubscription, true); internalMessageParsed != nil {
if internalMessageParsed := f.FilterMessage(internalMessage, chainSubscription, true); internalMessageParsed != nil {
parsedInternalMessages = append(parsedInternalMessages, internalMessageParsed)
}
}
Expand Down
Loading
Loading