From 92317931c21f775f56ea8d74c1f1ab96e311bbc6 Mon Sep 17 00:00:00 2001 From: MD Aleem <72057206+aleem1314@users.noreply.github.com> Date: Wed, 23 Dec 2020 09:52:53 +0530 Subject: [PATCH] Fix Unregistered interface types.Evidence (#8221) * fix Unregistered interface * add test Co-authored-by: Anil Kumar Kammari --- client/rpc/block.go | 3 ++- client/rpc/rpc_test.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/rpc/block.go b/client/rpc/block.go index c3f80ae22e..d6b79c9fe6 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/types/rest" ) @@ -69,7 +70,7 @@ func getBlock(clientCtx client.Context, height *int64) ([]byte, error) { return nil, err } - return clientCtx.LegacyAmino.MarshalJSON(res) + return legacy.Cdc.MarshalJSON(res) } // get the current blockchain height diff --git a/client/rpc/rpc_test.go b/client/rpc/rpc_test.go index c1c233e73b..adb7dac82d 100644 --- a/client/rpc/rpc_test.go +++ b/client/rpc/rpc_test.go @@ -5,10 +5,13 @@ import ( "testing" "github.com/stretchr/testify/suite" + ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/codec/legacy" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" + "github.com/cosmos/cosmos-sdk/types/rest" ) type IntegrationTestSuite struct { @@ -42,6 +45,17 @@ func (s *IntegrationTestSuite) TestStatusCommand() { s.Require().Contains(out.String(), fmt.Sprintf("\"moniker\":\"%s\"", val0.Moniker)) } +func (s *IntegrationTestSuite) TestLatestBlocks() { + val0 := s.network.Validators[0] + + res, err := rest.GetRequest(fmt.Sprintf("%s/blocks/latest", val0.APIAddress)) + s.Require().NoError(err) + + var result ctypes.ResultBlock + err = legacy.Cdc.UnmarshalJSON(res, &result) + s.Require().NoError(err) +} + func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) }