Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(x/staking)!: KVStoreService, return errors and use context.Context (backport #16324) #16598

Merged
merged 4 commits into from
Jun 19, 2023

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jun 16, 2023

This is an automatic backport of pull request #16324 done by Mergify.
Cherry-pick of 1be7d98 has failed:

On branch mergify/bp/release/v0.50.x/pr-16324
Your branch is up to date with 'origin/release/v0.50.x'.

You are currently cherry-picking commit 1be7d9805.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   simapp/app.go
	modified:   simapp/export.go
	modified:   simapp/test_helpers.go
	modified:   tests/integration/distribution/keeper/msg_server_test.go
	modified:   tests/integration/evidence/keeper/infraction_test.go
	modified:   tests/integration/gov/keeper/keeper_test.go
	modified:   tests/integration/slashing/keeper/keeper_test.go
	modified:   tests/integration/staking/keeper/common_test.go
	modified:   tests/integration/staking/keeper/delegation_test.go
	modified:   tests/integration/staking/keeper/determinstic_test.go
	modified:   tests/integration/staking/keeper/genesis_test.go
	modified:   tests/integration/staking/keeper/grpc_query_test.go
	modified:   tests/integration/staking/keeper/msg_server_test.go
	modified:   tests/integration/staking/keeper/slash_test.go
	modified:   tests/integration/staking/keeper/unbonding_test.go
	modified:   tests/integration/staking/keeper/validator_test.go
	modified:   testutil/sims/address_helpers.go
	modified:   x/auth/migrations/v2/store_test.go
	modified:   x/distribution/keeper/allocation.go
	modified:   x/distribution/keeper/allocation_test.go
	modified:   x/distribution/keeper/delegation_test.go
	modified:   x/distribution/keeper/grpc_query.go
	modified:   x/distribution/keeper/invariants.go
	modified:   x/distribution/keeper/keeper.go
	modified:   x/distribution/keeper/msg_server.go
	modified:   x/distribution/keeper/validator.go
	modified:   x/distribution/simulation/operations.go
	modified:   x/distribution/simulation/operations_test.go
	modified:   x/distribution/testutil/expected_keepers_mocks.go
	modified:   x/distribution/types/expected_keepers.go
	modified:   x/evidence/keeper/infraction.go
	modified:   x/evidence/testutil/expected_keepers_mocks.go
	modified:   x/evidence/types/expected_keepers.go
	modified:   x/genutil/testutil/expected_keepers_mocks.go
	modified:   x/genutil/types/expected_keepers.go
	modified:   x/gov/keeper/common_test.go
	modified:   x/gov/keeper/tally.go
	modified:   x/gov/testutil/expected_keepers.go
	modified:   x/gov/testutil/expected_keepers_mocks.go
	modified:   x/gov/types/expected_keepers.go
	modified:   x/mint/abci.go
	modified:   x/mint/keeper/keeper.go
	modified:   x/mint/keeper/keeper_test.go
	modified:   x/mint/testutil/expected_keepers_mocks.go
	modified:   x/mint/types/expected_keepers.go
	modified:   x/params/proposal_handler_test.go
	modified:   x/params/testutil/staking_keeper_mock.go
	modified:   x/slashing/abci_test.go
	modified:   x/slashing/app_test.go
	modified:   x/slashing/keeper/genesis_test.go
	modified:   x/slashing/keeper/hooks.go
	modified:   x/slashing/keeper/hooks_test.go
	modified:   x/slashing/keeper/infractions.go
	modified:   x/slashing/keeper/keeper.go
	modified:   x/slashing/keeper/keeper_test.go
	modified:   x/slashing/keeper/msg_server_test.go
	modified:   x/slashing/keeper/unjail.go
	modified:   x/slashing/simulation/operations.go
	modified:   x/slashing/testutil/expected_keepers_mocks.go
	modified:   x/slashing/types/expected_keepers.go
	modified:   x/staking/app_test.go
	modified:   x/staking/client/cli/tx_test.go
	modified:   x/staking/genesis.go
	modified:   x/staking/keeper/abci.go
	modified:   x/staking/keeper/alias_functions.go
	modified:   x/staking/keeper/delegation.go
	modified:   x/staking/keeper/delegation_test.go
	modified:   x/staking/keeper/genesis.go
	modified:   x/staking/keeper/grpc_query.go
	modified:   x/staking/keeper/grpc_query_test.go
	modified:   x/staking/keeper/historical_info.go
	modified:   x/staking/keeper/historical_info_test.go
	modified:   x/staking/keeper/invariants.go
	modified:   x/staking/keeper/keeper.go
	modified:   x/staking/keeper/keeper_test.go
	modified:   x/staking/keeper/migrations.go
	modified:   x/staking/keeper/msg_server.go
	modified:   x/staking/keeper/msg_server_test.go
	modified:   x/staking/keeper/params.go
	modified:   x/staking/keeper/pool.go
	modified:   x/staking/keeper/power_reduction.go
	modified:   x/staking/keeper/query_utils.go
	modified:   x/staking/keeper/slash.go
	modified:   x/staking/keeper/slash_test.go
	modified:   x/staking/keeper/test_common.go
	modified:   x/staking/keeper/unbonding.go
	modified:   x/staking/keeper/unbonding_test.go
	modified:   x/staking/keeper/val_state_change.go
	modified:   x/staking/keeper/validator.go
	modified:   x/staking/keeper/validator_test.go
	modified:   x/staking/migrations/v2/store_test.go
	modified:   x/staking/migrations/v3/store.go
	modified:   x/staking/migrations/v3/store_test.go
	modified:   x/staking/migrations/v4/migrations_test.go
	modified:   x/staking/migrations/v4/store.go
	modified:   x/staking/migrations/v5/migrations_test.go
	modified:   x/staking/migrations/v5/store.go
	modified:   x/staking/module.go
	modified:   x/staking/simulation/operations.go
	modified:   x/staking/testutil/expected_keepers_mocks.go
	modified:   x/staking/testutil/helpers.go
	modified:   x/staking/types/expected_keepers.go
	modified:   x/staking/types/hooks.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   CHANGELOG.md
	both modified:   x/distribution/keeper/delegation.go
	both modified:   x/distribution/keeper/hooks.go
	both modified:   x/evidence/go.mod
	both modified:   x/evidence/go.sum
	both modified:   x/staking/migrations/v2/store.go
	both modified:   x/staking/simulation/operations_test.go
	both modified:   x/staking/types/errors.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

…ontext (#16324)

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
(cherry picked from commit 1be7d98)

# Conflicts:
#	CHANGELOG.md
#	x/distribution/keeper/delegation.go
#	x/distribution/keeper/hooks.go
#	x/evidence/go.mod
#	x/evidence/go.sum
#	x/staking/migrations/v2/store.go
#	x/staking/simulation/operations_test.go
#	x/staking/types/errors.go
@mergify mergify bot requested a review from a team as a code owner June 16, 2023 18:43
@mergify mergify bot added the conflicts label Jun 16, 2023
@github-prbot github-prbot requested review from a team, JeancarloBarrios and atheeshp and removed request for a team June 16, 2023 18:47
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)

k.TrackHistoricalInfo(ctx)
return k.TrackHistoricalInfo(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
}

// Called every block, update validator set
func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)

return k.BlockValidatorUpdates(sdk.UnwrapSDKContext(ctx)), nil
return k.BlockValidatorUpdates(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call

am.keeper.BeginBlocker(c)
return nil
return am.keeper.BeginBlocker(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
@@ -26,12 +26,19 @@
}

// recalculate inflation rate
totalStakingSupply := k.StakingTokenSupply(ctx)
bondedRatio := k.BondedRatio(ctx)
totalStakingSupply, err := k.StakingTokenSupply(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
return err
}

bondedRatio, err := k.BondedRatio(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
x/distribution/keeper/delegation.go Fixed Show fixed Hide fixed
x/distribution/keeper/delegation.go Fixed Show fixed Hide fixed
@facundomedica
Copy link
Member

Evidence tests are failing because of the version of the SDK. Should I update it to match this PR?

@facundomedica facundomedica merged commit 9f7a160 into release/v0.50.x Jun 19, 2023
@facundomedica facundomedica deleted the mergify/bp/release/v0.50.x/pr-16324 branch June 19, 2023 14:40
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants