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

Slashing v2 #1278

Merged
merged 147 commits into from
Jun 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
3d0e7ff
stake/fees spec updates
rigelrozanski May 17, 2018
43a0ed9
staking overview.md revisions, moving files
rigelrozanski May 18, 2018
a49f9cb
docs reorganization
rigelrozanski May 18, 2018
f972cab
staking spec state revisions
rigelrozanski May 23, 2018
752f084
transaction stake updates
rigelrozanski May 25, 2018
5a77d7d
complete staking spec update
rigelrozanski May 29, 2018
26681a8
WIP adding unbonding/redelegation commands
rigelrozanski Jun 2, 2018
8e677e8
added msg types for unbonding, redelegation
rigelrozanski Jun 2, 2018
43429ef
stake sub-package reorg
rigelrozanski Jun 2, 2018
482a3c5
...
rigelrozanski Jun 2, 2018
fd1eb5f
working stake reorg
rigelrozanski Jun 3, 2018
63a0dcc
...
rigelrozanski Jun 5, 2018
7eaa715
...
rigelrozanski Jun 5, 2018
3fac834
modify lcd tests to not use hardcoded json strings
rigelrozanski Jun 5, 2018
d69d179
add description update
rigelrozanski Jun 5, 2018
0efb0a4
index keys
rigelrozanski Jun 5, 2018
2153e0d
...
rigelrozanski Jun 5, 2018
f6b9893
...
rigelrozanski Jun 5, 2018
e460c06
key managment for unbonding redelegation complete
rigelrozanski Jun 6, 2018
8639f91
...
rigelrozanski Jun 6, 2018
9ee70ea
update stake errors
rigelrozanski Jun 6, 2018
bd41980
...
rigelrozanski Jun 6, 2018
40ad0a5
completed handleMsgCompleteUnbonding fn
rigelrozanski Jun 6, 2018
4be5e41
updated to use begin/complete unbonding/redelegation
rigelrozanski Jun 7, 2018
03c6804
...
rigelrozanski Jun 7, 2018
98dad7d
fix token shares bug
rigelrozanski Jun 13, 2018
4601bd5
develop docs into unbonding
rigelrozanski Jun 14, 2018
fc6ee07
...
rigelrozanski Jun 14, 2018
ffc8cc4
...
rigelrozanski Jun 14, 2018
6a5bc2d
Merge remote-tracking branch 'origin/develop' into rigel/unbonding
rigelrozanski Jun 16, 2018
436f32d
got non-tests compiling after merge develop
rigelrozanski Jun 17, 2018
37190aa
working fixing tests
rigelrozanski Jun 19, 2018
ed7b90e
PrivlegedKeeper -> PrivilegedKeeper
rigelrozanski Jun 19, 2018
af4fd6e
tests compile
rigelrozanski Jun 19, 2018
1d7d4d4
Merge remote-tracking branch 'origin/develop' into rigel/unbonding
rigelrozanski Jun 20, 2018
d427af7
fix some tests
rigelrozanski Jun 20, 2018
a0ac5e9
fixing tests
rigelrozanski Jun 20, 2018
b72a219
Merge branch 'develop' into rigel/unbonding
rigelrozanski Jun 20, 2018
8860fa3
remove PrivilegedKeeper
rigelrozanski Jun 20, 2018
24395fd
...
rigelrozanski Jun 20, 2018
258834f
...
rigelrozanski Jun 20, 2018
9ce6759
get unbonding bug
rigelrozanski Jun 20, 2018
1ae48da
only rpc sig verification failed tests now
rigelrozanski Jun 20, 2018
bc2e0d7
Merge branch 'develop' into rigel/unbonding
rigelrozanski Jun 20, 2018
ad73cd1
...
rigelrozanski Jun 20, 2018
60158d5
move percent unbonding/redelegation to the CLI and out of handler logic
rigelrozanski Jun 20, 2018
b1cb149
remove min unbonding height
rigelrozanski Jun 21, 2018
3cd8478
add lcd txs
rigelrozanski Jun 21, 2018
a3e04ce
add pool sanity checks, fix a buncha tests
rigelrozanski Jun 21, 2018
782afbb
fix ante. set lcd log to debug (#1322)
ebuchman Jun 21, 2018
ad9da64
Merge branch 'develop' into rigel/unbonding
rigelrozanski Jun 21, 2018
071d47b
redelegation tests, adding query functionality for bonds
rigelrozanski Jun 22, 2018
5dc163c
add self-delegations at genesis ref #1165
rigelrozanski Jun 22, 2018
bdc437e
Tweak constants for testnet, tag address correctly
cwgoes Jun 16, 2018
2f42a2b
Unbond and jail validators when they double-sign
cwgoes Jun 22, 2018
72d36d1
Pass power through x/slashing/tick & ValidatorSet.Slash
cwgoes Jun 22, 2018
182d0cb
SlashingKeeper DRY
cwgoes Jun 22, 2018
683b64a
Use power at time of equivocation
cwgoes Jun 22, 2018
0d38a72
Updated slash function in progress
cwgoes Jun 23, 2018
6e2c66c
PR comments (mostly) addressed
rigelrozanski Jun 23, 2018
f004c6c
cleanup, added Query LCD functionality
rigelrozanski Jun 25, 2018
ceb8856
test cleanup/fixes
rigelrozanski Jun 25, 2018
9f99a17
Merge remote-tracking branch 'origin/develop' into rigel/unbonding
rigelrozanski Jun 25, 2018
32b75c5
fix governance test
rigelrozanski Jun 25, 2018
85c3639
Merge branch 'develop' into rigel/unbonding
rigelrozanski Jun 25, 2018
177ab4c
SlashValidatorSet -> ValidatorSet
rigelrozanski Jun 25, 2018
3f4e528
changelog
rigelrozanski Jun 25, 2018
c7433c9
Add iterator functions over redelegations & unbonding delegations by …
cwgoes Jun 25, 2018
f5dbcfd
Merge branch 'rigel/unbonding' into cwgoes/slashing-version-two
cwgoes Jun 25, 2018
de8b5b1
Iterate through unbonding delegations & redelegations in keeper.Slash()
cwgoes Jun 25, 2018
3e18286
Initialize unbonding delegation & redelegation properly
cwgoes Jun 25, 2018
40b9faf
stake lcd fix
rigelrozanski Jun 25, 2018
a500931
...
rigelrozanski Jun 25, 2018
c916f21
...
rigelrozanski Jun 25, 2018
587e9fd
Update staking testcase, update slashing docs
cwgoes Jun 25, 2018
82f3529
Merge branch 'develop' into rigel/unbonding
ebuchman Jun 25, 2018
2a34342
Reorder slashing end block docs, s/equivocation/infraction/g
cwgoes Jun 25, 2018
d5ab2f3
x/auth: fix chainID in ante
ebuchman Jun 25, 2018
b8571b6
Merge branch 'rigel/unbonding' of https://github.com/cosmos/cosmos-sd…
rigelrozanski Jun 25, 2018
2511ef1
fix lcd test
rigelrozanski Jun 25, 2018
a0c9fed
Changelog & slashing REST handler
cwgoes Jun 25, 2018
86439ee
Add signing info query function
cwgoes Jun 25, 2018
a029cb9
...
rigelrozanski Jun 25, 2018
9cddb06
fix lint, update lint make command for spelling
rigelrozanski Jun 25, 2018
41bcf70
Separate out keeper.Slash()
cwgoes Jun 25, 2018
54b6ae5
Update slashing testcases
cwgoes Jun 26, 2018
e56c08b
Add testcases for revoke/unrevoke
cwgoes Jun 26, 2018
2659120
Remove hard-coded parameters from testcases
cwgoes Jun 26, 2018
3841a7a
Remove constant dependence from tick_test.go
cwgoes Jun 26, 2018
03273a7
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 26, 2018
c17b8e6
Slashing unit tests in progress
cwgoes Jun 26, 2018
dd3bdcb
Tweak testcases to avoid rounding issues
cwgoes Jun 26, 2018
48d1107
Minor optimizations; comments
cwgoes Jun 26, 2018
d93502d
Merge branch 'rigel/unbonding' into cwgoes/slashing-version-two
cwgoes Jun 26, 2018
c565dab
Testcases; minor bugfixes
cwgoes Jun 26, 2018
303fbe5
Add unit test for slashing with both an unbonding delegation & a rede…
cwgoes Jun 26, 2018
7170bd9
Merge remote-tracking branch 'origin/develop' into rigel/unbonding
rigelrozanski Jun 26, 2018
b7ece9a
Merge branch 'rigel/unbonding' into cwgoes/slashing-version-two
cwgoes Jun 26, 2018
74e0fb8
lowercase error string
rigelrozanski Jun 26, 2018
5329d73
don't expose coinkeeper in staking
rigelrozanski Jun 26, 2018
9be314e
Merge branch 'rigel/unbonding' into cwgoes/slashing-version-two
cwgoes Jun 26, 2018
1a945a2
Merge remote-tracking branch 'origin/develop' into rigel/unbonding
rigelrozanski Jun 26, 2018
ffaefec
remove a few duplicate lines in changelog
rigelrozanski Jun 26, 2018
0012a46
...
rigelrozanski Jun 26, 2018
0663984
Fix merge errors
cwgoes Jun 26, 2018
70605a2
Merge branch 'rigel/unbonding' into cwgoes/slashing-version-two
cwgoes Jun 26, 2018
6f2c29b
chain_id in stake lcd tests
rigelrozanski Jun 26, 2018
a6c0381
Pool account in progress
cwgoes Jun 26, 2018
637b275
Merge branch 'develop' into rigel/unbonding
cwgoes Jun 27, 2018
4908504
added transient redelegation
rigelrozanski Jun 27, 2018
34e46ac
Merge branch 'rigel/unbonding' of https://github.com/cosmos/cosmos-sd…
rigelrozanski Jun 27, 2018
f499b88
'transient' => 'transitive'
cwgoes Jun 27, 2018
bcace44
Merge branch 'develop' into rigel/unbonding
cwgoes Jun 27, 2018
de77006
Re-add nolint instruction
cwgoes Jun 27, 2018
791ad9c
Fix tiny linter error
cwgoes Jun 27, 2018
44378a1
Clarify comment
cwgoes Jun 27, 2018
a901ed6
Merge branch 'rigel/unbonding' into cwgoes/slashing-version-two
cwgoes Jun 27, 2018
5449296
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 27, 2018
12fc6a9
Remove accidental changelog entry from merge
cwgoes Jun 27, 2018
08597c9
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 27, 2018
cff38d8
Add LCD test for signing info REST handler
cwgoes Jun 27, 2018
1d97ed6
Update democoin mock validator set
cwgoes Jun 27, 2018
f178308
Address some PR comments
cwgoes Jun 28, 2018
1e75912
Add efficiency optimizations
cwgoes Jun 28, 2018
a133bc5
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 28, 2018
8895552
Address more PR comments
cwgoes Jun 28, 2018
97eed84
Add more explanatory comments
cwgoes Jun 28, 2018
3d3189c
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 28, 2018
220d03f
Overslashing / recursive slashing tests for unbonding delegations
cwgoes Jun 28, 2018
7ab62b4
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 29, 2018
554a72b
More unit tests
cwgoes Jun 29, 2018
3c25861
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 29, 2018
99fec69
Add additional testcase clauses
cwgoes Jun 29, 2018
e43bbef
Update slashing parameters
cwgoes Jun 29, 2018
c76a8e1
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 29, 2018
cb85459
Linter fixes
cwgoes Jun 29, 2018
4edb773
Add slashing test to x/stake handler
cwgoes Jun 29, 2018
78ac9ae
Clarify a few comments
cwgoes Jun 29, 2018
b00a0a1
Unify comment format
cwgoes Jun 29, 2018
f8dd859
Remove redundant sdk.Coin{}
cwgoes Jun 29, 2018
c1987da
Update changelog
cwgoes Jun 30, 2018
9bc99f1
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 30, 2018
30d9d90
Change CircleCI config slightly
cwgoes Jun 30, 2018
aeea789
Merge branch 'develop' into cwgoes/slashing-version-two
cwgoes Jun 30, 2018
9ff81a6
Change jail durations to five minutes
cwgoes Jun 30, 2018
5a479e0
Address PR comments
cwgoes Jun 30, 2018
e46e687
Add additional comment
cwgoes Jun 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove PrivilegedKeeper
  • Loading branch information
rigelrozanski committed Jun 20, 2018
commit 8860fa301c439503111054dec09e792c2bf13818
4 changes: 2 additions & 2 deletions cmd/gaia/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type GaiaApp struct {
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
ibcMapper ibc.Mapper
stakeKeeper stake.PrivilegedKeeper
stakeKeeper stake.Keeper
slashingKeeper slashing.Keeper
}

Expand Down Expand Up @@ -75,7 +75,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB) *GaiaApp {
// add handlers
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace))
app.stakeKeeper = stake.NewPrivilegedKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.RegisterCodespace(slashing.DefaultCodespace))

