Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions chains/tendermint/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ func (c *Chain) Path() *core.PathEnd {
}

func (c *Chain) Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error {
keybase, err := keys.New(c.config.ChainId, "test", keysDir(homePath, c.config.ChainId), nil, codec)
keybase, err := keys.New(
c.config.TmChainId,
c.config.KeyringBackend,
keysDir(homePath, c.config.TmChainId),
nil,
codec,
)
if err != nil {
return err
}
Expand Down Expand Up @@ -515,7 +521,7 @@ func (c *Chain) CLIContext(height int64) sdkCtx.Context {
txConfig := authtx.NewTxConfig(c.codec, authtx.DefaultSignModes)
unlock()
return sdkCtx.Context{}.
WithChainID(c.config.ChainId).
WithChainID(c.config.TmChainId).
WithCodec(c.codec).
WithInterfaceRegistry(c.codec.InterfaceRegistry()).
WithTxConfig(txConfig).
Expand All @@ -539,7 +545,7 @@ func (c *Chain) TxFactory(height int64) tx.Factory {
ctx := c.CLIContext(height)
return tx.Factory{}.
WithAccountRetriever(ctx.AccountRetriever).
WithChainID(c.config.ChainId).
WithChainID(c.config.TmChainId).
WithTxConfig(ctx.TxConfig).
WithGasAdjustment(c.config.GasAdjustment).
WithGasPrices(c.config.GasPrices).
Expand Down
15 changes: 9 additions & 6 deletions chains/tendermint/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/hyperledger-labs/yui-relayer/chains/tendermint"
"github.com/hyperledger-labs/yui-relayer/core"
"github.com/spf13/cobra"
Expand All @@ -30,12 +31,14 @@ func generateChainConfigCmd(m codec.Codec) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) (err error) {
// TODO make it configurable
c := tendermint.ChainConfig{
Key: "testkey",
ChainId: args[0],
RpcAddr: "http://localhost:26557",
AccountPrefix: "cosmos",
GasAdjustment: 1.5,
GasPrices: "0.025stake",
KeyringBackend: keyring.BackendTest,
Key: "testkey",
ChainId: args[0],
TmChainId: args[0],
RpcAddr: "http://localhost:26557",
AccountPrefix: "cosmos",
GasAdjustment: 1.5,
GasPrices: "0.025stake",
}
p := tendermint.ProverConfig{
TrustingPeriod: "336h",
Expand Down
14 changes: 14 additions & 0 deletions chains/tendermint/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"time"

"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/hyperledger-labs/yui-relayer/core"
)

Expand All @@ -23,12 +24,25 @@ func (c ChainConfig) Validate() error {
}

var errs []error
switch c.KeyringBackend {
case keyring.BackendFile:
case keyring.BackendOS:
case keyring.BackendKWallet:
case keyring.BackendPass:
case keyring.BackendTest:
case keyring.BackendMemory:
default:
errs = append(errs, fmt.Errorf("config attribute \"keyring_backend\" is unexpected: %s", c.KeyringBackend))
}
if isEmpty(c.Key) {
errs = append(errs, fmt.Errorf("config attribute \"key\" is empty"))
}
if isEmpty(c.ChainId) {
errs = append(errs, fmt.Errorf("config attribute \"chain_id\" is empty"))
}
if isEmpty(c.TmChainId) {
errs = append(errs, fmt.Errorf("config attribute \"tm_chain_id\" is empty"))
}
if isEmpty(c.RpcAddr) {
errs = append(errs, fmt.Errorf("config attribute \"rpc_addr\" is empty"))
}
Expand Down
Loading