Skip to content

Commit

Permalink
use singleton boolean as feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Sep 4, 2024
1 parent b00a4af commit 6e06a7d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 76 deletions.
6 changes: 0 additions & 6 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8403,8 +8403,6 @@ paths:
an unrelayed

IBC packet becomes timeout, measured in seconds
enable_integration:
type: boolean
description: >-
QueryParamsResponse is the response type for the Query/Params RPC
method.
Expand Down Expand Up @@ -12192,8 +12190,6 @@ definitions:
unrelayed

IBC packet becomes timeout, measured in seconds
enable_integration:
type: boolean
description: Params defines the parameters for the module.
babylon.zoneconcierge.v1.ProofEpochSealed:
type: object
Expand Down Expand Up @@ -14195,8 +14191,6 @@ definitions:
unrelayed

IBC packet becomes timeout, measured in seconds
enable_integration:
type: boolean
description: QueryParamsResponse is the response type for the Query/Params RPC method.
tendermint.crypto.ProofOp:
type: object
Expand Down
3 changes: 0 additions & 3 deletions proto/babylon/zoneconcierge/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ message Params {
// IBC packet becomes timeout, measured in seconds
uint32 ibc_packet_timeout_seconds = 1
[ (gogoproto.moretags) = "yaml:\"ibc_packet_timeout_seconds\"" ];

bool enable_integration = 2
[ (gogoproto.moretags) = "yaml:\"enable_integration\"" ];
}
2 changes: 1 addition & 1 deletion x/zoneconcierge/keeper/header_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// HandleHeaderWithValidCommit handles a CZ header with a valid QC
func (k Keeper) HandleHeaderWithValidCommit(ctx context.Context, txHash []byte, header *types.HeaderInfo, isOnFork bool) {
// if integration is not enabled, do not process headers
if !k.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return
}

Expand Down
6 changes: 3 additions & 3 deletions x/zoneconcierge/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (k Keeper) Hooks() Hooks { return Hooks{k} }
func (h Hooks) AfterEpochEnds(ctx context.Context, epoch uint64) {
// if integration is not enabled, do not trigger hooks
// NOTE: might not be needed, since the post handler is disabled
if !h.k.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return
}

Expand All @@ -37,7 +37,7 @@ func (h Hooks) AfterEpochEnds(ctx context.Context, epoch uint64) {
func (h Hooks) AfterRawCheckpointSealed(ctx context.Context, epoch uint64) error {
// if integration is not enabled, do not trigger hooks
// NOTE: might not be needed, since the proofs do not depend on consumer chains
if !h.k.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return nil
}

Expand All @@ -51,7 +51,7 @@ func (h Hooks) AfterRawCheckpointSealed(ctx context.Context, epoch uint64) error
// AfterRawCheckpointFinalized is triggered upon an epoch has been finalised
func (h Hooks) AfterRawCheckpointFinalized(ctx context.Context, epoch uint64) error {
// if integration is not enabled, do not trigger hooks
if !h.k.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions x/zoneconcierge/module_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (im IBCModule) OnChanOpenInit(
counterparty channeltypes.Counterparty,
version string,
) (string, error) {
if !im.keeper.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return "", types.ErrIntegrationDisabled
}

Expand Down Expand Up @@ -73,7 +73,7 @@ func (im IBCModule) OnChanOpenTry(
counterparty channeltypes.Counterparty,
counterpartyVersion string,
) (string, error) {
if !im.keeper.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return "", types.ErrIntegrationDisabled
}

Expand Down Expand Up @@ -115,7 +115,7 @@ func (im IBCModule) OnChanOpenAck(
_,
counterpartyVersion string,
) error {
if !im.keeper.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return types.ErrIntegrationDisabled
}

Expand All @@ -133,7 +133,7 @@ func (im IBCModule) OnChanOpenConfirm(
portID,
channelID string,
) error {
if !im.keeper.GetParams(ctx).EnableIntegration {
if !types.EnableIntegration {
return types.ErrIntegrationDisabled
}

Expand Down
4 changes: 4 additions & 0 deletions x/zoneconcierge/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import (
"fmt"
)

var (
EnableIntegration = false
)

const (
DefaultIbcPacketTimeoutSeconds uint32 = 60 * 60 * 24 // 24 hours
MaxIbcPacketTimeoutSeconds uint32 = 60 * 60 * 24 * 365 // 1 year
Expand Down
71 changes: 12 additions & 59 deletions x/zoneconcierge/types/params.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6e06a7d

Please sign in to comment.