Skip to content

Commit

Permalink
fix: Remove cross-chain operation restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
constwz committed Jul 10, 2024
1 parent 86a744a commit 54daf84
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (k Keeper) DeleteBucket(ctx sdk.Context, operator sdk.AccAddress, bucketNam
if !found {
return types.ErrNoSuchBucket
}
if bucketInfo.SourceType != opts.SourceType {
if bucketInfo.SourceType != types.SOURCE_TYPE_ORIGIN && bucketInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

Expand Down Expand Up @@ -417,10 +417,6 @@ func (k Keeper) UpdateBucketInfo(ctx sdk.Context, operator sdk.AccAddress, bucke
if !found {
return types.ErrNoSuchBucket
}
// check bucket source
if bucketInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

if ctx.IsUpgraded(upgradetypes.Hulunbeier) {
sp := k.MustGetPrimarySPForBucket(ctx, bucketInfo)
Expand Down Expand Up @@ -987,10 +983,6 @@ func (k Keeper) CancelCreateObject(
return types.ErrObjectNotCreated.Wrapf("Object status: %s", objectInfo.ObjectStatus.String())
}

if objectInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

var creator sdk.AccAddress
owner := sdk.MustAccAddressFromHex(objectInfo.Owner)
if objectInfo.Creator != "" {
Expand Down Expand Up @@ -1056,7 +1048,7 @@ func (k Keeper) DeleteObject(
objectInfo.ObjectName)
}

if objectInfo.SourceType != opts.SourceType {
if objectInfo.SourceType != types.SOURCE_TYPE_ORIGIN && objectInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

Expand Down Expand Up @@ -1211,10 +1203,6 @@ func (k Keeper) CopyObject(
return sdkmath.ZeroUint(), errors.Wrapf(types.ErrNoSuchObject, "src object name (%s)", srcObjectName)
}

if srcObjectInfo.SourceType != opts.SourceType {
return sdkmath.ZeroUint(), types.ErrSourceTypeMismatch
}

if srcObjectInfo.IsUpdating {
return sdkmath.ZeroUint(), types.ErrAccessDenied.Wrapf("the object is being updated, can not be copied")
}
Expand Down Expand Up @@ -1552,7 +1540,7 @@ func (k Keeper) DeleteGroup(ctx sdk.Context, operator sdk.AccAddress, groupName
if !found {
return types.ErrNoSuchGroup
}
if groupInfo.SourceType != opts.SourceType {
if groupInfo.SourceType != types.SOURCE_TYPE_ORIGIN && groupInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}
// check permission
Expand Down Expand Up @@ -1588,7 +1576,7 @@ func (k Keeper) LeaveGroup(
if !found {
return types.ErrNoSuchGroup
}
if groupInfo.SourceType != opts.SourceType {
if groupInfo.SourceType != types.SOURCE_TYPE_ORIGIN && groupInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

Expand All @@ -1610,7 +1598,7 @@ func (k Keeper) LeaveGroup(
}

func (k Keeper) UpdateGroupMember(ctx sdk.Context, operator sdk.AccAddress, groupInfo *types.GroupInfo, opts types.UpdateGroupMemberOptions) error {
if groupInfo.SourceType != opts.SourceType {
if groupInfo.SourceType != types.SOURCE_TYPE_ORIGIN && groupInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

Expand Down Expand Up @@ -1665,7 +1653,7 @@ func (k Keeper) UpdateGroupMember(ctx sdk.Context, operator sdk.AccAddress, grou
}

func (k Keeper) RenewGroupMember(ctx sdk.Context, operator sdk.AccAddress, groupInfo *types.GroupInfo, opts types.RenewGroupMemberOptions) error {
if groupInfo.SourceType != opts.SourceType {
if groupInfo.SourceType != types.SOURCE_TYPE_ORIGIN && groupInfo.SourceType != opts.SourceType {
return types.ErrSourceTypeMismatch
}

Expand Down

0 comments on commit 54daf84

Please sign in to comment.