Skip to content

Commit

Permalink
read genesis app version
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Mar 20, 2024
1 parent 9f359db commit 6684915
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/e2e/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func TestE2ESimple(t *testing.T) {
err = txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...)
require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error())

expectedAppVersion, err := testnode.ReadAppVersion(context.Background(),
testnet.Node(0).AddressRPC())
expectedAppVersion, err := testnode.ReadAppVersionFromGenesis(context.Background(),
testnet.Node(1).AddressRPC())
require.NoError(t, err)

blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC())
Expand Down
12 changes: 12 additions & 0 deletions test/util/testnode/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ func ReadAppVersion(ctx context.Context, rpcAddress string) (uint64, error) {
return resp.Response.AppVersion, nil
}

func ReadAppVersionFromGenesis(ctx context.Context, rpcAddress string) (uint64, error) {
client, err := http.New(rpcAddress, "/genesis")
if err != nil {
return 0, err
}
resp, err := client.Genesis(ctx)
if err != nil {
return 0, err
}
return resp.Genesis.ConsensusParams.Version.AppVersion, nil
}

func ReadBlockHeights(ctx context.Context, rpcAddress string, fromHeight, toHeight int64) ([]*types.Block, error) {
client, err := http.New(rpcAddress, "/websocket")
if err != nil {
Expand Down

0 comments on commit 6684915

Please sign in to comment.