Skip to content

Commit 9d76878

Browse files
kaustubhkapatralfilipdjokicEengineer1
authored
fix: Refine Docker Image tagging approach [DEV-5517] (#943)
* docs: Add v4-minor testnet upgrade binaries file (#936) * docs: Add v4-minor upgrade binaries file * Switch to v4.1.6 instead of beta release * docs: Add mainnet v4-minor upgrade binaries file (#940) * docs: Add v4-minor upgrade binaries file * Switch to v4.1.6 instead of beta release * Add mainnet v4-minor binaries * fix: Optimise sleep and wait functions in upgrade tests [DEV-5514] & Optimise sleep funtions in fee abs tests [DEV-5515] (#942) * optimized sleep and wait functions in tests * revert wait time * split docker tag approach * split docker tag approach * switch to tag based approach * fixed readable events slice * fix panic due to negative tax amount * Added failsafe assertion adjustment * Increase decrement to counter jitter --------- Co-authored-by: Filip Djokic <87134019+filipdjokic@users.noreply.github.com> Co-authored-by: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com> Co-authored-by: Tasos Derisiotis <tasosderiziotis@gmail.com>
1 parent 9a93101 commit 9d76878

File tree

10 files changed

+47
-22
lines changed

10 files changed

+47
-22
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ jobs:
212212
latest=auto
213213
tags: |
214214
type=semver,pattern={{version}},value=${{ needs.release-guard.outputs.RELEASE_VERSION }}
215-
type=raw,value=production-latest
215+
type=raw,value=production-latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
216+
type=raw,value=staging-latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-') }}
216217
type=sha,format=long
217218
labels: |
218219
org.opencontainers.image.vendor="Cheqd Foundation Limited"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"binaries": {
3+
"linux/amd64": "https://github.com/cheqd/cheqd-node/releases/download/v4.1.6/cheqd-noded-4.1.6-linux-amd64.tar.gz?checksum=sha256:a1a967caba0cc9e06dc86378bdd7126e6fb91ee0080117f4c1b7acd1cd525842",
4+
"linux/arm64": "https://github.com/cheqd/cheqd-node/releases/download/v4.1.6/cheqd-noded-4.1.6-linux-arm64.tar.gz?checksum=sha256:88232d36ecb9216ee128121784c966efe69841e4e98368f201e6b5d07f93dd11"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"binaries": {
3+
"linux/amd64": "https://github.com/cheqd/cheqd-node/releases/download/v4.1.6/cheqd-noded-4.1.6-linux-amd64.tar.gz?checksum=sha256:a1a967caba0cc9e06dc86378bdd7126e6fb91ee0080117f4c1b7acd1cd525842",
4+
"linux/arm64": "https://github.com/cheqd/cheqd-node/releases/download/v4.1.6/cheqd-noded-4.1.6-linux-arm64.tar.gz?checksum=sha256:88232d36ecb9216ee128121784c966efe69841e4e98368f201e6b5d07f93dd11"
5+
}
6+
}

tests/fee-abs/fee-abs-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ docker compose exec -d osmosis osmosisd start
8181

8282
info "Waiting for chains"
8383
# TODO: Get rid of this
84-
sleep 20
84+
sleep 10
8585

8686
info "Checking statuses"
8787
CHEQD_STATUS=$(docker compose exec cheqd cheqd-noded status 2>&1)

tests/integration/cli_diddoc_pricing_negative_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ var _ = Describe("cheqd cli - negative diddoc pricing", func() {
4545
var payload didcli.DIDDocument
4646
var signInputs []didcli.SignInput
4747

48+
makeLowerFee := func(required sdk.Coin) sdk.Coin {
49+
lower := required.Amount.Sub(sdkmath.NewInt(1_000_000_000)) // subtract 1 CHEQ
50+
if lower.IsNegative() {
51+
lower = sdkmath.ZeroInt()
52+
}
53+
54+
return sdk.NewCoin(required.Denom, lower)
55+
}
56+
4857
BeforeEach(func() {
4958
tmpDir = GinkgoT().TempDir()
5059

@@ -151,7 +160,7 @@ var _ = Describe("cheqd cli - negative diddoc pricing", func() {
151160
feeInNCheq, err := cli.ResolveFeeFromParams(feeParams.CreateDid, useMin)
152161
Expect(err).To(BeNil())
153162

154-
lowerTax := sdk.NewCoin(feeInNCheq.Denom, sdkmath.NewInt(feeInNCheq.Amount.Int64()-10000000000))
163+
lowerTax := makeLowerFee(feeInNCheq)
155164
res, err := cli.CreateDidDoc(tmpDir, payload, signInputs, "", testdata.BASE_ACCOUNT_4, helpers.GenerateFees(lowerTax.String()))
156165
Expect(err).To(BeNil())
157166
Expect(res.Code).To(BeEquivalentTo(1))
@@ -185,7 +194,7 @@ var _ = Describe("cheqd cli - negative diddoc pricing", func() {
185194
useMin = true
186195
feeInNCheq, err = cli.ResolveFeeFromParams(feeParams.UpdateDid, useMin)
187196
Expect(err).To(BeNil())
188-
lowerTax := sdk.NewCoin(feeInNCheq.Denom, sdkmath.NewInt(feeInNCheq.Amount.Int64()-10000000000))
197+
lowerTax := makeLowerFee(feeInNCheq)
189198
res, err = cli.UpdateDidDoc(tmpDir, payload2, signInputs, "", testdata.BASE_ACCOUNT_5, helpers.GenerateFees(lowerTax.String()))
190199
Expect(err).To(BeNil())
191200
Expect(res.Code).To(BeEquivalentTo(1))
@@ -209,7 +218,7 @@ var _ = Describe("cheqd cli - negative diddoc pricing", func() {
209218
useMin = true
210219
feeInNCheq, err = cli.ResolveFeeFromParams(feeParams.DeactivateDid, useMin)
211220
Expect(err).To(BeNil())
212-
lowerTax := sdk.NewCoin(feeInNCheq.Denom, sdkmath.NewInt(feeInNCheq.Amount.Int64()-1000000000))
221+
lowerTax := makeLowerFee(feeInNCheq)
213222
res, err = cli.DeactivateDidDoc(tmpDir, payload2, signInputs, "", testdata.BASE_ACCOUNT_5, helpers.GenerateFees(lowerTax.String()))
214223
Expect(err).To(BeNil())
215224
Expect(res.Code).To(BeEquivalentTo(1))

tests/integration/cli_resource_pricing_negative_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ var _ = Describe("cheqd cli - negative resource pricing", func() {
187187
useMin := true
188188
tax, err := cli.ResolveFeeFromParams(resourceFeeParams.Json, useMin)
189189
Expect(err).To(BeNil())
190-
lowerTax := sdk.NewCoin(tax.Denom, sdkmath.NewInt(tax.Amount.Int64()-1000000000))
190+
lowerAmount := sdkmath.MaxInt(sdkmath.NewInt(1), sdkmath.NewInt(tax.Amount.Int64()-1000000000))
191+
lowerTax := sdk.NewCoin(tax.Denom, lowerAmount)
191192
res, err := cli.CreateResource(tmpDir, resourcetypes.MsgCreateResourcePayload{
192193
CollectionId: collectionID,
193194
Id: resourceID,
@@ -212,7 +213,8 @@ var _ = Describe("cheqd cli - negative resource pricing", func() {
212213
useMin := true
213214
tax, err := cli.ResolveFeeFromParams(resourceFeeParams.Image, useMin)
214215
Expect(err).To(BeNil())
215-
lowerTax := sdk.NewCoin(tax.Denom, sdkmath.NewInt(tax.Amount.Int64()-1000000000))
216+
lowerAmount := sdkmath.MaxInt(sdkmath.NewInt(1), sdkmath.NewInt(tax.Amount.Int64()-1000000000))
217+
lowerTax := sdk.NewCoin(tax.Denom, lowerAmount)
216218

217219
res, err := cli.CreateResource(tmpDir, resourcetypes.MsgCreateResourcePayload{
218220
CollectionId: collectionID,
@@ -238,7 +240,8 @@ var _ = Describe("cheqd cli - negative resource pricing", func() {
238240
useMin := true
239241
tax, err := cli.ResolveFeeFromParams(resourceFeeParams.Default, useMin)
240242
Expect(err).To(BeNil())
241-
lowerTax := sdk.NewCoin(tax.Denom, sdkmath.NewInt(tax.Amount.Int64()-1000000000))
243+
lowerAmount := sdkmath.MaxInt(sdkmath.NewInt(1), sdkmath.NewInt(tax.Amount.Int64()-1000000000))
244+
lowerTax := sdk.NewCoin(tax.Denom, lowerAmount)
242245
res, err := cli.CreateResource(tmpDir, resourcetypes.MsgCreateResourcePayload{
243246
CollectionId: collectionID,
244247
Id: resourceID,

tests/integration/helpers/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type HumanReadableEvent struct {
1616
}
1717

1818
func ReadableEvents(events []types.Event) []HumanReadableEvent {
19-
readableEvents := make([]HumanReadableEvent, len(events))
19+
readableEvents := make([]HumanReadableEvent, 0, len(events))
2020
for _, event := range events {
2121
readableAttributes := make([]HumanReadableEventAttribute, len(event.Attributes))
2222
for i, attribute := range event.Attributes {

tests/upgrade/integration/v4/param_change_proposal_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() {
4343
Expect(err).To(BeNil())
4444

4545
By("waiting for the proposal to be included in a block")
46-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+2, cli.VotingPeriod*3)
46+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+2, cli.VotingPeriod*1)
4747
Expect(err).To(BeNil())
4848
})
4949

@@ -81,7 +81,7 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() {
8181
Expect(err).To(BeNil())
8282

8383
By("waiting for the proposal to pass")
84-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*2)
84+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*1)
8585
Expect(err).To(BeNil())
8686
})
8787

@@ -129,7 +129,7 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() {
129129
Expect(err).To(BeNil())
130130

131131
By("waiting for the proposal to be included in a block")
132-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+2, cli.VotingPeriod*2)
132+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+2, cli.VotingPeriod*1)
133133
Expect(err).To(BeNil())
134134
})
135135

tests/upgrade/integration/v4/post_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var _ = Describe("Upgrade - Post", func() {
5151
Expect(err).To(BeNil())
5252

5353
By("waiting for 10 blocks to be produced on top, after the upgrade")
54-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*6)
54+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*2)
5555
Expect(err).To(BeNil())
5656
})
5757

@@ -87,7 +87,7 @@ var _ = Describe("Upgrade - Post", func() {
8787
Expect(err).To(BeNil())
8888

8989
By("waiting for 10 blocks to be produced on top")
90-
err = cli.WaitForChainHeight(cli.Validator2, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*8)
90+
err = cli.WaitForChainHeight(cli.Validator2, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*2)
9191
Expect(err).To(BeNil())
9292
})
9393

tests/upgrade/integration/v4/pre_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var _ = Describe("Upgrade - Pre", func() {
3939
Context("Before a software upgrade execution is initiated", func() {
4040
It("should wait for chain to bootstrap", func() {
4141
By("pinging the node status until the voting end height is reached")
42-
err := cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, cli.BootstrapHeight, cli.BootstrapPeriod+20)
42+
err := cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, cli.BootstrapHeight, cli.BootstrapPeriod+5)
4343
Expect(err).To(BeNil())
4444
})
4545

@@ -67,7 +67,7 @@ var _ = Describe("Upgrade - Pre", func() {
6767
By("waiting for an additional set of blocks to be produced")
6868
height, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName)
6969
Expect(err).To(BeNil())
70-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, height+5, cli.VotingPeriod*6)
70+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, height+5, cli.VotingPeriod*2)
7171
Expect(err).To(BeNil())
7272
}
7373
})
@@ -107,7 +107,7 @@ var _ = Describe("Upgrade - Pre", func() {
107107
By("waiting for an additional set of blocks to be produced")
108108
height, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName)
109109
Expect(err).To(BeNil())
110-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, height+5, cli.VotingPeriod*6)
110+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, height+5, cli.VotingPeriod*2)
111111
Expect(err).To(BeNil())
112112
}
113113
})
@@ -137,7 +137,7 @@ var _ = Describe("Upgrade - Pre", func() {
137137
Expect(err).To(BeNil())
138138

139139
By("waiting for 10 blocks to be produced on top, after the upgrade")
140-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+3, cli.VotingPeriod*3)
140+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+3, cli.VotingPeriod*1)
141141
Expect(err).To(BeNil())
142142
})
143143

@@ -154,7 +154,7 @@ var _ = Describe("Upgrade - Pre", func() {
154154
Expect(err).To(BeNil())
155155

156156
By("waiting for the proposal to be included in a block")
157-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+3, cli.VotingPeriod*3)
157+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+3, cli.VotingPeriod*1)
158158
Expect(err).To(BeNil())
159159
})
160160

@@ -171,7 +171,7 @@ var _ = Describe("Upgrade - Pre", func() {
171171
Expect(err).To(BeNil())
172172

173173
By("waiting for 10 blocks to be produced on top, after the upgrade")
174-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, cli.VotingPeriod*2)
174+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, cli.VotingPeriod*1)
175175
Expect(err).To(BeNil())
176176
})
177177

@@ -188,7 +188,7 @@ var _ = Describe("Upgrade - Pre", func() {
188188
Expect(err).To(BeNil())
189189

190190
By("waiting for 10 blocks to be produced on top, after the upgrade")
191-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, cli.VotingPeriod*2)
191+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, cli.VotingPeriod*1)
192192
Expect(err).To(BeNil())
193193
})
194194

@@ -205,7 +205,7 @@ var _ = Describe("Upgrade - Pre", func() {
205205
Expect(err).To(BeNil())
206206

207207
By("waiting for 10 blocks to be produced on top, after the upgrade")
208-
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, cli.VotingPeriod*2)
208+
err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, cli.VotingPeriod*1)
209209
Expect(err).To(BeNil())
210210
})
211211

0 commit comments

Comments
 (0)