Skip to content

Commit dd9ec16

Browse files
implemented upgrade handler for v6.1.7 (#1072) (#1073)
(cherry picked from commit 041ad26) Co-authored-by: CJPotter10 <91627020+CJPotter10@users.noreply.github.com>
1 parent c1eb449 commit dd9ec16

4 files changed

Lines changed: 70 additions & 11 deletions

File tree

app/upgrades.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55

66
"github.com/tellor-io/layer/app/upgrades"
7-
v_6_1_6 "github.com/tellor-io/layer/app/upgrades/v6.1.6"
7+
v_6_1_7 "github.com/tellor-io/layer/app/upgrades/v6.1.7"
88

99
upgradetypes "cosmossdk.io/x/upgrade/types"
1010
)
@@ -13,26 +13,22 @@ var (
1313
// `Upgrades` defines the upgrade handlers and store loaders for the application.
1414
// New upgrades should be added to this slice after they are implemented.
1515
Upgrades = []*upgrades.Upgrade{
16-
&v_6_1_6.Upgrade,
16+
&v_6_1_7.Upgrade,
1717
}
1818
Forks = []upgrades.Fork{}
1919
)
2020

2121
// setupUpgradeHandlers registers the upgrade handlers to perform custom upgrade
2222
// logic and state migrations for software upgrades.
2323
func (app *App) setupUpgradeHandlers() {
24-
if app.UpgradeKeeper.HasHandler(v_6_1_6.UpgradeName) {
25-
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v_6_1_6.UpgradeName))
24+
if app.UpgradeKeeper.HasHandler(v_6_1_7.UpgradeName) {
25+
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v_6_1_7.UpgradeName))
2626
}
2727
app.UpgradeKeeper.SetUpgradeHandler(
28-
v_6_1_6.UpgradeName,
29-
v_6_1_6.CreateUpgradeHandler(
28+
v_6_1_7.UpgradeName,
29+
v_6_1_7.CreateUpgradeHandler(
3030
app.ModuleManager(),
3131
app.configurator,
32-
app.AccountKeeper,
33-
app.ReporterKeeper,
34-
app.ICAControllerKeeper,
35-
app.ICAHostKeeper,
3632
),
3733
)
3834
}

app/upgrades/v6.1.7/constants.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package v6_1_7
2+
3+
import (
4+
"github.com/tellor-io/layer/app/upgrades"
5+
6+
store "cosmossdk.io/store/types"
7+
)
8+
9+
const (
10+
UpgradeName = "v6.1.7"
11+
)
12+
13+
var Upgrade = upgrades.Upgrade{
14+
UpgradeName: UpgradeName,
15+
StoreUpgrades: store.StoreUpgrades{},
16+
}

app/upgrades/v6.1.7/upgrade.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package v6_1_7
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
upgradetypes "cosmossdk.io/x/upgrade/types"
8+
9+
sdk "github.com/cosmos/cosmos-sdk/types"
10+
"github.com/cosmos/cosmos-sdk/types/module"
11+
)
12+
13+
/*
14+
Upgrade to v6.1.7 includes (since v6.1.6):
15+
- Dispute vote validation and accounting (#1061): reject invalid vote choices;
16+
counted selector stake moves stored ReporterPower on revote (no re-snapshot,
17+
re-peel, or re-reserve); lock only blocks first acquisition of reporter stake;
18+
peels target evidence-reporter ownership after a switch when needed; fail-closed
19+
bucket underflow/overflow; same safeguards applied to team votes.
20+
- MsgBatchSubmitValue correctness (#1064): align with MsgSubmitValue power caching,
21+
call ReporterStake on the first verified valid report, and return an error when
22+
all reports in the batch fail.
23+
- Reporter self-demotion hardening (#1065): safer demotion lifecycle (reporter not
24+
deleted immediately), block pending switches onto a demoting reporter, and handle
25+
rewards/liveness after demotion when the reporter object is gone.
26+
- Bridge module authority wiring (#1058): inject authority correctly into
27+
ProvideModule via the module config proto.
28+
- Bridge vote-extension signing (#1046 / #1063): sign via validated
29+
checkpoint/attestation RPCs (VoteExtensionSigner), not SignRaw; follow-up signer
30+
API and registration-sig updates.
31+
32+
No custom state migration is required beyond RunMigrations: dispute vote store
33+
layout and protos are unchanged. In-flight disputes keep existing tallies;
34+
subsequent votes use the corrected accounting.
35+
*/
36+
37+
func CreateUpgradeHandler(
38+
mm *module.Manager,
39+
configurator module.Configurator,
40+
) upgradetypes.UpgradeHandler {
41+
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
42+
sdkCtx := sdk.UnwrapSDKContext(ctx)
43+
sdkCtx.Logger().Info(fmt.Sprintf("Running %s Upgrade...", UpgradeName))
44+
45+
return mm.RunMigrations(ctx, configurator, vm)
46+
}
47+
}

e2e/upgrade_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const (
2929
)
3030

3131
func TestLayerUpgrade(t *testing.T) {
32-
ChainUpgradeTest(t, "layer", "layer", "local", "v6.1.6")
32+
ChainUpgradeTest(t, "layer", "layer", "local", "v6.1.7")
3333
}
3434

3535
func ChainUpgradeTest(t *testing.T, chainName, upgradeContainerRepo, upgradeVersion, upgradeName string) {

0 commit comments

Comments
 (0)