Skip to content

Commit

Permalink
Make setting halt height configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Oct 19, 2023
1 parent 815a9a6 commit 24c5045
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
8 changes: 6 additions & 2 deletions api/v1/cosmosfullnode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,15 @@ type ChainSpec struct {
}

type ChainVersion struct {
// UpgradeHeight is the block height when this version is applied.
// The block height when this version should be applied.
UpgradeHeight uint64 `json:"height"`

// Image is the docker image for this version in "repository:tag" format. E.g. busybox:latest.
// The docker image for this version in "repository:tag" format. E.g. busybox:latest.
Image string `json:"image"`

// Determines if the node should forcefully halt at the upgrade height.
// +optional
SetHaltHeight bool `json:"setHaltHeight,omitempty"`
}

type ChainVersions []ChainVersion
Expand Down
12 changes: 8 additions & 4 deletions config/crd/bases/cosmos.strange.love_cosmosfullnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,18 @@ spec:
items:
properties:
height:
description: UpgradeHeight is the block height when this
version is applied.
description: The block height when this version should be
applied.
format: int64
type: integer
image:
description: Image is the docker image for this version
in "repository:tag" format. E.g. busybox:latest.
description: The docker image for this version in "repository:tag"
format. E.g. busybox:latest.
type: string
setHaltHeight:
description: Determines if the node should forcefully halt
at the upgrade height.
type: boolean
required:
- height
- image
Expand Down
6 changes: 5 additions & 1 deletion internal/fullnode/configmap_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ func BuildConfigMaps(crd *cosmosv1.CosmosFullNode, peers Peers) ([]diff.Resource
}
haltHeight := uint64(0)
for i, v := range crd.Spec.ChainSpec.Versions {
haltHeight = v.UpgradeHeight
if v.SetHaltHeight {
haltHeight = v.UpgradeHeight
} else {
haltHeight = 0
}
if instanceHeight < v.UpgradeHeight {
break
}
Expand Down

0 comments on commit 24c5045

Please sign in to comment.