Commit Graph

39 Commits

Author SHA1 Message Date
mergify[bot] ac970f52be
feat: add (re)delegation getters (backport #11596) (#11615)
* feat: add (re)delegation getters (#11596)

### Description

This PR adds general helper functions to the `x/staking` module that are used in the Evmos `x/vesting` module and originated from Agoric's custom staking module implementation https://github.com/agoric-labs/cosmos-sdk/blob/4085-true-vesting/x/staking/keeper/delegation.go.

- `GetDelegatorUnbonding`
- `GetDelegatorBonded`
- `IterateDelegatorUnbondingDelegations`
- `IterateDelegatorDelegations`
- `IterateDelegatorRedelegations`

(cherry picked from commit b8270fc9ba)

# Conflicts:
#	CHANGELOG.md
#	x/staking/keeper/delegation.go

* fix RemoveDelegation method conflict

* fix CHANGELOG conflict

* add new PR in CHANGELOG

Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>
2022-04-13 16:34:42 +02:00
Greg Morrison ad49ec1f5b
Remove Redundant Staking Errors (#9231)
* refactor(staking errors): 'invalid' errors: use ErrInvalidRequest, remove unused error types

* refactor(staking errors): fix error registration codes

* support(staking errors): add changelog entry

* fix(staking test suite): update expected error codes relative to refactor

* chore(staking errors): code formatting

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-19 12:20:17 +00:00
Robert Zaremba be4a965599
codec: Rename codec and marshaler interfaces (#9226)
* codec: Rename codec and marshaler interfaces, ref: 8413

* codec: remove BinaryBare

* changelog update

* Update comments and documentation

* adding doc string comments

* Update CHANGELOG.md

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update codec/codec.go

Co-authored-by: Marko <marbar3778@yahoo.com>

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-29 10:46:22 +00:00
Amaury Martiny 33e7297c79
Use enum instead of int32 for BondStatus (#7499)
* Migrate staking module

* Add gov legacy

* Add comments

* Add x/distrib

* x/crisis

* x/mint

* Fix test

* migrate x/genutil

* Fix lint

* Fix staking constants

* Fix test

* Update x/genutil/legacy/v040/migrate.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* Add migrate script instead of change BondStatus constants

* Change staking bondStatus to enum

* Fix test

* Fix another test

* Remove staking exported

* fix references

* Better constants

* Fix build

* Fix lint

* Remove buf version

* Fix tests

* Fix test

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-10-12 13:56:02 +00:00
Federico Kunze 82c9ae3949
LGTM alerts audit (#7440)
* LGTM alerts audit

* Update x/simulation/mock_tendermint.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* Update x/staking/keeper/delegation.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* comment false positive

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-10-02 15:13:58 +02:00
Anil Kumar Kammari d55c1a2665
Change `address` from bytes to bech32 strings (#7242)
* init

* Fix bank proto messages

* missing conversions

* remove casttype for addresses

* Fix tests

* Fix consaddress

* more test fixes

* Fix tests

* fixed tests

* migrate missing proto declarations

* format

* Fix format

* Fix alignment

* Fix more tests

* Fix ibc merge issue

* Fix fmt

* Fix more tests

* Fix missing address declarations

* Fix staking tests

* Fix more tests

* Fix config

* fixed tests

* Fix more tests

* Update staking grpc tests

* Fix merge issue

* fixed failing tests in x/distr

* fixed sim tests

* fixed failing tests

* Fix bugs

* Add logs

* fixed slashing issue

* Fix staking grpc tests

* Fix all bank tests :)

* Fix tests in distribution

* Fix more tests in distr

* Fix slashing tests

* Fix statking tests

* Fix evidence tests

* Fix gov tests

* Fix bug in create vesting account

* Fix test

* remove fmt

* fixed gov tests

* fixed x/ibc tests

* fixed x/ibc-transfer tests

* fixed staking tests

* fixed staking tests

* fixed test

* fixed distribution issue

* fix pagination test

* fmt

* lint

* fix build

* fix format

* revert tally tests

* revert tally tests

* lint

* Fix sim test

* revert

* revert

* fixed tally issue

* fix tests

* revert

* fmt

* refactor

* remove `GetAddress()`

* remove fmt

* revert fmt.Striger usage

* Fix tests

* Fix rest test

* disable interfacer lint check

* make proto-format

* add nolint rule

* remove stray println

Co-authored-by: aleem1314 <aleem.md789@gmail.com>
Co-authored-by: atheesh <atheesh@vitwit.com>
2020-09-25 10:25:37 +00:00
Finn cc96e5c16f
x/staking: add call to iterator Close method (#6791)
Co-authored-by: FinnZhang <>
2020-07-20 04:30:09 -04:00
Marko 218ec99508
various linter fixes (#6106)
x/staking: Fix all linter warnings.

Fixed warnings across base packages.

New linters:
- unparam
- nolintlint

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-05-02 21:26:59 +02:00
Alexander Bezobchuk d90b2e7a99
Allow Unjail of Non-Bonded Jailed Validator (#6061)
* Use correct API and add TODO

* Allow unjail without signing info

* Add unit test

* Update godoc

* Add changelog entries

* Fix TestUndelegateSelfDelegationBelowMinSelfDelegation

* Fix delegation tests

* Revert API call
2020-04-26 17:38:33 +00:00
Alexander Bezobchuk 1083fa948e
Merge PR #6010: Merge x/supply into x/bank 2020-04-20 11:22:12 -04:00
Jonathan Gimeno 2e42f9cb74
Favor marshal unmashal binare bare (#5799)
* change abci file to use BinaryBare

* change all calls to EncodeLengthPrefixed to BinaryBare in distribution keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in mint keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in auth keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in distribution keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in staking keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in staking keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in gov keeper store.

* change all calls to EncodeLengthPrefixed to BinaryBare in slashing keeper store.

* update decoder test

* migrate decoder

* migrate gov simulation decoder

* migrate baseapp_test

* refactor QuerySubspace

* refactor coedc std codec

* migrate keybase

* migrate iavl store

* migrate root multi

* migrate ante basic

* migrate tx type to bare

* migrate auth client

* update auth types

* update decoder

* migrate supply decoder

* migrate stake encoding

* migrate staking simulation

* migrate genutil

* migrate simapp test helpers

* migrate docs

* upgrade changelog

* Update CHANGELOG.md

Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-03-13 19:58:43 +00:00
Alexander Bezobchuk 88d01a9869
Remove redundant staking APIs (#5755) 2020-03-06 13:40:50 +00:00
Jonathan Gimeno 27ff208fb8 make all test pass temporary 2020-02-21 18:34:03 +01:00
Alexander Bezobchuk 53bf2271d5
Merge PR #5600: Migrate x/staking to Protobuf 2020-02-06 14:21:02 -05:00
Alexander Bezobchuk ce16e0a99d
Merge PR #5597: Include Amount in Complete Unbonding/Redelegation Events 2020-01-31 11:12:04 -05:00
Alexander Bezobchuk 9a183ffbcc
Merge PR #5421: Refactor Error Handling 2019-12-27 12:57:54 -05:00
Marko b9490f2d93 Merge PR #5203: Add more linters 2019-10-17 09:47:35 -04:00
Federico Kunze 352678438c Merge PR #4255: Supply Module 2019-06-28 16:11:27 -04:00
Alexander Bezobchuk 67f6b02118 Merge PR #4541: Events Tracking / Tendermint v0.32.0 Update
* Update Tendermint to v0.32.0-dev0

* Initial refactor of tags

* Update event types and add unit tests

* Refactor context

* Update module manager

* Update result godoc

* Implement ToABCIEvents

* Update BaseApp

* Minor cleanup

* Fix typo

* Update x/bank message handler

* Update x/bank keeper

* Update x/bank

* Update x/bank events docs

* Update x/crisis module events

* Reset context with events on each message exec

* Update x/distribution events and docs

* Update BaseApp to not set empty events manually

* Implement simple event manager

* Update module manager

* Update modules to use event manager

* Update x/gov module to use events

* Update events docs

* Update gov queries and crisis app module

* Update bank keeper

* Add events to minting begin blocker

* Update modules to use types/events.go

* Cleanup x/mint

* Update x/staking events

* Update x/staking events

* Update events to have sender part of message.sender

* Fix build

* Fix module unit tests

* Add pending log entry

* Update deps

* Update x/crisis/types/events.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/bank/internal/types/events.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/distribution/types/events.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/mint/internal/types/events.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/slashing/types/events.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/staking/types/events.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/gov/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/gov/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/mint/abci.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/mint/abci.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/slashing/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/staking/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/slashing/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/staking/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/staking/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/staking/handler.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Upgrade TM to v0.32.0-dev1

* Update events as strings

* Update Tendermint to v0.32.0-dev2

* Fix BaseApp unit tests

* Fix unit tests

* Bump tendermint version to v0.32.0

* typos
2019-06-26 18:03:25 +02:00
helldealer 941effc14d Merge PR #4553: Fix undelegate losing tokens issue 2019-06-15 10:26:17 +02:00
Federico Kunze d322e23425 Merge PR #4417: cleanup staking references from types pkg
* cleanup staking references from types pkg

* check interface on runtime

* fixes

* rename validator set from slashing keeper

* final cleanup

* fix test

* fix querier

* fix tests

* rename interfaces

* update bond status

* fixes

* expected pkg

* ensure expected keepers match used funcs

* cha cha cha
2019-06-04 15:06:58 -07:00
Alexander Bezobchuk d204afbdae
Merge PR #4461: Port advisory patch to master 2019-05-31 11:14:40 -04:00
frog power 4000 73e5ef7c13 reduce module interdependancy, /client refactor (#4415)
* abstract staking BuildCreateValidatorMsg, genutil defines its own flags

* client/ refactor

* staking move keys from keeper to types
2019-05-28 09:44:04 +01:00
Alexander Bezobchuk 59765cecb1 Merge PR #3857: Remove Shares Concept from Unbond/Redelegate UX
* Remove shares concept from unbonding and redelegation

* Remove redundant staking REST type declerations

* Rename staking REST request types

* Fix slashing tests

* Fix staking tests

* Fix integration tests

* Add safety checks for when validator tokens are zero

* Attempt to fix simulation

* Add pending log entry

* Update docs

* Implement and use SharesFromTokens

* Rename ShareTokens and ShareTokensTruncated

* Rename Delegation to Amount in DelegateRequest

* Implement and use SharesFromTokensTruncated

* Update MsgDelegate to use Amount instead of Value

* Use constructors in staking sim messages

* Implement and use ValidateUnbondAmount
2019-03-25 17:13:02 -04:00
Christopher Goes 4c50380181
Merge PR #3750: Outstanding per-validator rewards; correctly handle same-BeginBlock redelegation-double-slash 2019-03-06 19:54:12 +01:00
Alexander Bezobchuk b9be1166f7 Merge PR #3673: Message & Codec Registration Consistency 2019-02-25 16:16:52 +01:00
frog power 4000 7f74b33e21 Merge PR #3357: Staking spec upgrades / some renaming 2019-02-09 00:57:33 +01:00
Christopher Goes 6ee9c97a5e Merge PR #3561: Don't store denominations in staking 2019-02-08 13:28:53 -08:00
Juan Leni b5fdb83830 Merge PR #3517: Increasing test coverage in keys/client package 2019-02-08 12:45:23 -08:00
Sunny Aggarwal cff985ffc5 Merge PR #3546: Min Self Delegation 2019-02-08 12:44:19 -08:00
Christopher Goes 38068a59ea Merge PR #3507: Results from x/staking & x/slashing peer review 2019-02-07 17:41:23 -08:00
frog power 4000 dc75eb4eb8 Merge PR #3372: Limit unbonding delegation / redelegations 2019-01-24 23:44:31 +01:00
Jack Zampolin af60c75dd3 Merge PR #3352: Reenable simulation tests 2019-01-24 22:01:32 +01:00
frog power 4000 7f789d2ed3
Merge PR #3281: Staking Spec Upgrade
* remove kv seperation for marshalling

* pending

* cleanup

* cleanup x2

* pending

* working

* minor refactors

* entry structs defined

* uncompiled mechanism written

* add many compile fixes

* code compiles

* fix test compile errors

* test cover passes

* ...

* multiple entries fix

* ...

* more design fix

* working

* fix test cover bug

* Update PENDING.md

* update comment around queue completion for redelegations/ubds

* basic spec updates

* spec folder cleanup

* cleanup docs folder cont.

* ...

* find-replace and folder rename

* supplimentary find/replace

* pending

* supplimentary

* pending

* few undos, stakingd -> staked

* to staking -> to stake

* undos

* most staking -> most stake

* ...

* undos

* simplestake->simplestaking

* ...

* pending update

* capital letter replacements

* ...

* working

* staking doc updates from rigel/delegation-index branch

* spec-spec

* spec-spec

* LooseTokens -> NotBondedTokens

* staking state.md updates

* updates to hook and endblock spec

* Update docs/gaia/gaiacli.md

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* Update docs/gaia/validators/validator-setup.md

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* Update docs/gaia/validators/validator-setup.md

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* comment undo

* remove ErrConflictingRedelegation

* @cwgoes comments are resolved

* further updates to endblock and state

* msg json update

* working transaction updates

* working

* complete transaction rewrite

* PENDING.md

* typo

* add todo

* address @jackzampolin @cwgoes comments

* couple leftover comments, rename

* Update x/staking/types/pool.go

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* cwgoes additions

* cwgoes suggestions x2
2019-01-21 19:52:03 -05:00
frog power 4000 8f7a222308 Merge PR #3314: Staking misc rename 2019-01-17 18:53:22 +01:00
Christopher Goes 2942f83ff5
Merge PR #3099: F1 fee distribution 2019-01-16 22:38:05 +01:00
frog power 4000 133934ae37
Merge PR #3243: allow multiple simultaneous redelegations/ubds between same delegator/validator(s) addresses
* remove kv seperation for marshalling

* pending

* cleanup

* cleanup x2

* pending

* working

* minor refactors

* entry structs defined

* uncompiled mechanism written

* add many compile fixes

* code compiles

* fix test compile errors

* test cover passes

* ...

* multiple entries fix

* ...

* more design fix

* working

* fix test cover bug

* Update PENDING.md

* update comment around queue completion for redelegations/ubds

* basic spec updates

* remove ErrConflictingRedelegation

* @cwgoes comments are resolved

* Update x/staking/keeper/slash.go

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* address @alexanderbez comments
2019-01-16 05:35:18 -05:00
Alexander Bezobchuk a984a22373 Merge PR #2694: Vesting Account(s) Implementation 2019-01-14 17:11:24 +01:00
frog power 4000 78a21353da Rename stake/ to staking/ (#3280) 2019-01-11 12:08:01 -08:00