-
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: remove global valaddress bech32 codec calls (1/2) #17098
Merged
Merged
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e341928
valAddress
tac0turtle 1a89049
refactor(codec): Modularize Address Codec (#17099)
itsdevbear 9f054f8
fix tests
tac0turtle de06bd7
lint
tac0turtle 28380cc
fix tests
tac0turtle e3c1797
fix e2e tests
tac0turtle 23bbc21
abstract final call to valAddress.String in staking
tac0turtle b7a5dd9
fix tests
tac0turtle 5f00f66
remove more global calls
tac0turtle e801e48
fix genutil tests
tac0turtle f7af2dd
remove more global calls
tac0turtle 5d42a5e
remove more global calls
tac0turtle ac8f2e2
fix some linting
tac0turtle 13cfb72
fix error case in test
tac0turtle d289df0
fix error case in test
tac0turtle 158ce7c
quick add of gov
tac0turtle e7eb397
changelog entry
tac0turtle 425e2db
change cmd line examples
tac0turtle a0ba91e
change cmd line examples
tac0turtle 8c4290f
query utils cleanup
tac0turtle d31de8a
fix gov
tac0turtle a467b7a
fix dist
tac0turtle 7119063
Merge branch 'main' into marko/valAddress
tac0turtle b6aaa22
fix merge conflict test failures
tac0turtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
|
||
"cosmossdk.io/math" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec/address" | ||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/bank/testutil" | ||
|
@@ -40,7 +41,7 @@ func TestCancelUnbondingDelegation(t *testing.T) { | |
delegatorAddr := addrs[1] | ||
|
||
// setup a new validator with bonded status | ||
validator, err := types.NewValidator(valAddr, PKs[0], types.NewDescription("Validator", "", "", "", "")) | ||
validator, err := types.NewValidator(valAddr.String(), PKs[0], types.NewDescription("Validator", "", "", "", "")) | ||
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. same here, is just showing bad practice. |
||
validator.Status = types.Bonded | ||
assert.NilError(t, err) | ||
assert.NilError(t, f.stakingKeeper.SetValidator(ctx, validator)) | ||
|
@@ -55,6 +56,7 @@ func TestCancelUnbondingDelegation(t *testing.T) { | |
ctx.BlockTime().Add(time.Minute*10), | ||
unbondingAmount.Amount, | ||
0, | ||
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"), | ||
) | ||
|
||
// set and retrieve a record | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import ( | |
"cosmossdk.io/math" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/codec/address" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | ||
|
@@ -97,7 +98,7 @@ func (b *GenesisBuilder) GenTx(privVal secp256k1.PrivKey, val cmttypes.GenesisVa | |
|
||
// Produce the create validator message. | ||
msg, err := stakingtypes.NewMsgCreateValidator( | ||
privVal.PubKey().Address().Bytes(), | ||
sdk.ValAddress(privVal.PubKey().Address()).String(), | ||
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. +1 |
||
pubKey, | ||
amount, | ||
stakingtypes.Description{ | ||
|
@@ -114,7 +115,7 @@ func (b *GenesisBuilder) GenTx(privVal secp256k1.PrivKey, val cmttypes.GenesisVa | |
panic(err) | ||
} | ||
|
||
if err := msg.Validate(); err != nil { | ||
if err := msg.Validate(address.NewBech32Codec("cosmosvaloper")); err != nil { | ||
panic(err) | ||
} | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
although this is fine, feels dirty / bad practice
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.
oh this is 100% ugly, mainly didnt want to rewrite all these tests to use the codec as we will be rewriting this module in the near future