refactor(baseapp): set vote info to latest votes (#15930)
This commit is contained in:
parent
7041af0f4d
commit
91872abdc0
@ -111,6 +111,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (x/feegrant) [#14294](https://github.com/cosmos/cosmos-sdk/pull/14294) Moved the logic of rejecting duplicate grant from `msg_server` to `keeper` method.
|
||||
* (x/staking) [#14590](https://github.com/cosmos/cosmos-sdk/pull/14590) `MsgUndelegateResponse` now includes undelegated amount. `x/staking` module's `keeper.Undelegate` now returns 3 values (completionTime,undelegateAmount,error) instead of 2.
|
||||
* (x/staking) (#15731) (https://github.com/cosmos/cosmos-sdk/pull/15731) Introducing a new index to retrieve the delegations by validator efficiently.
|
||||
* (baseapp) [#15930](https://github.com/cosmos/cosmos-sdk/pull/15930) change vote info provided by prepare and process proposal to the one in the block
|
||||
|
||||
### API Breaking Changes
|
||||
|
||||
@ -173,9 +174,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (x/slashing) [#15875](https://github.com/cosmos/cosmos-sdk/pull/15875) `x/slashing.NewAppModule` now requires an `InterfaceRegistry` parameter.
|
||||
* (client) [#15822](https://github.com/cosmos/cosmos-sdk/pull/15822) The return type of the interface method `TxConfig.SignModeHandler` has been changed to `x/tx/signing.HandlerMap`.
|
||||
* (x/auth) [#15822](https://github.com/cosmos/cosmos-sdk/pull/15822) The type of struct field `ante.HandlerOptions.SignModeHandler` has been changed to `x/tx/signing.HandlerMap`.
|
||||
* The signature of `NewSigVerificationDecorator` has been changed to accept a `x/tx/signing.HandlerMap`.
|
||||
* The signature of `VerifySignature` has been changed to accept a `x/tx/signing.HandlerMap` and other structs from `x/tx` as arguments.
|
||||
* The signature of `NewTxConfigWithTextual` has been deprecated and its signature changed to accept a `SignModeOptions`.
|
||||
* The signature of `NewSigVerificationDecorator` has been changed to accept a `x/tx/signing.HandlerMap`.
|
||||
* The signature of `VerifySignature` has been changed to accept a `x/tx/signing.HandlerMap` and other structs from `x/tx` as arguments.
|
||||
* The signature of `NewTxConfigWithTextual` has been deprecated and its signature changed to accept a `SignModeOptions`.
|
||||
|
||||
### Client Breaking Changes
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ func (app *BaseApp) PrepareProposal(req abci.RequestPrepareProposal) (resp abci.
|
||||
}
|
||||
|
||||
app.prepareProposalState.ctx = app.getContextForProposal(app.prepareProposalState.ctx, req.Height).
|
||||
WithVoteInfos(app.voteInfos).
|
||||
WithVoteInfos(toVoteInfo(req.LocalLastCommit.Votes)). // this is a set of votes that are not finalized yet, wait for commit
|
||||
WithBlockHeight(req.Height).
|
||||
WithBlockTime(req.Time).
|
||||
WithProposer(req.ProposerAddress)
|
||||
@ -341,7 +341,7 @@ func (app *BaseApp) ProcessProposal(req abci.RequestProcessProposal) (resp abci.
|
||||
app.setState(runTxProcessProposal, emptyHeader)
|
||||
|
||||
app.processProposalState.ctx = app.getContextForProposal(app.processProposalState.ctx, req.Height).
|
||||
WithVoteInfos(app.voteInfos).
|
||||
WithVoteInfos(req.ProposedLastCommit.Votes). // this is a set of votes that are not finalized yet, wait for commit
|
||||
WithBlockHeight(req.Height).
|
||||
WithBlockTime(req.Time).
|
||||
WithHeaderHash(req.Hash).
|
||||
@ -1036,3 +1036,19 @@ func (app *BaseApp) getContextForProposal(ctx sdk.Context, height int64) sdk.Con
|
||||
|
||||
return ctx
|
||||
}
|
||||
|
||||
// toVoteInfo converts the new ExtendedVoteInfo to VoteInfo.
|
||||
func toVoteInfo(votes []abci.ExtendedVoteInfo) []abci.VoteInfo {
|
||||
legacyVotes := make([]abci.VoteInfo, len(votes))
|
||||
for i, vote := range votes {
|
||||
legacyVotes[i] = abci.VoteInfo{
|
||||
Validator: abci.Validator{
|
||||
Address: vote.Validator.Address,
|
||||
Power: vote.Validator.Power,
|
||||
},
|
||||
SignedLastBlock: vote.SignedLastBlock,
|
||||
}
|
||||
}
|
||||
|
||||
return legacyVotes
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user