Skip to content

Commit

Permalink
feat: network upgrade v0.36.0 (#1952)
Browse files Browse the repository at this point in the history
initialize feegrant keeper reference for feegrant decorator

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed May 28, 2024
1 parent 4f77ed7 commit f417f49
Show file tree
Hide file tree
Showing 18 changed files with 386 additions and 60 deletions.
4 changes: 4 additions & 0 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "custom akash governance keeper is required for ante builder")
}

if options.FeegrantKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "akash feegrant keeper is required for ante builder")
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewRejectExtensionOptionsDecorator(),
Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ func NewApp(
HandlerOptions: ante.HandlerOptions{
AccountKeeper: app.Keepers.Cosmos.Acct,
BankKeeper: app.Keepers.Cosmos.Bank,
FeegrantKeeper: app.Keepers.Cosmos.FeeGrant,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
Expand Down
2 changes: 1 addition & 1 deletion make/test-upgrade.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test: $(COSMOVISOR) init
-config=test-config.json \
-upgrade-name=$(UPGRADE_TO) \
-upgrade-version="$(UPGRADE_BINARY_VERSION)" \
-test-cases=upgrade-$(UPGRADE_TO).json
-test-cases=test-cases.json

.PHONY: test-reset
test-reset:
Expand Down
5 changes: 5 additions & 0 deletions meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
"skipped": false,
"from_binary": "v0.32.3",
"from_version": "v0.32.0"
},
"v0.36.0": {
"skipped": false,
"from_binary": "v0.34.1",
"from_version": "v0.34.0"
}
}
}
58 changes: 58 additions & 0 deletions tests/upgrade/test-cases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"v0.36.0": {
},
"v0.34.0": {
"migrations": {
}
},
"v0.32.0": {
"migrations": {
"market": {
"from": "4",
"to": "5"
}
}
},
"v0.30.0": {
},
"v0.28.0": {
"migrations": {
"market": {
"from": "3",
"to": "4"
}
}
},
"v0.26.0": {
"modules": {
"added": [
]
},
"migrations": {
}
},
"v0.24.0": {
"modules": {
"added": [
"agov",
"astaking",
"feegrant",
"take"
]
},
"migrations": {
"deployment": {
"from": "2",
"to": "3"
},
"market": {
"from": "2",
"to": "3"
},
"transfer": {
"from": "1",
"to": "2"
}
}
}
}
24 changes: 0 additions & 24 deletions tests/upgrade/upgrade-v0.24.0.json

This file was deleted.

8 changes: 0 additions & 8 deletions tests/upgrade/upgrade-v0.26.0.json

This file was deleted.

8 changes: 0 additions & 8 deletions tests/upgrade/upgrade-v0.28.0.json

This file was deleted.

2 changes: 0 additions & 2 deletions tests/upgrade/upgrade-v0.30.0.json

This file was deleted.

8 changes: 0 additions & 8 deletions tests/upgrade/upgrade-v0.32.0.json

This file was deleted.

4 changes: 0 additions & 4 deletions tests/upgrade/upgrade-v0.34.0.json

This file was deleted.

18 changes: 13 additions & 5 deletions tests/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ type nodeStatus struct {
} `json:"SyncInfo"`
}

type testCases struct {
type testCase struct {
Modules struct {
Added []string `json:"added"`
Removed []string `json:"removed"`
Expand All @@ -176,6 +176,8 @@ type testCases struct {
} `json:"migrations"`
}

type testCases map[string]testCase

type validatorParams struct {
home string
homedir string
Expand All @@ -198,7 +200,7 @@ type validator struct {
group *errgroup.Group
upgradeInfo string
params validatorParams
tConfig testCases
tConfig testCase
upgradeSuccessful chan struct{}
testErrsCh chan []string
}
Expand Down Expand Up @@ -315,9 +317,11 @@ func TestUpgrade(t *testing.T) {
require.NoError(t, err)
}

var tConfig testCases
var tConfig testCase
// load testcases config
{
tCases := make(testCases)

tFile, err := os.Open(*testCasesFile)
require.NoError(t, err)
defer func() {
Expand All @@ -327,8 +331,12 @@ func TestUpgrade(t *testing.T) {
data, err := io.ReadAll(tFile)
require.NoError(t, err)

err = json.Unmarshal(data, &tConfig)
err = json.Unmarshal(data, &tCases)
require.NoError(t, err)

var valid bool
tConfig, valid = tCases[*upgradeName]
require.True(t, valid)
}

cmdr := &commander{}
Expand Down Expand Up @@ -736,7 +744,7 @@ func (l *upgradeTest) submitUpgradeProposal() error {
return nil
}

func newValidator(ctx context.Context, t *testing.T, params validatorParams, tConfig testCases) *validator {
func newValidator(ctx context.Context, t *testing.T, params validatorParams, tConfig testCase) *validator {
ctx, cancel := context.WithCancel(ctx)
group, ctx := errgroup.WithContext(ctx)

Expand Down
Loading

0 comments on commit f417f49

Please sign in to comment.