Skip to content
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

chore: moving authz protos to transfer.v1 #2984

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/stretchr/testify v1.8.1
github.com/tendermint/tendermint v0.34.23
github.com/tendermint/tm-db v0.6.7
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
Expand Down Expand Up @@ -140,7 +141,6 @@ require (
go.etcd.io/bbolt v1.3.6 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.2.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sys v0.2.0 // indirect
Expand Down
4 changes: 1 addition & 3 deletions modules/apps/transfer/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import (
)

func (suite *KeeperTestSuite) TestMsgTransfer() {
var (
msg *types.MsgTransfer
)
var msg *types.MsgTransfer

testCases := []struct {
name string
Expand Down
72 changes: 36 additions & 36 deletions modules/apps/transfer/types/authz.pb.go

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

4 changes: 1 addition & 3 deletions modules/apps/transfer/types/transfer_authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import (

const gasCostPerIteration = uint64(10)

var (
_ authz.Authorization = &TransferAuthorization{}
)
var _ authz.Authorization = &TransferAuthorization{}

// NewTransferAuthorization creates a new TransferAuthorization object.
func NewTransferAuthorization(sourcePorts, sourceChannels []string, spendLimits []sdk.Coins, allowedAddrs [][]string) *TransferAuthorization {
Expand Down
10 changes: 5 additions & 5 deletions modules/apps/transfer/types/transfer_authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestTransferAuthorization(t *testing.T) {
t.Log("verify authorization returns valid method name")
require.Equal(t, authorization.MsgTypeURL(), "/ibc.applications.transfer.v1.MsgTransfer")
require.NoError(t, authorization.ValidateBasic())
transfer := NewMsgTransfer(sourcePort, sourceChannel, coin1000, fromAddr.String(), toAddr.String(), timeoutHeight, 0)
transfer := NewMsgTransfer(sourcePort, sourceChannel, coin1000, fromAddr.String(), toAddr.String(), timeoutHeight, 0, "")
require.NoError(t, authorization.ValidateBasic())

t.Log("verify updated authorization returns nil")
Expand All @@ -44,7 +44,7 @@ func TestTransferAuthorization(t *testing.T) {
authorization = NewTransferAuthorization([]string{sourcePort}, []string{sourceChannel}, []sdk.Coins{coins1000}, [][]string{{toAddr.String()}})
require.Equal(t, authorization.MsgTypeURL(), "/ibc.applications.transfer.v1.MsgTransfer")
require.NoError(t, authorization.ValidateBasic())
transfer = NewMsgTransfer(sourcePort, sourceChannel, coin500, fromAddr.String(), toAddr.String(), timeoutHeight, 0)
transfer = NewMsgTransfer(sourcePort, sourceChannel, coin500, fromAddr.String(), toAddr.String(), timeoutHeight, 0, "")
require.NoError(t, authorization.ValidateBasic())
resp, err = authorization.Accept(ctx, transfer)
require.NoError(t, err)
Expand All @@ -61,7 +61,7 @@ func TestTransferAuthorization(t *testing.T) {

t.Log("expect error when spend limit for specific port and channel is not set")
authorization = NewTransferAuthorization([]string{sourcePort}, []string{sourceChannel}, []sdk.Coins{coins1000}, [][]string{{toAddr.String()}})
transfer = NewMsgTransfer(sourcePort2, sourceChannel2, coin500, fromAddr.String(), toAddr.String(), timeoutHeight, 0)
transfer = NewMsgTransfer(sourcePort2, sourceChannel2, coin500, fromAddr.String(), toAddr.String(), timeoutHeight, 0, "")
_, err = authorization.Accept(ctx, transfer)
require.Error(t, err)

Expand All @@ -71,7 +71,7 @@ func TestTransferAuthorization(t *testing.T) {
[]string{sourceChannel, sourceChannel2},
[]sdk.Coins{coins1000, coins1000},
[][]string{{toAddr.String()}, {toAddr.String()}})
transfer = NewMsgTransfer(sourcePort, sourceChannel, coin1000, fromAddr.String(), toAddr.String(), timeoutHeight, 0)
transfer = NewMsgTransfer(sourcePort, sourceChannel, coin1000, fromAddr.String(), toAddr.String(), timeoutHeight, 0, "")
resp, err = authorization.Accept(ctx, transfer)
require.NoError(t, err)
require.NotNil(t, resp.Updated)
Expand All @@ -80,7 +80,7 @@ func TestTransferAuthorization(t *testing.T) {

t.Log("expect error when transferring to not allowed address")
authorization = NewTransferAuthorization([]string{sourcePort}, []string{sourceChannel}, []sdk.Coins{coins1000}, [][]string{{fromAddr.String()}})
transfer = NewMsgTransfer(sourcePort, sourceChannel, coin500, fromAddr.String(), toAddr.String(), timeoutHeight, 0)
transfer = NewMsgTransfer(sourcePort, sourceChannel, coin500, fromAddr.String(), toAddr.String(), timeoutHeight, 0, "")
_, err = authorization.Accept(ctx, transfer)
require.Error(t, err)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package ibc.applications.transfer.v2;
package ibc.applications.transfer.v1;

option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types";

Expand Down