Skip to content

Vault integration#26

Merged
markspanbroek merged 41 commits intomainfrom
vault-integration
Jan 29, 2026
Merged

Vault integration#26
markspanbroek merged 41 commits intomainfrom
vault-integration

Conversation

@markspanbroek
Copy link
Contributor

Updated version of logos-storage/logos-storage-contracts-eth#223

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 and others added 30 commits January 19, 2026 10:13
Vault stores balances as uint128
replaced by formal verification with certora
- removes RequestCancelled event, which was not great anyway
  because it is not emitted at the moment that the request is
  cancelled
- move all collateral calculatons to separate library
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()
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>
markspanbroek and others added 11 commits January 20, 2026 12:05
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>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
reason: to fix bugs in block time manipulation that
were failing the vault tests.
reason: gas estimation bugs in hardhat that were failing tests
@markspanbroek markspanbroek merged commit c0fafaa into main Jan 29, 2026
7 checks passed
@markspanbroek markspanbroek deleted the vault-integration branch January 29, 2026 12:57
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.

1 participant