Skip to content

Use Vault in Marketplace #223

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

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

Use Vault in Marketplace #223

wants to merge 34 commits into from

Conversation

markspanbroek
Copy link
Member

@markspanbroek markspanbroek commented Feb 27, 2025

Uses the vault for all token transfers in the marketplace. The marketplace now no longer keeps any funds itself.

This has impact on the following as well:

  • clients and hosts can no longer specify a different address to receive payouts
  • when storage request fails (too many slots freed) then the funds are frozen
    • client gets a refund for the remaining time
    • client gets the repair rewards for the freed slots
  • validators need to withdraw their rewards at the end of the storage request
  • we now use storage optimized types Timestamp, Duration and TokensPerSecond on the API
  • collateral calculations are moved to a separate module
  • fuzzing is removed (it only tested accounting of funds in the marketplace itself, which is now removed)
  • RequestCancelled event is removed, which was not great anyway because it is not emitted at the moment that the request is cancelled
  • repair reward is now a bonus paid out at the end, no longer a discount on the collateral

@markspanbroek markspanbroek force-pushed the vault-integration branch 4 times, most recently from 32d0dbd to 095e90f Compare March 6, 2025 14:24
@markspanbroek markspanbroek force-pushed the vault-integration branch 2 times, most recently from 53679b4 to cfd30bf Compare March 25, 2025 14:32
@markspanbroek markspanbroek force-pushed the vault branch 2 times, most recently from 6a7d559 to 957f6ec Compare April 16, 2025 09:06
Base automatically changed from vault to master April 16, 2025 09:57
@markspanbroek markspanbroek marked this pull request as ready for review April 16, 2025 11:31
@AuHau AuHau mentioned this pull request Apr 17, 2025
so that they can no longer be transfered
within the vault
This state is no longer necessary, vault ensures
that payouts happen only once. Hosts could bypass
this state anyway by withdrawing from the vault
directly.
- changes to marketplace constructor
- we no longer have _marketplaceTotals
- timestamps have their own type now
- freeSlot no longer takes payout addresses
- slot state 'Paid' no longer exists
- freeSlot can be invoked more than once now
- a failed request no longer ends immediately
No need to test the token itself
It is no longer a discount on the collateral, to
simplify reasoning about collateral in the sales
module of the codex node
So that a storage provider can know how much collateral is
returned when it calls freeSlot()
Copy link
Member

@AuHau AuHau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, big effort! 👏

Generally LGTM, but there are a few critical points that need clarification or addressing, so I will go for the "Request changes" here.

I have gone over the contract changes, still need to see the testing of this, but that will be in round two 😅

markspanbroek and others added 7 commits May 27, 2025 11:31
Because a client might still need to call withdraw()
reason: freeSlot() will call forciblyFreeSlot when contract is not
finished, so we can use that instead
reason: hosts are paid for the time that they hosted
the slot up until the time that the request failed

Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
reason: the function only depends on the request, and it is similar
to the pricePerSlotPerSecond function

Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants