From 59fe9455367050371ea44b170492e8d8ff321ba1 Mon Sep 17 00:00:00 2001 From: Ran Mishael Date: Sun, 22 Dec 2024 18:34:51 +0100 Subject: [PATCH 1/2] fix: PRT - fixing rest APIs that require event parsing such as txs returning HTML body. --- protocol/chainlib/rest.go | 10 ++++++---- scripts/pre_setups/init_lava_only_with_node.sh | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/protocol/chainlib/rest.go b/protocol/chainlib/rest.go index c8d6513964..4d6b722cc4 100644 --- a/protocol/chainlib/rest.go +++ b/protocol/chainlib/rest.go @@ -578,10 +578,12 @@ func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, }, } - // checking if rest reply data is in json format - err = rcp.HandleJSONFormatError(reply.RelayReply.Data) - if err != nil { - return nil, "", nil, utils.LavaFormatError("Rest reply is neither a JSON object nor a JSON array of objects", nil, utils.Attribute{Key: "reply.Data", Value: string(reply.RelayReply.Data)}) + if strings.Split(nodeMessage.Path, "?")[0] != "/" { + // // checking if rest reply data is in json format + err = rcp.HandleJSONFormatError(reply.RelayReply.Data) + if err != nil { + return nil, "", nil, utils.LavaFormatError("Rest reply is neither a JSON object nor a JSON array of objects", nil, utils.Attribute{Key: "reply.Data", Value: string(reply.RelayReply.Data)}) + } } return reply, "", nil, nil diff --git a/scripts/pre_setups/init_lava_only_with_node.sh b/scripts/pre_setups/init_lava_only_with_node.sh index 580e06df63..5c50b95452 100755 --- a/scripts/pre_setups/init_lava_only_with_node.sh +++ b/scripts/pre_setups/init_lava_only_with_node.sh @@ -52,13 +52,13 @@ screen -d -m -S provider1 bash -c "source ~/.bashrc; lavap rpcprovider \ $PROVIDER1_LISTENER LAV1 rest '$LAVA_REST' \ $PROVIDER1_LISTENER LAV1 tendermintrpc '$LAVA_RPC,$LAVA_RPC_WS' \ $PROVIDER1_LISTENER LAV1 grpc '$LAVA_GRPC' \ -$EXTRA_PROVIDER_FLAGS --geolocation 1 --log_level trace --from servicer1 --chain-id lava --metrics-listen-address ":7776" 2>&1 | tee $LOGS_DIR/PROVIDER1.log" && sleep 0.25 +$EXTRA_PROVIDER_FLAGS --geolocation 1 --log_level debug --from servicer1 --chain-id lava --metrics-listen-address ":7776" 2>&1 | tee $LOGS_DIR/PROVIDER1.log" && sleep 0.25 wait_next_block screen -d -m -S consumers bash -c "source ~/.bashrc; lavap rpcconsumer \ 127.0.0.1:3360 LAV1 rest 127.0.0.1:3361 LAV1 tendermintrpc 127.0.0.1:3362 LAV1 grpc \ -$EXTRA_PORTAL_FLAGS --geolocation 1 --optimizer-qos-listen --log_level trace --from user1 --chain-id lava --add-api-method-metrics --limit-parallel-websocket-connections-per-ip 1 --allow-insecure-provider-dialing --metrics-listen-address ":7779" 2>&1 | tee $LOGS_DIR/CONSUMERS.log" && sleep 0.25 +$EXTRA_PORTAL_FLAGS --geolocation 1 --optimizer-qos-listen --log_level debug --from user1 --chain-id lava --add-api-method-metrics --limit-parallel-websocket-connections-per-ip 1 --allow-insecure-provider-dialing --metrics-listen-address ":7779" 2>&1 | tee $LOGS_DIR/CONSUMERS.log" && sleep 0.25 echo "--- setting up screens done ---" screen -ls \ No newline at end of file From b64380bcd24b27a3bd979ad4aed0982813afbfce Mon Sep 17 00:00:00 2001 From: Elad Gildnur Date: Sun, 22 Dec 2024 21:24:12 +0200 Subject: [PATCH 2/2] Tiny fix --- protocol/chainlib/rest.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/chainlib/rest.go b/protocol/chainlib/rest.go index 4d6b722cc4..f9fa524106 100644 --- a/protocol/chainlib/rest.go +++ b/protocol/chainlib/rest.go @@ -579,7 +579,7 @@ func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, } if strings.Split(nodeMessage.Path, "?")[0] != "/" { - // // checking if rest reply data is in json format + // checking if rest reply data is in json format err = rcp.HandleJSONFormatError(reply.RelayReply.Data) if err != nil { return nil, "", nil, utils.LavaFormatError("Rest reply is neither a JSON object nor a JSON array of objects", nil, utils.Attribute{Key: "reply.Data", Value: string(reply.RelayReply.Data)})