-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: disallow update payment address when there are created/updating objects #584
Conversation
d8bd1c9
to
fcf7a66
Compare
Please submit to master branch |
x/storage/keeper/abci.go
Outdated
ctx.Logger().Error("should not happen, fail to delete buckets, err " + err.Error()) | ||
panic("should not happen") | ||
doDeleteBucket := true | ||
if ctx.BlockHeight() > 5946511 && ctx.ChainID() == "greenfield_5600-1" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add some comments here on why we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
@@ -123,7 +124,12 @@ func (k Keeper) UpdateFrozenStreamRecord(ctx sdk.Context, streamRecord *types.St | |||
streamRecord.LockBalance = streamRecord.LockBalance.Add(change.LockBalanceChange) | |||
streamRecord.StaticBalance = streamRecord.StaticBalance.Sub(change.LockBalanceChange) | |||
if streamRecord.LockBalance.IsNegative() { | |||
return fmt.Errorf("lock balance can not become negative, current: %s", streamRecord.LockBalance) | |||
if ctx.IsUpgraded(upgradetypes.Pawnee) { | |||
streamRecord.StaticBalance = streamRecord.StaticBalance.Add(streamRecord.LockBalance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if staticbalance become negative? is it possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -158,7 +164,12 @@ func (k Keeper) UpdateStreamRecord(ctx sdk.Context, streamRecord *types.StreamRe | |||
streamRecord.LockBalance = streamRecord.LockBalance.Add(change.LockBalanceChange) | |||
streamRecord.StaticBalance = streamRecord.StaticBalance.Sub(change.LockBalanceChange) | |||
if streamRecord.LockBalance.IsNegative() { | |||
return fmt.Errorf("lock balance can not become negative, current: %s", streamRecord.LockBalance) | |||
if ctx.IsUpgraded(upgradetypes.Pawnee) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -334,6 +335,9 @@ func (k Keeper) ForceDeleteBucket(ctx sdk.Context, bucketId sdkmath.Uint, cap ui | |||
ctx.Logger().Error("unlock store fee error", "err", err) | |||
return false, deleted, err | |||
} | |||
if ctx.IsUpgraded(upgradetypes.Pawnee) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, I think the SP need run a job: scan all the stale created object and reject seal them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can reject seal the stale created object, it will be better. I checked greenfieldscan, cannot find the stale created objects easily.
@@ -1039,6 +1062,9 @@ func (k Keeper) ForceDeleteObject(ctx sdk.Context, objectId sdkmath.Uint) error | |||
ctx.Logger().Error("unlock store fee error", "err", err) | |||
return err | |||
} | |||
if ctx.IsUpgraded(upgradetypes.Pawnee) { | |||
k.DecreaseCreatedObjectCount(ctx, bucketInfo.Id) | |||
} | |||
} else if objectStatus == types.OBJECT_STATUS_SEALED { | |||
internalBucketInfo := k.MustGetInternalBucketInfo(ctx, bucketInfo.Id) | |||
err := k.UnChargeObjectStoreFee(ctx, bucketInfo, internalBucketInfo, objectInfo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is object being updated, update the payment addr is not allowed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added related codes, please check.
6dfee73
to
b12488c
Compare
dd74b40
to
6af6cd2
Compare
d7881ce
to
8d672ac
Compare
Description
Rationale
Bug fix
Example
NA
Changes
Notable changes:
Potential Impacts