-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feat: price per byte #1078
Feat: price per byte #1078
Conversation
dedbed5
to
cde6676
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.
Great job Marcin! I've added a few suggestions.
I'll approve now, since there is nothing major blocking this, however it would be nice if the comments were responded to and/or addressed, in particular:
- Fix for
minPricePerBytePerSecond
=>collateralPerByte
in themarketplacesuite
- Add tests to
testcancelled
andtestfinished
that show the collateral passed intoonCleanUp
is correct.
…> collateralPerByte
…icePerByte, and maxCollateralPerByte
cde6676
to
befcace
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.
Thanks for making the changes, Marcin.
check eventually ( | ||
onProcessSlotCalledWith == | ||
@[ | ||
(item3.requestId, item3.slotIndex), | ||
(item2.requestId, item2.slotIndex), | ||
(item1.requestId, item1.slotIndex), | ||
(item0.requestId, item0.slotIndex), | ||
] | ||
) |
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.
IIRC, i had issues with this passing consistently on slow CI systems due to popping of SlotQueueItems before the new ones are added. Hopefully this doesn't happen 👍
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.
Oh, I see - so far it seems to be working ok. push
is not async, so I thought it will not let it happen if we do not have any await
in between. We could probably even use a helper that is already there proc push*(self: SlotQueue, items: seq[SlotQueueItem]): ?!void
...
func collateralPerSlot*(ask: StorageAsk): UInt256 = | ||
ask.collateralPerByte * ask.slotSize |
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.
As we discussed yesterday, for the sake of explicitness, I would be cautious with this helper as the real collateral that the host has to pay is dependent on the slot's state.
I would suggest replacing this helper with a helper on the market
abstraction that would return the correct collateral based on the slot's state. If I see it correctly, then this is used only at the filling
state (except all the tests usages), where I exactly suggested replacing this in the review of Arnaud PR: #1083 (comment)
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.
I am kind of fine with it, but could we maybe please handle it on a separate PR - or maybe on Arnoud's PR? I will not be able to work on in in the coming days I am behind with BitTorrent stuff...
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.
Yeah, make sense - I am OK with that 👍
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.
Thanks @AuHau!
openapi.yaml
Outdated
type: string | ||
description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string | ||
description: Total remaining collateral (in amount of tokens) that can still be used for matching requests |
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.
"remaining" word kind of does not make sense in the context of POST
, but I don't really have any idea how to improve it.
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.
Yes, good catch, "remaining" should not be there. I introduced totalCollateral
on the API level exactly for the reason you mention. On API you can only specify totalCollateral
and not totalRemainingCollateral
.
Now it is: description: Total collateral (in amount of tokens) that can be used for matching requests
Introduces the following naming changes:
For
StorageAsk
:pricePerBytePerSecond
,collateralPerByte
For
Availability
:minPricePerBytePerSecond
totalRemainingCollateral
maxCollateralPerByte
(computed helper)StorageAsk helpers:
pricePerSlotPerSecond
pricePerSlot
collateralPerSlot
Fixes related computations and tests