authz: Update MsgGrant proto (#9280)

* adding GetAuthorization test

* update MsgGrant proto

* update comment
This commit is contained in:
Robert Zaremba 2021-05-10 11:28:08 +02:00 committed by GitHub
parent b635ae2090
commit 9038dfe3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 148 deletions

View File

@ -1323,8 +1323,7 @@ account with the provided expiration time.
| ----- | ---- | ----- | ----------- |
| `granter` | [string](#string) | | |
| `grantee` | [string](#string) | | |
| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | |
| `expiration` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |
| `grant` | [Grant](#cosmos.authz.v1beta1.Grant) | | |

View File

@ -6,6 +6,7 @@ import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "cosmos/base/abci/v1beta1/abci.proto";
import "cosmos/authz/v1beta1/authz.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/authz";
option (gogoproto.goproto_getters_all) = false;
@ -32,8 +33,7 @@ message MsgGrant {
string granter = 1;
string grantee = 2;
google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"];
google.protobuf.Timestamp expiration = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false];
}
// MsgExecResponse defines the Msg/MsgExecResponse response type.

View File

@ -9,24 +9,23 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// NewGrant returns new AuthrizationGrant
func NewGrant(authorization Authorization, expiration time.Time) (Grant, error) {
auth := Grant{
// NewGrant returns new Grant
func NewGrant(a Authorization, expiration time.Time) (Grant, error) {
g := Grant{
Expiration: expiration,
}
msg, ok := authorization.(proto.Message)
msg, ok := a.(proto.Message)
if !ok {
return Grant{}, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", authorization)
return Grant{}, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", a)
}
any, err := cdctypes.NewAnyWithValue(msg)
if err != nil {
return Grant{}, err
}
g.Authorization = any
auth.Authorization = any
return auth, nil
return g, nil
}
var (
@ -34,16 +33,32 @@ var (
)
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (auth Grant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error {
func (g Grant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error {
var authorization Authorization
return unpacker.UnpackAny(auth.Authorization, &authorization)
return unpacker.UnpackAny(g.Authorization, &authorization)
}
// GetAuthorization returns the cached value from the Grant.Authorization if present.
func (auth Grant) GetAuthorization() Authorization {
authorization, ok := auth.Authorization.GetCachedValue().(Authorization)
func (g Grant) GetAuthorization() Authorization {
if g.Authorization == nil {
return nil
}
a, ok := g.Authorization.GetCachedValue().(Authorization)
if !ok {
return nil
}
return authorization
return a
}
func (g Grant) ValidateBasic() error {
if g.Expiration.Unix() < time.Now().Unix() {
return sdkerrors.Wrap(ErrInvalidExpirationTime, "Time can't be in the past")
}
av := g.Authorization.GetCachedValue()
a, ok := av.(Authorization)
if !ok {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T", (Authorization)(nil), av)
}
return a.ValidateBasic()
}

View File

@ -31,7 +31,7 @@ func (k Keeper) Grant(goCtx context.Context, msg *authz.MsgGrant) (*authz.MsgGra
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "%s doesn't exist.", t)
}
err = k.SaveGrant(ctx, grantee, granter, authorization, msg.Expiration)
err = k.SaveGrant(ctx, grantee, granter, authorization, msg.Grant.Expiration)
if err != nil {
return nil, err
}

View File

@ -23,9 +23,9 @@ var (
//nolint:interfacer
func NewMsgGrant(granter sdk.AccAddress, grantee sdk.AccAddress, a Authorization, expiration time.Time) (*MsgGrant, error) {
m := &MsgGrant{
Granter: granter.String(),
Grantee: grantee.String(),
Expiration: expiration,
Granter: granter.String(),
Grantee: grantee.String(),
Grant: Grant{Expiration: expiration},
}
err := m.SetAuthorization(a)
if err != nil {
@ -57,26 +57,12 @@ func (msg MsgGrant) ValidateBasic() error {
if granter.Equals(grantee) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "granter and grantee cannot be same")
}
if msg.Expiration.Unix() < time.Now().Unix() {
return sdkerrors.Wrap(ErrInvalidExpirationTime, "Time can't be in the past")
}
av := msg.Authorization.GetCachedValue()
a, ok := av.(Authorization)
if !ok {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T", (Authorization)(nil), av)
}
return a.ValidateBasic()
return msg.Grant.ValidateBasic()
}
// GetAuthorization returns the cache value from the MsgGrant.Authorization if present.
func (msg *MsgGrant) GetAuthorization() Authorization {
a, ok := msg.Authorization.GetCachedValue().(Authorization)
if !ok {
return nil
}
return a
return msg.Grant.GetAuthorization()
}
// SetAuthorization converts Authorization to any and adds it to MsgGrant.Authorization.
@ -89,7 +75,7 @@ func (msg *MsgGrant) SetAuthorization(a Authorization) error {
if err != nil {
return err
}
msg.Authorization = any
msg.Grant.Authorization = any
return nil
}
@ -108,8 +94,7 @@ func (msg MsgExec) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error {
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (msg MsgGrant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error {
var a Authorization
return unpacker.UnpackAny(msg.Authorization, &a)
return msg.Grant.UnpackInterfaces(unpacker)
}
// NewMsgRevoke creates a new MsgRevoke

View File

@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@ -97,3 +98,20 @@ func TestMsgGrantAuthorization(t *testing.T) {
}
}
}
func TestMsgGrantGetAuthorization(t *testing.T) {
require := require.New(t)
m := authz.MsgGrant{}
require.Nil(m.GetAuthorization())
g := authz.GenericAuthorization{Msg: "some_type"}
var err error
m.Grant.Authorization, err = cdctypes.NewAnyWithValue(&g)
require.NoError(err)
require.Equal(m.GetAuthorization(), &g)
g = authz.GenericAuthorization{Msg: "some_type2"}
m.SetAuthorization(&g)
require.Equal(m.GetAuthorization(), &g)
}

View File

@ -6,12 +6,11 @@ package authz
import (
context "context"
fmt "fmt"
types "github.com/cosmos/cosmos-sdk/codec/types"
types1 "github.com/cosmos/cosmos-sdk/types"
types1 "github.com/cosmos/cosmos-sdk/codec/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
_ "github.com/regen-network/cosmos-proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
@ -20,14 +19,12 @@ import (
io "io"
math "math"
math_bits "math/bits"
time "time"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@ -38,10 +35,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// MsgGrant grants the provided authorization to the grantee on the granter's
// account with the provided expiration time.
type MsgGrant struct {
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
Authorization *types.Any `protobuf:"bytes,3,opt,name=authorization,proto3" json:"authorization,omitempty"`
Expiration time.Time `protobuf:"bytes,4,opt,name=expiration,proto3,stdtime" json:"expiration"`
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
Grant Grant `protobuf:"bytes,3,opt,name=grant,proto3" json:"grant"`
}
func (m *MsgGrant) Reset() { *m = MsgGrant{} }
@ -79,7 +75,7 @@ var xxx_messageInfo_MsgGrant proto.InternalMessageInfo
// MsgExecResponse defines the Msg/MsgExecResponse response type.
type MsgExecResponse struct {
Result *types1.Result `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
Result *types.Result `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (m *MsgExecResponse) Reset() { *m = MsgExecResponse{} }
@ -123,7 +119,7 @@ type MsgExec struct {
// Authorization Msg requests to execute. Each msg must implement Authorization interface
// The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg))
// triple and validate it.
Msgs []*types.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"`
Msgs []*types1.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"`
}
func (m *MsgExec) Reset() { *m = MsgExec{} }
@ -286,40 +282,39 @@ func init() {
func init() { proto.RegisterFile("cosmos/authz/v1beta1/tx.proto", fileDescriptor_3ceddab7d8589ad1) }
var fileDescriptor_3ceddab7d8589ad1 = []byte{
// 523 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x30,
0x18, 0xae, 0xd7, 0xd2, 0xad, 0xef, 0x98, 0x60, 0xa1, 0x87, 0x2e, 0x62, 0x69, 0x14, 0xbe, 0x76,
0xa0, 0x8e, 0x56, 0x2e, 0x5c, 0x57, 0x81, 0x90, 0x80, 0x08, 0x29, 0x1a, 0x17, 0x2e, 0x55, 0xd2,
0x19, 0x2f, 0x6a, 0x13, 0x47, 0xb1, 0x33, 0xb5, 0xfb, 0x15, 0xfb, 0x31, 0xfb, 0x11, 0xd5, 0x4e,
0x93, 0xb8, 0x70, 0xe2, 0xa3, 0xfd, 0x13, 0x1c, 0x51, 0x6c, 0xa7, 0xb4, 0x40, 0x87, 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x9b, 0xf6,
0xda, 0x03, 0x8a, 0x60, 0x3e, 0xf9, 0x07, 0xa1, 0xd4, 0xec, 0xf5, 0xa6, 0xdf, 0xad, 0xca, 0x74,
0x66, 0xa1, 0xeb, 0x99, 0x85, 0xbe, 0xcd, 0x2c, 0x74, 0x31, 0xb7, 0x2a, 0xd7, 0x73, 0xab, 0xf2,
0x79, 0x6e, 0x55, 0x3e, 0x3c, 0xa4, 0x91, 0x38, 0xcd, 0x43, 0x3c, 0x60, 0xb1, 0xfe, 0x23, 0xeb,
0x9f, 0x0e, 0x3f, 0x19, 0xba, 0x63, 0xf5, 0x5d, 0x08, 0xeb, 0x72, 0x00, 0x9e, 0xfd, 0x0c, 0x00,
0x00, 0xff, 0xff, 0x5b, 0x69, 0x39, 0xef, 0x2e, 0x04, 0x00, 0x00,
// 498 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcb, 0x6e, 0xd3, 0x40,
0x14, 0xb5, 0x9b, 0x34, 0x25, 0x13, 0x24, 0xc0, 0x64, 0xe1, 0x1a, 0xea, 0x58, 0xe6, 0x95, 0x05,
0x1d, 0xab, 0x61, 0x01, 0xdb, 0x46, 0x42, 0x48, 0x80, 0x85, 0x64, 0xc1, 0x86, 0x4d, 0x64, 0xa7,
0xc3, 0xc4, 0x4a, 0xec, 0xb1, 0x7c, 0xc7, 0x25, 0xe9, 0x57, 0xf0, 0x31, 0x7c, 0x44, 0xc4, 0xaa,
0x4b, 0x56, 0x08, 0x92, 0x9f, 0x60, 0x89, 0x3c, 0x8f, 0x50, 0x50, 0x5a, 0x24, 0x56, 0x99, 0x3b,
0xe7, 0xe4, 0xdc, 0x73, 0xcf, 0xf5, 0xa0, 0x83, 0x31, 0x83, 0x8c, 0x41, 0x10, 0x57, 0x7c, 0x72,
0x16, 0x9c, 0x1e, 0x25, 0x84, 0xc7, 0x47, 0x01, 0x9f, 0xe3, 0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0x60, 0x2e, 0xdf, 0x41, 0xd2,
0x12, 0x1f, 0xc0, 0x93, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xa9, 0xb0, 0x59, 0xf3, 0x03,
0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -508,26 +503,16 @@ func (m *MsgGrant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Expiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Expiration):])
if err1 != nil {
return 0, err1
}
i -= n1
i = encodeVarintTx(dAtA, i, uint64(n1))
i--
dAtA[i] = 0x22
if m.Authorization != nil {
{
size, err := m.Authorization.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
{
size, err := m.Grant.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i--
dAtA[i] = 0x1a
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.Grantee) > 0 {
i -= len(m.Grantee)
copy(dAtA[i:], m.Grantee)
@ -739,11 +724,7 @@ func (m *MsgGrant) Size() (n int) {
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Authorization != nil {
l = m.Authorization.Size()
n += 1 + l + sovTx(uint64(l))
}
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Expiration)
l = m.Grant.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
@ -920,7 +901,7 @@ func (m *MsgGrant) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authorization", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Grant", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@ -947,43 +928,7 @@ func (m *MsgGrant) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Authorization == nil {
m.Authorization = &types.Any{}
}
if err := m.Authorization.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Expiration, dAtA[iNdEx:postIndex]); err != nil {
if err := m.Grant.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@ -1067,7 +1012,7 @@ func (m *MsgExecResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Result == nil {
m.Result = &types1.Result{}
m.Result = &types.Result{}
}
if err := m.Result.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@ -1184,7 +1129,7 @@ func (m *MsgExec) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Msgs = append(m.Msgs, &types.Any{})
m.Msgs = append(m.Msgs, &types1.Any{})
if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}