-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat: [Interchain Security] Remove dependency on transient store #12845
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ import ( | |
abci "github.com/tendermint/tendermint/abci/types" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/cosmos-sdk/x/staking/types" | ||
) | ||
|
||
|
@@ -134,10 +133,6 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab | |
// part of the bonded validator set | ||
valAddr := sdk.ValAddress(iterator.Value()) | ||
validator := k.mustGetValidator(ctx, valAddr) | ||
consAddr, err := validator.GetConsAddr() | ||
if err != nil { | ||
return nil, sdkerrors.Wrapf(err, "invalid consensus address for validator %s", valAddr) | ||
} | ||
|
||
if validator.Jailed { | ||
panic("should never retrieve a jailed validator from the power store") | ||
|
@@ -184,7 +179,6 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab | |
update := validator.ABCIValidatorUpdate(powerReduction) | ||
updates = append(updates, update) | ||
// set the validator update and power | ||
k.SetValidatorUpdate(ctx, consAddr, update) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was this doing and why is it no longer needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was setting the validator updates one at a time. I replace it with a single call that sets an array of validator updates. The original code was already collecting this array, i.e.,
|
||
k.SetLastValidatorPower(ctx, valAddr, newPower) | ||
} | ||
|
||
|
@@ -207,18 +201,10 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab | |
return nil, err | ||
} | ||
|
||
consAddr, err := validator.GetConsAddr() | ||
if err != nil { | ||
return nil, sdkerrors.Wrapf(err, "invalid consensus address for validator %s", valAddr) | ||
} | ||
|
||
amtFromBondedToNotBonded = amtFromBondedToNotBonded.Add(validator.GetTokens()) | ||
k.DeleteLastValidatorPower(ctx, validator.GetOperator()) | ||
update := validator.ABCIValidatorUpdateZero() | ||
updates = append(updates, update) | ||
|
||
// set the validator update to transient store | ||
k.SetValidatorUpdate(ctx, consAddr, update) | ||
} | ||
|
||
// Update the pools based on the recent updates in the validator set: | ||
|
@@ -241,6 +227,9 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab | |
k.SetLastTotalPower(ctx, totalPower) | ||
} | ||
|
||
// set the list of validator updates | ||
k.SetValidatorUpdates(ctx, updates) | ||
|
||
return updates, nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this dead code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I couldn't find anything within SDK or IS calling it.