// register message routes
Expand Down
4 changes: 2 additions & 2 deletions cmd/gaia/cmd/gaiadebug/hack.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ type GaiaApp struct {
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
ibcMapper ibc.Mapper
stakeKeeper stake.PrivilegedKeeper
stakeKeeper stake.Keeper
slashingKeeper slashing.Keeper
}

Expand Down Expand Up @@ -164,7 +164,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB) *GaiaApp {
// add handlers
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace))
app.stakeKeeper = stake.NewPrivilegedKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.RegisterCodespace(slashing.DefaultCodespace))

// register message routes
Expand Down
4 changes: 2 additions & 2 deletions examples/basecoin/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type BasecoinApp struct {
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
ibcMapper ibc.Mapper
stakeKeeper stake.PrivilegedKeeper
stakeKeeper stake.Keeper
slashingKeeper slashing.Keeper
}

Expand Down Expand Up @@ -72,7 +72,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp {
// add accountMapper/handlers
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace))
app.stakeKeeper = stake.NewPrivilegedKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.RegisterCodespace(slashing.DefaultCodespace))

// register message routes
Expand Down
2 changes: 1 addition & 1 deletion server/tm_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func UnsafeResetAllCmd(ctx *Context) *cobra.Command {
Short: "Reset blockchain database, priv_validator.json file, and the logger",
RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config
tcmd.ResetAll(cfg.DBDir(), cfg.PrivValidatorFile(), ctx.Logger)
tcmd.ResetAll(cfg.DBDir(), cfg.P2P.AddrBookFile(), cfg.PrivValidatorFile(), ctx.Logger)
return nil
},
}
Expand Down
10 changes: 5 additions & 5 deletions x/slashing/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ var (
)

