From 176b4161034dc600031f8baeeaaa6990f4aacbdb Mon Sep 17 00:00:00 2001 From: Roshan <48975233+Pythonberg1997@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:04:57 +0800 Subject: [PATCH] chore: change max length limit of resource tags key value (#536) --- x/storage/types/message.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/x/storage/types/message.go b/x/storage/types/message.go index 19ebd7227..3e4563ed5 100644 --- a/x/storage/types/message.go +++ b/x/storage/types/message.go @@ -57,7 +57,8 @@ const ( MaxGroupMemberLimitOnce = 20 MaxTagCount = 4 - MaxTagKeyValueLength = 24 + MaxTagKeyLength = 32 + MaxTagValueLength = 64 // For discontinue MaxDiscontinueReasonLen = 128 @@ -211,10 +212,10 @@ func (msg *MsgCreateBucket) ValidateRuntime(ctx sdk.Context) error { } if len(msg.Tags.GetTags()) > 0 { for _, tag := range msg.Tags.GetTags() { - if len(tag.GetKey()) > MaxTagKeyValueLength { + if len(tag.GetKey()) > MaxTagKeyLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag key length exceeded") } - if len(tag.GetValue()) > MaxTagKeyValueLength { + if len(tag.GetValue()) > MaxTagValueLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag value length exceeded") } } @@ -441,10 +442,10 @@ func (msg *MsgCreateObject) ValidateRuntime(ctx sdk.Context) error { } if len(msg.Tags.GetTags()) > 0 { for _, tag := range msg.Tags.GetTags() { - if len(tag.GetKey()) > MaxTagKeyValueLength { + if len(tag.GetKey()) > MaxTagKeyLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag key length exceeded") } - if len(tag.GetValue()) > MaxTagKeyValueLength { + if len(tag.GetValue()) > MaxTagValueLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag value length exceeded") } } @@ -993,10 +994,10 @@ func (msg *MsgCreateGroup) ValidateRuntime(ctx sdk.Context) error { } if len(msg.Tags.GetTags()) > 0 { for _, tag := range msg.Tags.GetTags() { - if len(tag.GetKey()) > MaxTagKeyValueLength { + if len(tag.GetKey()) > MaxTagKeyLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag key length exceeded") } - if len(tag.GetValue()) > MaxTagKeyValueLength { + if len(tag.GetValue()) > MaxTagValueLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag value length exceeded") } } @@ -1710,10 +1711,10 @@ func (msg *MsgSetTag) ValidateBasic() error { } if len(msg.Tags.GetTags()) > 0 { for _, tag := range msg.Tags.GetTags() { - if len(tag.GetKey()) > MaxTagKeyValueLength { + if len(tag.GetKey()) > MaxTagKeyLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag key length exceeded") } - if len(tag.GetValue()) > MaxTagKeyValueLength { + if len(tag.GetValue()) > MaxTagValueLength { return gnfderrors.ErrInvalidParameter.Wrapf("Tag value length exceeded") } }