Skip to content

Commit

Permalink
feat: Provider insolvency (#278)
Browse files Browse the repository at this point in the history
* slash extrinsic (tests + automatic top ups) and top_up extrinsic (untested)

* slash extrinsic (tests + automatic top ups) and top_up extrinsic (untested)

* fix test: assert event present SlashedAndAwaitingTopUp

* typegen

* fix submit proof test

* refactor slashing events, fix test

* refactor do_slash

* update docs, typegen

* do_slash overhauled

* top up unit tests, use proper errors

* update do_slash to slash the held deposit only, update tests

* amend docs

* early return slash if the used_capacity is below the minimum capacity

* (wip) provider top up expiration item

* amend review

* fix test

* revert: ⏪ Revert changes in `submit-proofs` integration test suite

* fix: ✅ Consider scenario where next challenge block is the same for first and second BSP

* remove GracePeriodToSlashedProviders for ProviderTopUpExpirations, mark providers as insolvent in on_idle, slash remaining deposit

* handle insolvent providers in payment streams

* fail operations if insolvent provider in providers pallet, fix tests

* file system pallet fails extrinics if the provider is insolvent

* new has_active_payment_streams method, delete provider extrinsic and can_delete_provider runtime api, delete provider from indexer

* max and default replication targets for storage requests, integrity test

* revert removing BenchmarkHelpers

* use runtime api for provider top up ttl

* add null replicationTarget to issueStorageRequest calls in tests

* fix import

* sync with main

* toString replacing toNumber

* fix tests with replication target

* fix replication target int tests

* add DefaultReplicationTarget to runtime params

* fix set global param tests

* use weight meter and return consumed weight from on idle executions, fix tests

* fix msp storage request test setup

* pass user to create and bucket and storage request

* fix debt collection test

* fix client side checkpoint challenges inclusion for submit proof, submit proof now accepts checkpoint challenges if last_checkpoint_tick is equal to challenges tick, CheckpointChallengePeriod now must be greater than greatest provider challenge period + tolerance + 1 to avoid attack, new best block info command

* is_storage_request_open_to_volunteers runtime api, skip volunteering for file, add TODOs for storage-delete integration test and comment out broken test

* temporary fix non determinstic payment stream check

* remove unused variable from integration test

* remove redundant test

* amend review

* add missing param to issueStorageRequest

* change storage keys InsolventProviders, ProviderTopUpExpirations, AwaitingTopUpFromProviders to StorageProviderId

* StorageHubTickGetter trait and impl by proofs dealer pallet, unallow provider charging while provider awating top up, awaiting top up tick based on StorageHubTickGetter

* fix test

* fix test

* fix pallet randomness mock

* style: 🎨 Formatting fixes in comments

* update comments

* typegen

* amend review

* typegen

* clippy

* amend review

* fix: 🩹 Consider providers awaiting for top up as insolvent

* amend review; add stop challenge cycle when provider becomes insolvent, update payment streams tests

* fix benchmarking

* amend

---------

Co-authored-by: Facundo Farall <[email protected]>
  • Loading branch information
snowmead and ffarall authored Dec 18, 2024
1 parent e722b3c commit 839ef03
Show file tree
Hide file tree
Showing 92 changed files with 5,004 additions and 1,542 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 839ef03

Please sign in to comment.