-
Notifications
You must be signed in to change notification settings - Fork 625
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: module account address derivation #428
Changes from all commits
4741977
91eacb5
9f22b34
f92cde7
391ecd0
ba8b17a
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 |
---|---|---|
|
@@ -4,21 +4,26 @@ import ( | |
"fmt" | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
"github.com/stretchr/testify/suite" | ||
"github.com/tendermint/tendermint/crypto" | ||
|
||
"github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types" | ||
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" | ||
ibctesting "github.com/cosmos/ibc-go/v2/testing" | ||
) | ||
|
||
var ( | ||
// TestAccAddress defines a resuable bech32 address for testing purposes | ||
// TODO: update crypto.AddressHash() when sdk uses address.Module() | ||
TestAccAddress = types.GenerateAddress(sdk.AccAddress(crypto.AddressHash([]byte(types.ModuleName))), TestPortID) | ||
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. Presumably the sdk will eventually be using So we'll need to replace 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. Could we open an issue to track this? Should we open an issue on the SDK? 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. Sure, I can open an issue on the SDK for this. I'll cc you edit: cosmos/cosmos-sdk#10225 |
||
// TestOwnerAddress defines a reusable bech32 address for testing purposes | ||
TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs" | ||
// TestPortID defines a resuable port identifier for testing purposes | ||
TestPortID = fmt.Sprintf("%s-0-0-%s", types.VersionPrefix, TestOwnerAddress) | ||
// TestVersion defines a resuable interchainaccounts version string for testing purposes | ||
TestVersion = types.NewAppVersion(types.VersionPrefix, types.GenerateAddress(TestPortID).String()) | ||
TestVersion = types.NewAppVersion(types.VersionPrefix, TestAccAddress.String()) | ||
) | ||
|
||
type KeeperTestSuite struct { | ||
|
@@ -118,7 +123,7 @@ func (suite *KeeperTestSuite) TestGetInterchainAccountAddress() { | |
suite.Require().NoError(err) | ||
|
||
counterpartyPortID := path.EndpointA.ChannelConfig.PortID | ||
expectedAddr := authtypes.NewBaseAccountWithAddress(types.GenerateAddress(counterpartyPortID)).GetAddress() | ||
expectedAddr := authtypes.NewBaseAccountWithAddress(types.GenerateAddress(suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(types.ModuleName), counterpartyPortID)).GetAddress() | ||
|
||
retrievedAddr, found := suite.chainB.GetSimApp().ICAKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), counterpartyPortID) | ||
suite.Require().True(found) | ||
|
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.
Moved the implementation of this from
AppModule
to the Keeper in order to gain access to theaccountKeeper
without having to expose it.AppModule now just invokes this func on the Keeper.