-
Notifications
You must be signed in to change notification settings - Fork 21
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
πΏ Storage: Pin / Unpin object #126
Conversation
size-limit report π¦
|
@bdeneux Regarding the behavior when pinning already pinned object and unpinning not yet pinned object I agree with you, as it changes nothing in the state, to consider those messages successful, making them as no-op. @ccamel Your opinion about that? We'll need to update the specifications accordingly. |
@amimart @ccamel Sorry, my bad, after checking, the specification already indicate this behavior : /// # PinObject
/// PinObject pins the object in the bucket for the considered sender. If the object is already pinned
/// for the sender, this is a no-op.
/// While an object is pinned, it cannot be removed from the storage. /// # UnpinObject
/// UnpinObject unpins the object in the bucket for the considered sender. If the object is not pinned
/// for the sender, this is a no-op.
/// The object can be removed from the storage if it is not pinned anymore. So it's ok for the PinObject. My question now is about the |
@bdeneux In the case we try to unpin a non existing object, I would tend to make it an error case, even if it has a little more cost than considering it a no-op. Because a successful unpin of an object could suggest the existence of it. |
Codecov Report
@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 91.45% 92.76% +1.30%
==========================================
Files 11 11
Lines 199 235 +36
==========================================
+ Hits 182 218 +36
Misses 17 17
π£ Weβre building smart automated test selection to slash your CI/CD build times. Learn more |
63ff027
to
7b2d53f
Compare
7b2d53f
to
4bb1af0
Compare
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.
Nice piece! πͺ
I just noted small enhancement ways :)
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.
Sounds pretty great! π
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.
LGTM! π
π This PR is included in version 1.0.0 π The release is available on GitHub release Your semantic-release bot π¦π |
π This PR is included in version 1.0.0 π The release is available on GitHub release Your semantic-release bot π¦π |
π Description
Implement the
PinObject
andUnpinObject
execute message.β Question
What do we do if when we execute PinObject on object that has been already pinned ? The same question for UnpinObject message ?
Now, if we try to pin an already pinned object, the contract return successful response simulating that the object has just been pinned. Otherwise if we try to unpin an object that is already not pinned to the sender, the contract return also a successful response, by doing this on the unpin object and to limit access to the state, there is no verification on the objects state to check if object exist when trying to unpin object. So if we try to unpin object that does not exist, the contract return successfully because the (ObjectId, senderAddr) tuple doesn't exist in the pins state.
π Link
Wait #123 before merge