Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename config ChainName to ChainType #24

Merged
merged 3 commits into from
Aug 13, 2024
Merged
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
14 changes: 7 additions & 7 deletions clientcontroller/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
)

const (
BabylonConsumerChainName = "babylon"
OPStackL2ConsumerChainName = "OPStackL2"
WasmConsumerChainName = "wasm"
BabylonConsumerChainType = "babylon"
OPStackL2ConsumerChainType = "OPStackL2"
WasmConsumerChainType = "wasm"
bap2pecs marked this conversation as resolved.
Show resolved Hide resolved
)

// NewClientController TODO: this is always going to be babylon so rename accordingly
Expand All @@ -34,18 +34,18 @@ func NewConsumerController(config *fpcfg.Config, logger *zap.Logger) (api.Consum
err error
)

switch config.ChainName {
case BabylonConsumerChainName:
switch config.ChainType {
case BabylonConsumerChainType:
ccc, err = babylon.NewBabylonConsumerController(config.BabylonConfig, &config.BTCNetParams, logger)
if err != nil {
return nil, fmt.Errorf("failed to create Babylon rpc client: %w", err)
}
case OPStackL2ConsumerChainName:
case OPStackL2ConsumerChainType:
ccc, err = opstackl2.NewOPStackL2ConsumerController(config.OPStackL2Config, logger)
if err != nil {
return nil, fmt.Errorf("failed to create OPStack L2 consumer client: %w", err)
}
case WasmConsumerChainName:
case WasmConsumerChainType:
wasmEncodingCfg := cosmwasmcfg.GetWasmdEncodingConfig()
ccc, err = cosmwasm.NewCosmwasmConsumerController(config.CosmwasmConfig, wasmEncodingCfg, logger)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions finality-provider/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const (
defaultChainName = "babylon"
defaultChainType = "babylon"
defaultLogLevel = zapcore.InfoLevel
defaultLogDirname = "logs"
defaultLogFilename = "fpd.log"
Expand Down Expand Up @@ -55,7 +55,7 @@ var (
// Config is the main config for the fpd cli command
type Config struct {
LogLevel string `long:"loglevel" description:"Logging level for all subsystems" choice:"trace" choice:"debug" choice:"info" choice:"warn" choice:"error" choice:"fatal"`
ChainName string `long:"chainname" description:"the name of the consumer chain"`
ChainType string `long:"chaintype" description:"the type of the consumer chain (babylon/OPStackL2/wasm)"`
NumPubRand uint64 `long:"numPubRand" description:"The number of Schnorr public randomness for each commitment"`
NumPubRandMax uint64 `long:"numpubrandmax" description:"The upper bound of the number of Schnorr public randomness for each commitment"`
MinRandHeightGap uint64 `long:"minrandheightgap" description:"The minimum gap between the last committed rand height and the current Babylon block height"`
Expand Down Expand Up @@ -94,7 +94,7 @@ func DefaultConfigWithHome(homePath string) Config {
bbnCfg.KeyDirectory = homePath
pollerCfg := DefaultChainPollerConfig()
cfg := Config{
ChainName: defaultChainName,
ChainType: defaultChainType,
LogLevel: defaultLogLevel.String(),
DatabaseConfig: DefaultDBConfigWithHomePath(homePath),
BabylonConfig: &bbnCfg,
Expand Down
2 changes: 1 addition & 1 deletion finality-provider/service/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewFinalityProviderAppFromConfig(
}
consumerCon, err := fpcc.NewConsumerController(cfg, logger)
if err != nil {
return nil, fmt.Errorf("failed to create rpc client for the consumer chain %s: %v", cfg.ChainName, err)
return nil, fmt.Errorf("failed to create rpc client for the consumer chain %s: %v", cfg.ChainType, err)
}
// if the EOTSManagerAddress is empty, run a local EOTS manager;
// otherwise connect a remote one with a gRPC client
Expand Down
2 changes: 1 addition & 1 deletion itest/cosmwasm/bcd/bcd_test_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func StartBcdTestManager(t *testing.T) *BcdTestManager {
cfg.CosmwasmConfig.KeyDirectory = wh.dataDir
// make random contract address for now to avoid validation errors, later we will update it with the correct address in the test
cfg.CosmwasmConfig.BtcStakingContractAddress = datagen.GenRandomAccount().GetAddress().String()
cfg.ChainName = fpcc.WasmConsumerChainName
cfg.ChainType = fpcc.WasmConsumerChainType
cfg.CosmwasmConfig.AccountPrefix = "bbnc"
cfg.CosmwasmConfig.ChainID = bcdChainID
cfg.CosmwasmConfig.RPCAddr = fmt.Sprintf("http://localhost:%d", bcdRpcPort)
Expand Down
2 changes: 1 addition & 1 deletion itest/cosmwasm/wasmd/wasmd_test_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func StartWasmdTestManager(t *testing.T) *WasmdTestManager {
// later in the e2e tests we would upload the contract and update the addresses
// investigate if there is a better way to handle this
cfg.CosmwasmConfig.BtcStakingContractAddress = datagen.GenRandomAccount().GetAddress().String()
cfg.ChainName = fpcc.WasmConsumerChainName
cfg.ChainType = fpcc.WasmConsumerChainType
cfg.CosmwasmConfig.AccountPrefix = "wasm"
cfg.CosmwasmConfig.ChainID = wasmdChainID
tempApp := wasmapp.NewWasmApp(sdklogs.NewNopLogger(), dbm.NewMemDB(), nil, false, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), []wasmkeeper.Option{})
Expand Down
Loading