-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: migrate away from using valBech32 globals (2/2) #17157
Conversation
@@ -60,13 +60,18 @@ | |||
panic("stake should not be negative") | |||
} | |||
|
|||
valBz, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) | |||
if err != nil { | |||
panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
02f3a11
to
1a9f45f
Compare
this commit makes things pretty ugly, 1a9f45f. Not sure any other way around this, but we should def break this api in the near future and clean all this up still need to add changelogs for all the breaks, but i will mark it as r4r for reviews now |
im going to try the altvalue codec for this type to see what the difference is, this pr isn't the best |
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.
That's ... verbose 😅 but it is not that ugly, only tests are.
1e823d1
to
124d3d4
Compare
func FromABCIEvidence(e comet.Evidence) *Equivocation { | ||
bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() | ||
consAddr, err := sdk.Bech32ifyAddressBytes(bech32PrefixConsAddr, e.Validator().Address()) | ||
func FromABCIEvidence(e comet.Evidence, conAc address.Codec) *Equivocation { |
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.
Changelog needed.
@@ -49,8 +50,8 @@ func (e *Equivocation) ValidateBasic() error { | |||
|
|||
// GetConsensusAddress returns the validator's consensus address at time of the | |||
// Equivocation infraction. | |||
func (e Equivocation) GetConsensusAddress() sdk.ConsAddress { | |||
addr, _ := sdk.ConsAddressFromBech32(e.ConsensusAddress) | |||
func (e Equivocation) GetConsensusAddress(consAc address.Codec) sdk.ConsAddress { |
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.
ditto
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.
utACK
Co-authored-by: marbar3778 <marbar3778@yahoo.com> (cherry picked from commit e60c583) # Conflicts: # CHANGELOG.md # simapp/export.go # tests/integration/distribution/keeper/grpc_query_test.go # tests/integration/distribution/keeper/msg_server_test.go # tests/integration/gov/keeper/tally_test.go # tests/integration/staking/keeper/determinstic_test.go # tests/integration/staking/keeper/grpc_query_test.go # x/distribution/keeper/allocation.go # x/distribution/keeper/allocation_test.go # x/distribution/keeper/delegation.go # x/distribution/keeper/validator.go # x/distribution/simulation/operations.go # x/distribution/simulation/operations_test.go # x/distribution/testutil/staking_helper.go # x/evidence/testutil/expected_keepers_mocks.go # x/evidence/types/expected_keepers.go # x/slashing/simulation/operations_test.go # x/staking/keeper/delegation.go # x/staking/keeper/grpc_query.go # x/staking/keeper/historical_info_test.go # x/staking/keeper/query_utils.go # x/staking/keeper/validator.go # x/staking/simulation/operations_test.go # x/staking/types/historical_info_test.go # x/staking/types/keys.go
Description
this pr aims ot migrate away from using valaddress bech32 globals
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
make lint
andmake test
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...
!
in the type prefix if API or client breaking change