Skip to content

Commit

Permalink
chore: change max length limit of resource tags key value (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 authored Dec 5, 2023
1 parent 1760620 commit 176b416
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions x/storage/types/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const (

MaxGroupMemberLimitOnce = 20
MaxTagCount = 4
MaxTagKeyValueLength = 24
MaxTagKeyLength = 32
MaxTagValueLength = 64

// For discontinue
MaxDiscontinueReasonLen = 128
Expand Down Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
}
Expand Down

0 comments on commit 176b416

Please sign in to comment.