Skip to content

Commit

Permalink
test: failing due to cel-app panic with InitChain
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Feb 25, 2022
1 parent f688557 commit b459ca3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/ipfs/go-verifcid => github.com/celestiaorg/go-verifcid v0.0.1

require (
github.com/BurntSushi/toml v1.0.0
github.com/celestiaorg/celestia-app v0.0.2-0.20220207122156-63519eccc053
github.com/celestiaorg/celestia-app v0.0.2-0.20220214170311-cfe3ecf30837
github.com/celestiaorg/go-libp2p-messenger v0.1.0
github.com/celestiaorg/nmt v0.8.0
github.com/celestiaorg/rsmt2d v0.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/celestia-app v0.0.2-0.20220207122156-63519eccc053 h1:09Nsr3WykIE4zBBpGVAFx+s642+kRocsqbCx7sK/CjA=
github.com/celestiaorg/celestia-app v0.0.2-0.20220207122156-63519eccc053/go.mod h1:rOXjz9htUTu2ihWG8o96uXZzQavfpnZxuVfdzYfx7L4=
github.com/celestiaorg/celestia-app v0.0.2-0.20220214170311-cfe3ecf30837 h1:Gh30XfMaxAz3IsswEP7XBqcRGE9s1NOlfG/BfghgWok=
github.com/celestiaorg/celestia-app v0.0.2-0.20220214170311-cfe3ecf30837/go.mod h1:rOXjz9htUTu2ihWG8o96uXZzQavfpnZxuVfdzYfx7L4=
github.com/celestiaorg/celestia-core v0.34.14-celestia.0.20220119223021-e54097114e14 h1:PiiLrn/eNV++ByjxRo6o8M62aNvVc786AL4Bl3vCpd0=
github.com/celestiaorg/celestia-core v0.34.14-celestia.0.20220119223021-e54097114e14/go.mod h1:3n9kP3esPVYeAXMW/QSLALhMtraZInoTD5rcjteFpVQ=
github.com/celestiaorg/cosmos-sdk v0.44.1-celestia h1:WbNV1I4L7oudA38lZ+7ILnWElfDIbdZdNp3jHBvIXgU=
Expand Down
45 changes: 45 additions & 0 deletions service/state/core_access_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package state

import (
"context"
"fmt"
"github.com/celestiaorg/celestia-app/app"
apptypes "github.com/celestiaorg/celestia-app/x/payment/types"
"github.com/celestiaorg/celestia-node/core"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/stretchr/testify/require"
"github.com/tendermint/spm/cosmoscmd"
"os"
"testing"

apputil "github.com/celestiaorg/celestia-app/testutil"
)

func TestCoreAccess(t *testing.T) {
// create signer + acct
dir := t.TempDir()
ring, err := keyring.New("celestia", "test", dir, os.Stdin)
require.NoError(t, err)
acc, err := ring.NewAccount("something", testutil.TestMnemonic, "", "", hd.Secp256k1)
require.NoError(t, err)
signer := apptypes.NewKeyringSigner(ring, acc.GetName(), "test")
// make encoding config
encCfg := cosmoscmd.MakeEncodingConfig(app.ModuleBasics)

// create app and start core node
celapp := apputil.SetupTestApp(t, acc.GetAddress())
nd := core.StartMockNode(celapp)
defer nd.Stop() //nolint:errcheck
_, ip := core.GetRemoteEndpoint(nd)
grpcEndpoint := fmt.Sprintf("%s:9090", ip)

// create CoreAccess with the grpc endpoint to mock core node
ca, err := NewCoreAccessor(signer, encCfg, grpcEndpoint)
require.NoError(t, err)
bal, err := ca.Balance(context.Background())
require.NoError(t, err)
t.Log("BAL: ", bal)
}

0 comments on commit b459ca3

Please sign in to comment.