diff --git a/go.mod b/go.mod index 959206ff52..be61fab128 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 7cc3d062f6..08cf5a5b47 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/service/state/core_access_test.go b/service/state/core_access_test.go new file mode 100644 index 0000000000..bf761fe5f8 --- /dev/null +++ b/service/state/core_access_test.go @@ -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) +} +