From ce05e6d6a27c17b538b571fe6bf4a7525b35ac50 Mon Sep 17 00:00:00 2001 From: omer mishael Date: Thu, 22 Jun 2023 23:13:44 +0300 Subject: [PATCH] added prints to chain fetcher fails --- app/app.go | 1 + app/upgrades/empty_upgrades.go | 6 ++++++ protocol/chainlib/chain_fetcher.go | 25 ++++++++++++++++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index 681659aee2..6bf12ef8fb 100644 --- a/app/app.go +++ b/app/app.go @@ -165,6 +165,7 @@ var Upgrades = []upgrades.Upgrade{ upgrades.Upgrade_0_13_1, upgrades.Upgrade_0_14_0, upgrades.Upgrade_0_15_0, + upgrades.Upgrade_0_15_1, } // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals diff --git a/app/upgrades/empty_upgrades.go b/app/upgrades/empty_upgrades.go index cdfa8458b2..2efae35aad 100644 --- a/app/upgrades/empty_upgrades.go +++ b/app/upgrades/empty_upgrades.go @@ -201,3 +201,9 @@ var Upgrade_0_15_0 = Upgrade{ CreateUpgradeHandler: defaultUpgradeHandler, StoreUpgrades: store.StoreUpgrades{}, } + +var Upgrade_0_15_1 = Upgrade{ + UpgradeName: "v0.15.1", + CreateUpgradeHandler: defaultUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/protocol/chainlib/chain_fetcher.go b/protocol/chainlib/chain_fetcher.go index 7a7d981cf6..61a601e568 100644 --- a/protocol/chainlib/chain_fetcher.go +++ b/protocol/chainlib/chain_fetcher.go @@ -43,11 +43,15 @@ func (cf *ChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error) } parserInput, err := cf.formatResponseForParsing(reply, chainMessage) if err != nil { - return spectypes.NOT_APPLICABLE, err + return spectypes.NOT_APPLICABLE, utils.LavaFormatWarning(spectypes.GET_BLOCKNUM+" Failed formatResponseForParsing", err, []utils.Attribute{ + {Key: "nodeUrl", Value: cf.endpoint.UrlsString()}, + {Key: "Method", Value: serviceApi.GetName()}, + {Key: "Response", Value: string(reply.Data)}, + }...) } blockNum, err := parser.ParseBlockFromReply(parserInput, serviceApi.Parsing.ResultParsing) if err != nil { - return spectypes.NOT_APPLICABLE, utils.LavaFormatWarning("Failed To Parse FetchLatestBlockNum", err, []utils.Attribute{ + return spectypes.NOT_APPLICABLE, utils.LavaFormatWarning(spectypes.GET_BLOCKNUM+" Failed to parse Response", err, []utils.Attribute{ {Key: "nodeUrl", Value: cf.endpoint.UrlsString()}, {Key: "Method", Value: serviceApi.GetName()}, {Key: "Response", Value: string(reply.Data)}, @@ -76,10 +80,21 @@ func (cf *ChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) } parserInput, err := cf.formatResponseForParsing(reply, chainMessage) if err != nil { - return "", err + return "", utils.LavaFormatWarning(spectypes.GET_BLOCK_BY_NUM+" Failed formatResponseForParsing", err, []utils.Attribute{ + {Key: "nodeUrl", Value: cf.endpoint.UrlsString()}, + {Key: "Method", Value: serviceApi.GetName()}, + {Key: "Response", Value: string(reply.Data)}, + }...) } - - return parser.ParseMessageResponse(parserInput, serviceApi.Parsing.ResultParsing) + res, err := parser.ParseMessageResponse(parserInput, serviceApi.Parsing.ResultParsing) + if err != nil { + return "", utils.LavaFormatWarning(spectypes.GET_BLOCK_BY_NUM+" Failed ParseMessageResponse", err, []utils.Attribute{ + {Key: "nodeUrl", Value: cf.endpoint.UrlsString()}, + {Key: "Method", Value: serviceApi.GetName()}, + {Key: "Response", Value: string(reply.Data)}, + }...) + } + return res, nil } func (cf *ChainFetcher) formatResponseForParsing(reply *types.RelayReply, chainMessage ChainMessageForSend) (parsable parser.RPCInput, err error) {