From 9f0a70845e5c83dfb0d4e9057c2095769dccbeb8 Mon Sep 17 00:00:00 2001 From: Eduard Voiculescu Date: Thu, 8 Aug 2024 19:18:05 -0400 Subject: [PATCH] fix tool --- injective/cmd/fireinjective/tools_fix_unknown_type_blocks.go | 4 ++-- injective/conversion.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/injective/cmd/fireinjective/tools_fix_unknown_type_blocks.go b/injective/cmd/fireinjective/tools_fix_unknown_type_blocks.go index 351a71b..d6acb3c 100644 --- a/injective/cmd/fireinjective/tools_fix_unknown_type_blocks.go +++ b/injective/cmd/fireinjective/tools_fix_unknown_type_blocks.go @@ -15,9 +15,9 @@ import ( "github.com/streamingfast/dstore" firecore "github.com/streamingfast/firehose-core" pbcosmos "github.com/streamingfast/firehose-cosmos/cosmos/pb/sf/cosmos/type/v2" + "github.com/streamingfast/firehose-cosmos/injective" "github.com/streamingfast/logging" "go.uber.org/zap" - proto "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" ) @@ -105,7 +105,7 @@ func fixUnknownTypeBlocksRunE(zlog *zap.Logger, tracer logging.Tracer) firecore. blockCount++ injectiveBlock := &pbcosmos.Block{} - err = proto.Unmarshal(currentBlock.Payload.Value, injectiveBlock) + err = injective.UnmarshallerDiscardUnknown.Unmarshal(currentBlock.Payload.Value, injectiveBlock) if err != nil { return fmt.Errorf("unmarshaling block: %w", err) } diff --git a/injective/conversion.go b/injective/conversion.go index fc73ff9..14c6f26 100644 --- a/injective/conversion.go +++ b/injective/conversion.go @@ -14,7 +14,7 @@ import ( "google.golang.org/protobuf/proto" ) -var unmarshallerDiscardUnknown = &proto.UnmarshalOptions{ +var UnmarshallerDiscardUnknown = &proto.UnmarshalOptions{ DiscardUnknown: true, } @@ -54,7 +54,7 @@ func protoFlip(origin cosmoProto.Message, target proto.Message) error { return fmt.Errorf("mashalling origin object %T: %w", data, err) } - err = unmarshallerDiscardUnknown.Unmarshal(data, target) + err = UnmarshallerDiscardUnknown.Unmarshal(data, target) if err != nil { if e, ok := origin.(*abci.ResponseDeliverTx); ok { fmt.Println("event data:", hex.EncodeToString(data))