Skip to content

Commit

Permalink
update authority -> signers
Browse files Browse the repository at this point in the history
  • Loading branch information
charleenfei committed Aug 29, 2023
1 parent 776a7ce commit efa5e43
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 109 deletions.
8 changes: 4 additions & 4 deletions modules/core/02-client/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,22 +287,22 @@ func (msg *MsgUpdateParams) ValidateBasic() error {
}

// NewMsgIBCSoftwareUpgrade creates a new MsgIBCSoftwareUpgrade instance
func NewMsgIBCSoftwareUpgrade(authority string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgIBCSoftwareUpgrade, error) {
func NewMsgIBCSoftwareUpgrade(signer string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgIBCSoftwareUpgrade, error) {
anyClient, err := PackClientState(upgradedClientState)
if err != nil {
return nil, err
}

return &MsgIBCSoftwareUpgrade{
Authority: authority,
Signer: signer,
Plan: plan,
UpgradedClientState: anyClient,
}, nil
}

// GetSigners returns the expected signers for a MsgIBCSoftwareUpgrade message.
func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Authority)
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
panic(err)
}
Expand All @@ -311,7 +311,7 @@ func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress {

// ValidateBasic performs basic checks on a MsgIBCSoftwareUpgrade.
func (msg *MsgIBCSoftwareUpgrade) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil {
return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
}

Expand Down
10 changes: 5 additions & 5 deletions modules/core/02-client/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_NewMsgIBCSoftwareUpgrade(

if tc.expPass {
suite.Require().NoError(err)
suite.Assert().Equal(ibctesting.TestAccAddress, msg.Authority)
suite.Assert().Equal(ibctesting.TestAccAddress, msg.Signer)
suite.Assert().Equal(plan, msg.Plan)
unpackedClientState, err := types.UnpackClientState(msg.UpgradedClientState)
suite.Require().NoError(err)
Expand Down Expand Up @@ -771,7 +771,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_GetSigners() {
// TestMsgIBCSoftwareUpgrade_ValidateBasic tests ValidateBasic for MsgIBCSoftwareUpgrade
func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() {
var (
authority string
signer string
plan upgradetypes.Plan
anyClient *codectypes.Any
)
Expand All @@ -788,7 +788,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() {
{
"failure: invalid authority address",
func() {
authority = "invalid"
signer = "invalid"
},
ibcerrors.ErrInvalidAddress,
},
Expand All @@ -809,7 +809,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() {
}

for _, tc := range testCases {
authority = ibctesting.TestAccAddress
signer = ibctesting.TestAccAddress
plan = upgradetypes.Plan{
Name: "upgrade IBC clients",
Height: 1000,
Expand All @@ -822,9 +822,9 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() {
tc.malleate()

msg := types.MsgIBCSoftwareUpgrade{
authority,
plan,
anyClient,
signer,
}

err = msg.ValidateBasic()
Expand Down
186 changes: 93 additions & 93 deletions modules/core/02-client/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit efa5e43

Please sign in to comment.