Skip to content

Commit

Permalink
don't set address prefixes :P
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Mar 29, 2023
1 parent 4d62242 commit 0353010
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 83 deletions.
29 changes: 2 additions & 27 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ import (
const (
AppName = "interchain-security-cd"
upgradeName = "v07-Theta"
AccountAddressPrefix = "democracy"
AccountAddressPrefix = "cosmos"
)

var (
Expand Down Expand Up @@ -167,32 +167,8 @@ var (
_ simapp.App = (*App)(nil)
_ servertypes.Application = (*App)(nil)
_ ibctesting.TestingApp = (*App)(nil)

Bech32Prefix = "democracy"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format.
// Not sealed yet
func SetAddressPrefixes() {
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
}

// App extends an ABCI application, but with most of its parameters exported.
// They are exported for convenience in creating helper functions, as object
// capabilities aren't needed for testing.
Expand Down Expand Up @@ -242,8 +218,7 @@ type App struct { // nolint: golint
}

func init() {
// Set the address prefixes
SetAddressPrefixes()

userHomeDir, err := os.UserHomeDir()
if err != nil {
stdlog.Println("Failed to get home dir %2", err)
Expand Down
27 changes: 1 addition & 26 deletions app/consumer/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import (
const (
AppName = "interchain-security-c"
upgradeName = "v07-Theta"
AccountAddressPrefix = "consumer"
AccountAddressPrefix = "cosmos"
)

var (
Expand Down Expand Up @@ -130,32 +130,8 @@ var (
_ simapp.App = (*App)(nil)
_ servertypes.Application = (*App)(nil)
_ ibctesting.TestingApp = (*App)(nil)

Bech32Prefix = "consumer"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format.
// Not sealed yet
func SetAddressPrefixes() {
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
}

// App extends an ABCI application, but with most of its parameters exported.
// They are exported for convenience in creating helper functions, as object
// capabilities aren't needed for testing.
Expand Down Expand Up @@ -206,7 +182,6 @@ type App struct { // nolint: golint
}

func init() {
SetAddressPrefixes()
userHomeDir, err := os.UserHomeDir()
if err != nil {
stdlog.Println("Failed to get home dir %2", err)
Expand Down
28 changes: 1 addition & 27 deletions app/provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ import (
const (
AppName = "interchain-security-p"
upgradeName = "v07-Theta"
AccountAddressPrefix = "provider"
AccountAddressPrefix = "cosmos"
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -167,32 +167,8 @@ var (
_ simapp.App = (*App)(nil)
_ servertypes.Application = (*App)(nil)
_ ibctesting.TestingApp = (*App)(nil)

Bech32Prefix = "provider"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format.
// Not sealed yet
func SetAddressPrefixes() {
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
}

// App extends an ABCI application, but with most of its parameters exported.
// They are exported for convenience in creating helper functions, as object
// capabilities aren't needed for testing.
Expand Down Expand Up @@ -245,8 +221,6 @@ type App struct { // nolint: golint
}

func init() {
// set the address prefixes
SetAddressPrefixes()
userHomeDir, err := os.UserHomeDir()
if err != nil {
stdlog.Println("Failed to get home dir %2", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/interchain-security-cd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

rootCmd := &cobra.Command{
Use: version.AppName,
Short: "Kujira Daemon (server)",
Short: "Consumer Daemon (server)",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down
2 changes: 1 addition & 1 deletion cmd/interchain-security-cdd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

rootCmd := &cobra.Command{
Use: version.AppName,
Short: "Kujira Daemon (server)",
Short: "Consumer Daemon (server)",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down
2 changes: 1 addition & 1 deletion cmd/interchain-security-pd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

rootCmd := &cobra.Command{
Use: version.AppName,
Short: "Kujira Daemon (server)",
Short: "Consumer Daemon (server)",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down

0 comments on commit 0353010

Please sign in to comment.