Skip to content

Commit

Permalink
fix Seal value
Browse files Browse the repository at this point in the history
  • Loading branch information
tubackkhoa committed Jan 8, 2023
1 parent 1fba927 commit 3344c8b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
9 changes: 0 additions & 9 deletions module/app/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ func (app *Gravity) assertBech32PrefixMatches(ctx sdk.Context) {
}
configPrefix := config.GetBech32AccountAddrPrefix()
if nativePrefix != configPrefix {
// err := app.bech32IbcKeeper.SetNativeHrp(ctx, configPrefix)
// if err != nil {
// panic(sdkerrors.Wrap(err, "Unable to start, bech32ibc module not initialized to the correct prefix"))
// }
// nativePrefix, err := app.bech32IbcKeeper.GetNativeHrp(ctx)
// if nativePrefix != configPrefix {
// panic(fmt.Sprintf("Mismatched bech32ibc NativeHrp (%v) and config Bech32 Account Prefix (%v)",
// nativePrefix, configPrefix))
// }
panic(fmt.Sprintf("Mismatched bech32ibc NativeHrp (%v) and config Bech32 Account Prefix (%v)",
nativePrefix, configPrefix))
}
Expand Down
3 changes: 0 additions & 3 deletions module/cmd/gravity/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

// prevent changing config
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(appconfig.Bech32PrefixAccAddr, appconfig.Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(appconfig.Bech32PrefixValAddr, appconfig.Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(appconfig.Bech32PrefixConsAddr, appconfig.Bech32PrefixConsPub)
cfg.Seal()

// nolint: exhaustruct
Expand Down
7 changes: 7 additions & 0 deletions module/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ const (
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

func init() {
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
config.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
config.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
}
2 changes: 1 addition & 1 deletion module/x/gravity/keeper/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func SetupTestChain(t *testing.T, weights []uint64, setDelegateAddresses bool) (

func SetupTestConfig() {
initConfig.Do(func() {
// Set config for testing only one
// Set config for testing only one, by overriding default values, then seal it
config := sdk.GetConfig()
config.SetBech32PrefixForAccount("gravity", "gravitypub")
config.SetBech32PrefixForValidator("gravityvaloper", "gravityvaloperpub")
Expand Down

0 comments on commit 3344c8b

Please sign in to comment.