Skip to content
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: Experimental PLO endpoints #509

Merged
merged 38 commits into from
Apr 19, 2021
Merged

Conversation

emostov
Copy link
Contributor

@emostov emostov commented Apr 8, 2021

Overview

This PR introduces the following endpoints for parachain lease offerings:

  • /experimnetal/paras
  • /experimental/paras/auctions/current
  • /experimental/paras/{paraId}/crowdloan-info
  • /experimental/paras/crowdloans
  • /experimental/paras/{paraId}/lease-info
  • /experimental/paras/leases/current

⚠️ WARNING ⚠️

These are considered experimental as we may break the API without bumping api-sidecar's major version.

Closes: #490

cc @CurlyBracketEffect @joepetrowski

emostov and others added 15 commits March 31, 2021 14:33
* add crowdloan routes to the ParasController

* add crowdloan routes functionality in the ParaService

* fix: remove parseFundInfo, cleanup types

* cleanup comments

* fix type

* add types for crowdloans route

* cleanup service and controller

* remove todo

* fix: types for paraId, fix fundInfo query param, optimize entries
* Update auctions current to use offset to key into Winning

* MVP leases current

* Add paras service

* Add /paras to controller

* Update doc comments

* Add retirement end

* Add response interfaces

* Add interfaces for leases, para, and auctions

* Add doc comment to interface

* Exclude lease-info for indexs with no lease

* Remove retirement period end bc no longer have retirements

* Address tarik review comment

* Apply suggestions from code review

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
* feat: include lease set for each winning bid in auctions/current

* Rename some vars

* Update comment
@emostov
Copy link
Contributor Author

emostov commented Apr 9, 2021

Some of the hardcoded values for when we enumerate lease periods will need to be updated to reflect github.com/paritytech/polkadot/pull/2862

Ideally we can pull the slot range dynamically

@emostov emostov requested review from TarikGul and dvdplm April 12, 2021 22:35
@emostov emostov marked this pull request as ready for review April 12, 2021 22:38
@emostov emostov added the A0 - Please Review PR is ready for review label Apr 12, 2021
Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
src/types/responses/Paras.ts Outdated Show resolved Hide resolved
src/types/responses/Paras.ts Outdated Show resolved Hide resolved
src/types/responses/Paras.ts Outdated Show resolved Hide resolved
src/types/responses/Paras.ts Outdated Show resolved Hide resolved
src/types/responses/Paras.ts Outdated Show resolved Hide resolved
@TarikGul
Copy link
Member

TarikGul commented Apr 13, 2021

Sanity and edge cases manually tested:
(Rococo local node with Alice and Bob)

  • /experimental/paras/
  • /experimental/paras/crowdloans
    • ?fundInfo=true
    • ?fundInfo=false
    • Handles no crowdloans correctly
  • /experimental/paras/:paraId/crowdloan-info
    • Handles a paraId that does not exist correctly. [Note]: it does at and fundInfo: null (Should it also return paraId doesnt exist)
  • /experimental/paras/:paraId/lease-info
    • After a auction is over should correctly return the the winner's lease
    • Handles a paraId that does not exist correctly. [Note]: it does at, fundInfo: null, paraLifeCycle: null` (Should it also return paraId doesnt exist)
  • /experimental/paras/leases/current
    • After winning an auction and waiting for the for the current lease to exist it queries paraId's correctly.
  • /experimental/paras/auctions/current
    • Correctly receiving auction info during an auction
    • Correctly shows bids for slots.
  • With both parachains and parathreads registered all cases work.

@emostov

Let me know if you can think of other potential tests.

@emostov
Copy link
Contributor Author

emostov commented Apr 13, 2021

(Should it also return paraId doesnt exist)

We could do a check in paras.paraLifecycles to see if a paraId exists - need to double check if thats the "source of truth" for wether or not a paraId is registered.

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

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

LGTM, bug issue was talked over and resolved. currently implementation is right.

src/services/paras/ParasService.ts Show resolved Hide resolved
src/services/test-helpers/mock/mockApi.ts Show resolved Hide resolved
* fix: typefactory, and cleanup mockApi
src/chains-config/westendControllers.ts Show resolved Hide resolved
src/services/paras/ParasService.ts Show resolved Hide resolved
src/services/paras/ParasService.ts Outdated Show resolved Hide resolved
src/services/paras/ParasService.ts Outdated Show resolved Hide resolved
src/services/paras/ParasService.ts Outdated Show resolved Hide resolved
src/services/paras/ParasService.ts Outdated Show resolved Hide resolved
src/services/paras/ParasService.ts Show resolved Hide resolved
src/services/paras/ParasService.ts Show resolved Hide resolved
src/services/paras/ParasService.ts Show resolved Hide resolved
src/types/responses/Paras.ts Outdated Show resolved Hide resolved
@emostov
Copy link
Contributor Author

emostov commented Apr 19, 2021

@dvdplm everything from your reviews should be addressed now

@emostov emostov merged commit 1fa4f94 into master Apr 19, 2021
@emostov emostov deleted the feat-experiment-plo-endpoints branch April 19, 2021 19:50
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0 - Please Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate PLO support
4 participants