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 #16324

Merged
merged 31 commits into from
Jun 16, 2023

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented May 29, 2023

Description

Notes for reviewers:

  • main work is done on methods of staking keeper
  • all places where these methods are used have been upgraded, we'll have to make sure with errcheck (follow up PR, as this is huge already)

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

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
x/slashing/keeper/infractions.go Fixed Show fixed Hide fixed
x/slashing/keeper/infractions.go Fixed Show fixed Hide fixed
x/slashing/keeper/infractions.go Fixed Show fixed Hide fixed
@@ -26,11 +26,21 @@
}

// 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/mint/abci.go Fixed Show fixed Hide fixed
@facundomedica facundomedica changed the title refactor! (x/staking): KVStoreService, return errors and use context.Context refactor(x/staking)!: KVStoreService, return errors and use context.Context May 30, 2023
x/mint/abci.go Fixed Show fixed Hide fixed
@julienrbrt julienrbrt added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Jun 9, 2023
@github-actions github-actions bot removed the Type: CI label Jun 12, 2023
@github-actions github-actions bot removed the C:x/auth label Jun 16, 2023
@facundomedica facundomedica added this pull request to the merge queue Jun 16, 2023
Merged via the queue into main with commit 1be7d98 Jun 16, 2023
@facundomedica facundomedica deleted the facu/kvstore-staking2 branch June 16, 2023 18:42
mergify bot pushed a commit that referenced this pull request Jun 16, 2023
…ontext (#16324)

Co-authored-by: Aleksandr Bezobchuk <[email protected]>
(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
facundomedica added a commit that referenced this pull request Jun 19, 2023
…ontext (backport #16324) (#16598)

Co-authored-by: Facundo Medica <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
Co-authored-by: Facundo Medica <[email protected]>
@dudong2 dudong2 mentioned this pull request Jul 26, 2024
10 tasks
@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
Labels
backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release C:CLI C:Simulations C:x/distribution distribution module related C:x/evidence C:x/genutil genutil module issues C:x/gov C:x/mint C:x/params C:x/slashing C:x/staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants