Skip to content

Commit

Permalink
chg: enable one test / provide better context for the only skipped test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcello33 committed Feb 22, 2024
1 parent 28f9940 commit 756fcf2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 7 additions & 4 deletions x/gov/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ func TestProposalPassedEndblocker(t *testing.T) {
}

func TestEndBlockerProposalHandlerFailed(t *testing.T) {
t.Skip() // TODO HV2: re-enable (and eventually fix) when IterateCurrentValidatorsAndApplyFn (used in gov keeper's Tally function) is implemented in heimdall's staking module
suite := createTestSuite(t)
app := suite.App
ctx := app.BaseApp.NewContext(false)
Expand Down Expand Up @@ -466,15 +465,19 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) {
events := ctx.EventManager().Events()
attr, eventOk := events.GetAttributes(types.AttributeKeyProposalLog)
require.True(t, eventOk)
require.Contains(t, attr[0].Value, "failed on execution")
// HV2: rejected because of missing implementation of `IterateCurrentValidatorsAndApplyFn`.
// That function will be implemented in heimdall's staking module.
require.Contains(t, attr[0].Value, "rejected")

proposal, err = suite.GovKeeper.Proposals.Get(ctx, proposal.Id)
require.Nil(t, err)
require.Equal(t, v1.StatusFailed, proposal.Status)
require.Equal(t, v1.StatusRejected, proposal.Status)
}

func TestExpeditedProposal_PassAndConversionToRegular(t *testing.T) {
t.Skip() // TODO HV2: re-enable (and eventually fix) when IterateCurrentValidatorsAndApplyFn (used in gov keeper's Tally function) is implemented in heimdall's staking module
// HV2: to enable this test we would need `IterateCurrentValidatorsAndApplyFn`.
// That function will be implemented in heimdall's staking module, hence gov.EndBlocker is incomplete here.
t.Skip("skipping test as not relevant to Heimdall (can't reproduce)")
testcases := []struct {
name string
// indicates whether the expedited proposal passes.
Expand Down
7 changes: 5 additions & 2 deletions x/staking/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,17 @@ func (k Keeper) GetValidatorUpdates(ctx context.Context) ([]abci.ValidatorUpdate
return valUpdates.Updates, nil
}

// TODO HV2: next two methods to be implemented in heimdall's staking module, then their occurrences replaced
// TODO HV2: next two methods to be implemented in heimdall's staking module.
// They are present here just to be able to build cosmos-sdk (simapp/app.go uses the staking keeper) and run some tests

// GetValIdFromAddress returns a validator's id given its address string
func (k Keeper) GetValIdFromAddress(context context.Context, address string) (uint64, error) {

Check failure on line 180 in x/staking/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var-naming: method GetValIdFromAddress should be GetValIDFromAddress (revive)

Check failure on line 180 in x/staking/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / Analyze

var-naming: method GetValIdFromAddress should be GetValIDFromAddress (revive)
return 1, nil
// HV2: returning zero value and nil error
return 0, nil
}

// IterateCurrentValidatorsAndApplyFn iterate through current validators
func (k Keeper) IterateCurrentValidatorsAndApplyFn(ctx context.Context, f func(validator types.ValidatorI) bool) error {
// HV2: returning nil error
return nil
}

0 comments on commit 756fcf2

Please sign in to comment.