// initialize the mock application for this module
func getMockApp(t *testing.T) (*mock.App, stake.PrivilegedKeeper, Keeper) {
func getMockApp(t *testing.T) (*mock.App, stake.Keeper, Keeper) {
mapp := mock.NewApp()

RegisterWire(mapp.Cdc)
keyStake := sdk.NewKVStoreKey("stake")
keySlashing := sdk.NewKVStoreKey("slashing")
coinKeeper := bank.NewKeeper(mapp.AccountMapper)
stakeKeeper := stake.NewPrivilegedKeeper(mapp.Cdc, keyStake, coinKeeper, mapp.RegisterCodespace(stake.DefaultCodespace))
stakeKeeper := stake.NewKeeper(mapp.Cdc, keyStake, coinKeeper, mapp.RegisterCodespace(stake.DefaultCodespace))
keeper := NewKeeper(mapp.Cdc, keySlashing, stakeKeeper, mapp.RegisterCodespace(DefaultCodespace))
mapp.Router().AddRoute("stake", stake.NewHandler(stakeKeeper))
mapp.Router().AddRoute("slashing", NewHandler(keeper))
Expand All @@ -42,7 +42,7 @@ func getMockApp(t *testing.T) (*mock.App, stake.PrivilegedKeeper, Keeper) {
}

// stake endblocker
func getEndBlocker(keeper stake.PrivilegedKeeper) sdk.EndBlocker {
func getEndBlocker(keeper stake.Keeper) sdk.EndBlocker {
return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
validatorUpdates := stake.EndBlocker(ctx, keeper)
return abci.ResponseEndBlock{
Expand All @@ -52,15 +52,15 @@ func getEndBlocker(keeper stake.PrivilegedKeeper) sdk.EndBlocker {
}

// overwrite the mock init chainer
func getInitChainer(mapp *mock.App, keeper stake.PrivilegedKeeper) sdk.InitChainer {
func getInitChainer(mapp *mock.App, keeper stake.Keeper) sdk.InitChainer {
return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
mapp.InitChainer(ctx, req)
keeper.InitGenesis(ctx, stake.DefaultGenesisState())
return abci.ResponseInitChain{}
}
}

func checkValidator(t *testing.T, mapp *mock.App, keeper stake.PrivilegedKeeper,
func checkValidator(t *testing.T, mapp *mock.App, keeper stake.Keeper,
addr sdk.Address, expFound bool) stake.Validator {
ctxCheck := mapp.BaseApp.NewContext(true, abci.Header{})
validator, found := keeper.GetValidator(ctxCheck, addr1)
Expand Down
4 changes: 2 additions & 2 deletions x/slashing/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func createTestCodec() *wire.Codec {
return cdc
}

func createTestInput(t *testing.T) (sdk.Context, bank.Keeper, stake.PrivilegedKeeper, Keeper) {
func createTestInput(t *testing.T) (sdk.Context, bank.Keeper, stake.Keeper, Keeper) {
keyAcc := sdk.NewKVStoreKey("acc")
keyStake := sdk.NewKVStoreKey("stake")
keySlashing := sdk.NewKVStoreKey("slashing")
Expand All @@ -61,7 +61,7 @@ func createTestInput(t *testing.T) (sdk.Context, bank.Keeper, stake.PrivilegedKe
cdc := createTestCodec()
accountMapper := auth.NewAccountMapper(cdc, keyAcc, &auth.BaseAccount{})
ck := bank.NewKeeper(accountMapper)
sk := stake.NewPrivilegedKeeper(cdc, keyStake, ck, stake.DefaultCodespace)
sk := stake.NewKeeper(cdc, keyStake, ck, stake.DefaultCodespace)
genesis := stake.DefaultGenesisState()
genesis.Pool.LooseUnbondedTokens = initCoins.MulRaw(int64(len(addrs))).Int64()
sk.InitGenesis(ctx, genesis)
Expand Down
12 changes: 6 additions & 6 deletions x/stake/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ var (
)

// initialize the mock application for this module
func getMockApp(t *testing.T) (*mock.App, PrivilegedKeeper) {
func getMockApp(t *testing.T) (*mock.App, Keeper) {
mapp := mock.NewApp()

RegisterWire(mapp.Cdc)
keyStake := sdk.NewKVStoreKey("stake")
coinKeeper := bank.NewKeeper(mapp.AccountMapper)
keeper := NewPrivilegedKeeper(mapp.Cdc, keyStake, coinKeeper, mapp.RegisterCodespace(DefaultCodespace))
keeper := NewKeeper(mapp.Cdc, keyStake, coinKeeper, mapp.RegisterCodespace(DefaultCodespace))
mapp.Router().AddRoute("stake", NewHandler(keeper))

mapp.SetEndBlocker(getEndBlocker(keeper))
Expand All @@ -47,7 +47,7 @@ func getMockApp(t *testing.T) (*mock.App, PrivilegedKeeper) {
}

// stake endblocker
func getEndBlocker(keeper PrivilegedKeeper) sdk.EndBlocker {
func getEndBlocker(keeper Keeper) sdk.EndBlocker {
return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
validatorUpdates := EndBlocker(ctx, keeper)
return abci.ResponseEndBlock{
Expand All @@ -57,7 +57,7 @@ func getEndBlocker(keeper PrivilegedKeeper) sdk.EndBlocker {
}

// overwrite the mock init chainer
func getInitChainer(mapp *mock.App, keeper PrivilegedKeeper) sdk.InitChainer {
func getInitChainer(mapp *mock.App, keeper Keeper) sdk.InitChainer {
return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
mapp.InitChainer(ctx, req)
keeper.InitGenesis(ctx, DefaultGenesisState())
Expand All @@ -68,7 +68,7 @@ func getInitChainer(mapp *mock.App, keeper PrivilegedKeeper) sdk.InitChainer {

//__________________________________________________________________________________________

func checkValidator(t *testing.T, mapp *mock.App, keeper PrivilegedKeeper,
func checkValidator(t *testing.T, mapp *mock.App, keeper Keeper,
addr sdk.Address, expFound bool) Validator {

ctxCheck := mapp.BaseApp.NewContext(true, abci.Header{})
Expand All @@ -77,7 +77,7 @@ func checkValidator(t *testing.T, mapp *mock.App, keeper PrivilegedKeeper,
return validator
}

func checkDelegation(t *testing.T, mapp *mock.App, keeper PrivilegedKeeper, delegatorAddr,
func checkDelegation(t *testing.T, mapp *mock.App, keeper Keeper, delegatorAddr,
validatorAddr sdk.Address, expFound bool, expShares sdk.Rat) {

ctxCheck := mapp.BaseApp.NewContext(true, abci.Header{})
Expand Down
18 changes: 9 additions & 9 deletions x/stake/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/stake/types"
)

func NewHandler(k keeper.PrivilegedKeeper) sdk.Handler {
func NewHandler(k keeper.Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
// NOTE msg already has validate basic run
switch msg := msg.(type) {
Expand All @@ -36,7 +36,7 @@ func NewHandler(k keeper.PrivilegedKeeper) sdk.Handler {
}

// Called every block, process inflation, update validator set
func EndBlocker(ctx sdk.Context, k keeper.PrivilegedKeeper) (ValidatorUpdates []abci.Validator) {
func EndBlocker(ctx sdk.Context, k keeper.Keeper) (ValidatorUpdates []abci.Validator) {
pool := k.GetPool(ctx)

// Process types.Validator Provisions
Expand All @@ -63,7 +63,7 @@ func EndBlocker(ctx sdk.Context, k keeper.PrivilegedKeeper) (ValidatorUpdates []
// These functions assume everything has been authenticated,
// now we just perform action and save

func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k keeper.Keeper) sdk.Result {

// check to see if the pubkey or sender has been registered before
_, found := k.GetValidator(ctx, msg.ValidatorAddr)
Expand Down Expand Up @@ -99,7 +99,7 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k
}
}

func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keeper.Keeper) sdk.Result {

// validator must already be registered
validator, found := k.GetValidator(ctx, msg.ValidatorAddr)
Expand All @@ -126,7 +126,7 @@ func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keepe
}
}

func handleMsgDelegate(ctx sdk.Context, msg types.MsgDelegate, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgDelegate(ctx sdk.Context, msg types.MsgDelegate, k keeper.Keeper) sdk.Result {

validator, found := k.GetValidator(ctx, msg.ValidatorAddr)
if !found {
Expand Down Expand Up @@ -155,7 +155,7 @@ func handleMsgDelegate(ctx sdk.Context, msg types.MsgDelegate, k keeper.Privileg
}
}

func handleMsgBeginUnbonding(ctx sdk.Context, msg types.MsgBeginUnbonding, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgBeginUnbonding(ctx sdk.Context, msg types.MsgBeginUnbonding, k keeper.Keeper) sdk.Result {

delegation, validator, pool, returnAmount, err := k.UnbondDelegation(ctx, msg.DelegatorAddr, msg.ValidatorAddr, msg.SharesAmount)
if err != nil {
Expand Down Expand Up @@ -193,7 +193,7 @@ func handleMsgBeginUnbonding(ctx sdk.Context, msg types.MsgBeginUnbonding, k kee
return sdk.Result{Tags: tags}
}

func handleMsgCompleteUnbonding(ctx sdk.Context, msg types.MsgCompleteUnbonding, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgCompleteUnbonding(ctx sdk.Context, msg types.MsgCompleteUnbonding, k keeper.Keeper) sdk.Result {

ubd, found := k.GetUnbondingDelegation(ctx, msg.DelegatorAddr, msg.ValidatorAddr)
if !found {
Expand Down Expand Up @@ -230,7 +230,7 @@ func handleMsgCompleteUnbonding(ctx sdk.Context, msg types.MsgCompleteUnbonding,
return sdk.Result{Tags: tags}
}

func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k keeper.Keeper) sdk.Result {

delegation, srcValidator, pool, returnAmount, err := k.UnbondDelegation(ctx, msg.DelegatorAddr, msg.ValidatorSrcAddr, msg.SharesAmount)
if err != nil {
Expand Down Expand Up @@ -278,7 +278,7 @@ func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k k
return sdk.Result{Tags: tags}
}

func handleMsgCompleteRedelegate(ctx sdk.Context, msg types.MsgCompleteRedelegate, k keeper.PrivilegedKeeper) sdk.Result {
func handleMsgCompleteRedelegate(ctx sdk.Context, msg types.MsgCompleteRedelegate, k keeper.Keeper) sdk.Result {

red, found := k.GetRedelegation(ctx, msg.DelegatorAddr, msg.ValidatorSrcAddr, msg.ValidatorDstAddr)
if !found {
Expand Down
18 changes: 9 additions & 9 deletions x/stake/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (k Keeper) GetDelegation(ctx sdk.Context,
}

// load all delegations used during genesis dump
func (k PrivilegedKeeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation) {
func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation) {
store := ctx.KVStore(k.storeKey)
iterator := sdk.KVStorePrefixIterator(store, DelegationKey)

Expand Down Expand Up @@ -66,20 +66,20 @@ func (k Keeper) GetDelegations(ctx sdk.Context, delegator sdk.Address,
}

// set the delegation
func (k PrivilegedKeeper) SetDelegation(ctx sdk.Context, delegation types.Delegation) {
func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation) {
store := ctx.KVStore(k.storeKey)
b := k.cdc.MustMarshalBinary(delegation)
store.Set(GetDelegationKey(delegation.DelegatorAddr, delegation.ValidatorAddr, k.cdc), b)
}

// remove the delegation
func (k PrivilegedKeeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation) {
func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation) {
store := ctx.KVStore(k.storeKey)
store.Delete(GetDelegationKey(delegation.DelegatorAddr, delegation.ValidatorAddr, k.cdc))
}

// common functionality between handlers
func (k PrivilegedKeeper) Delegate(ctx sdk.Context, delegatorAddr sdk.Address, bondAmt sdk.Coin,
func (k Keeper) Delegate(ctx sdk.Context, delegatorAddr sdk.Address, bondAmt sdk.Coin,
validator types.Validator) (newShares sdk.Rat, delegation types.Delegation,
validator2 types.Validator, pool types.Pool, err sdk.Error) {

Expand Down Expand Up @@ -126,7 +126,7 @@ func (k Keeper) GetUnbondingDelegation(ctx sdk.Context,
}

// set the unbonding delegation and associated index
func (k PrivilegedKeeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation) {
func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshalBinary(ubd)
ubdKey := GetUBDKey(ubd.DelegatorAddr, ubd.ValidatorAddr, k.cdc)
Expand All @@ -135,15 +135,15 @@ func (k PrivilegedKeeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.Unbo
}

// remove the unbonding delegation object and associated index
func (k PrivilegedKeeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation) {
func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation) {
store := ctx.KVStore(k.storeKey)
ubdKey := GetUBDKey(ubd.DelegatorAddr, ubd.ValidatorAddr, k.cdc)
store.Delete(ubdKey)
store.Delete(GetUBDByValIndexKey(ubd.DelegatorAddr, ubd.ValidatorAddr, k.cdc))
}

// unbond the the delegation return
func (k PrivilegedKeeper) UnbondDelegation(ctx sdk.Context, delegatorAddr, validatorAddr sdk.Address,
func (k Keeper) UnbondDelegation(ctx sdk.Context, delegatorAddr, validatorAddr sdk.Address,
shares sdk.Rat) (delegation types.Delegation, validator types.Validator, pool types.Pool, amount int64, err sdk.Error) {

// check if delegation has any shares in it unbond
Expand Down Expand Up @@ -229,7 +229,7 @@ func (k Keeper) GetRedelegationDel(ctx sdk.Context, DelegatorAddr, ValidatorSrcA
}

// set a redelegation and associated index
func (k PrivilegedKeeper) SetRedelegation(ctx sdk.Context, red types.Redelegation) {
func (k Keeper) SetRedelegation(ctx sdk.Context, red types.Redelegation) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshalBinary(red)
redKey := GetREDKey(red.DelegatorAddr, red.ValidatorSrcAddr, red.ValidatorDstAddr, k.cdc)
Expand All @@ -239,7 +239,7 @@ func (k PrivilegedKeeper) SetRedelegation(ctx sdk.Context, red types.Redelegatio
}

// remove a redelegation object and associated index
func (k PrivilegedKeeper) RemoveRedelegation(ctx sdk.Context, red types.Redelegation) {
func (k Keeper) RemoveRedelegation(ctx sdk.Context, red types.Redelegation) {
store := ctx.KVStore(k.storeKey)
redKey := GetREDKey(red.DelegatorAddr, red.ValidatorSrcAddr, red.ValidatorDstAddr, k.cdc)
store.Delete(redKey)
Expand Down
4 changes: 2 additions & 2 deletions x/stake/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// InitGenesis - store genesis parameters
func (k PrivilegedKeeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
store := ctx.KVStore(k.storeKey)
k.SetPool(ctx, data.Pool)
k.SetNewParams(ctx, data.Params)
Expand All @@ -31,7 +31,7 @@ func (k PrivilegedKeeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
}

// WriteGenesis - output genesis parameters
func (k PrivilegedKeeper) WriteGenesis(ctx sdk.Context) types.GenesisState {
func (k Keeper) WriteGenesis(ctx sdk.Context) types.GenesisState {
pool := k.GetPool(ctx)
params := k.GetParams(ctx)
validators := k.GetAllValidators(ctx)
Expand Down
6 changes: 3 additions & 3 deletions x/stake/keeper/inflation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func checkFinalPoolValues(t *testing.T, pool types.Pool, initialTotalTokens, cum

// Processes provisions are added to the pool correctly every hour
// Returns expected Provisions, expected Inflation, and pool, to help with cumulative calculations back in main Tests
func updateProvisions(t *testing.T, keeper PrivilegedKeeper, pool types.Pool, ctx sdk.Context, hr int) (sdk.Rat, int64, types.Pool) {
func updateProvisions(t *testing.T, keeper Keeper, pool types.Pool, ctx sdk.Context, hr int) (sdk.Rat, int64, types.Pool) {
expInflation := keeper.NextInflation(ctx)
expProvisions := (expInflation.Mul(sdk.NewRat(pool.TokenSupply())).Quo(hrsPerYrRat)).Evaluate()
startTotalSupply := pool.TokenSupply()
Expand All @@ -306,8 +306,8 @@ func updateProvisions(t *testing.T, keeper PrivilegedKeeper, pool types.Pool, ct
// Deterministic setup of validators and pool
// Allows you to decide how many validators to setup
// Allows you to pick which validators are bonded by adjusting the MaxValidators of params
func setupTestValidators(pool types.Pool, keeper PrivilegedKeeper, ctx sdk.Context, validatorTokens []int64,
maxValidators uint16) ([]types.Validator, PrivilegedKeeper, types.Pool) {
func setupTestValidators(pool types.Pool, keeper Keeper, ctx sdk.Context, validatorTokens []int64,
maxValidators uint16) ([]types.Validator, Keeper, types.Pool) {

params := types.DefaultParams()
params.MaxValidators = maxValidators
Expand Down
Loading