Skip to content

Commit

Permalink
fix: remove copy object approval (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarryTong65 authored Mar 11, 2024
1 parent 6067133 commit 5c6b827
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,13 +1118,19 @@ func (k Keeper) CopyObject(
operator.String(), srcObjectInfo.BucketName, srcObjectInfo.ObjectName)
}

if opts.PrimarySpApproval.ExpiredHeight < uint64(ctx.BlockHeight()) {
return sdkmath.ZeroUint(), errors.Wrapf(types.ErrInvalidApproval, "The approval of sp is expired.")
}

err = k.VerifySPAndSignature(ctx, dstPrimarySP, opts.ApprovalMsgBytes, opts.PrimarySpApproval.Sig, operator)
if err != nil {
return sdkmath.ZeroUint(), err
if !ctx.IsUpgraded(upgradetypes.Serengeti) {
if opts.PrimarySpApproval.ExpiredHeight < uint64(ctx.BlockHeight()) {
return sdkmath.ZeroUint(), errors.Wrapf(types.ErrInvalidApproval, "The approval of sp is expired.")
}
err = k.VerifySPAndSignature(ctx, dstPrimarySP, opts.ApprovalMsgBytes, opts.PrimarySpApproval.Sig, operator)
if err != nil {
return sdkmath.ZeroUint(), err
}
} else {
err = k.VerifySP(ctx, dstPrimarySP, operator)
if err != nil {
return sdkmath.ZeroUint(), err
}
}

// check payload size, the empty object doesn't need sealed
Expand Down

0 comments on commit 5c6b827

Please sign in to comment.