-
Notifications
You must be signed in to change notification settings - Fork 162
feat: chainSpec based controller config; Types from apps-config #351
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
Changes from 1 commit
ae1de13
5d254dd
7072fdc
c682665
4ab1b2d
cc9a962
ede1787
39e1a1a
be66056
e465092
19a66e7
0ac5573
c5e9284
0c57ecd
6692e50
4b4d9a2
b81c0d1
46f067d
92a8856
8451309
87572a9
c38c105
a1a988a
79f9eb8
cf84d63
b34cca2
a16235a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Co-authored-by: David <[email protected]>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,23 +19,24 @@ Before taking any other steps to integrate a chain with Sidecar, a chain's up-to | |
|
|
||
| Sidecar offers the ability to configure which controllers to mount. Sidecar uses a chain's spec name to determine which controller config to use, and if no config is linked to a spec name, then the [default config](/src/chains-config/defaultControllers.ts) is used. | ||
|
|
||
| A chain builder can follow the below steps and submit a chain's controller config via PR, where it will be reviewed and merged once deemed ready by the maintainers. | ||
| A chain builder can follow the steps below and submit a chain's controller config via PR, where it will be reviewed and merged once deemed ready by the maintainers. | ||
|
|
||
| #### 1) Create a controller config | ||
|
|
||
| Create a controller config for your chain. The shape of the controller config is specified [here](/src/chains-config/ControllerConfig.ts). The `controller` property has keys from the [controller export](/src/controllers/index.ts), which is an exhaustive collection of the available controller classes. In order to see the path(s) associated with a controller one must look in the controller source code. | ||
|
|
||
| The easiest way to start creating a controller config would be to copy [defaultControllers.ts](/src/chains-config/ControllerConfig.ts) and name the file and export `{specName}Controllers`. Then change the boolean values to indicate wether or not to mount a controller and its paths. Ensure to export the controller config from `chains-config` by adding `export * from './{specName}Controllers.ts'` in [/src/chains-config/index.ts](/src/chains-config/index.ts). | ||
|
|
||
| To determine what controllers to include, one must consider the runtime logic, specifically what pallets the chain uses. It is important to keep in mind the assumptions the service's logic makes and what exact pallets the service queries. E.g. in order to use [`PalletsStakingProgressController`](/src/controllers/pallets/PalletsStakingProgressController.ts), one would check [`PalletsStakingProgressService.ts`](/src/services/pallets/PalletsStakingProgressService.ts). There one would see it queries `staking`, `sessions`, `babe` pallets and makes certain assumptions about how the pallets are used together in the runtime. | ||
| To determine what controllers to include, one must consider the runtime logic, specifically what pallets the chain uses. It is important to keep in mind the assumptions the service's logic makes and what exact pallets the service queries. | ||
| An example is in order. If we want to use [`PalletsStakingProgressController`](/src/controllers/pallets/PalletsStakingProgressController.ts), first check [`PalletsStakingProgressService.ts`](/src/services/pallets/PalletsStakingProgressService.ts); here we see it queries `staking`, `sessions`, `babe` pallets and makes certain assumptions about how the pallets are used together in the runtime. | ||
|
|
||
| In some circumstance, a chain may need a new path, modify a path or altered business logic for a path. Path changes that help a chain support wallets will be given priority. Breaking path changes are strongly not preferred. | ||
| In some circumstance, a chain may need a new path, modify a path or altered business logic for a path. Path changes that help a chain support wallets will be given priority. Breaking changes to paths are usually rejected. | ||
|
|
||
| ##### Basic balance transfer support | ||
|
|
||
| In order to support traditional balance transfers the chain's Sidecar endpoints should support account balance lookup, transaction submission, transaction material retrieval, and block queries. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. Even if we haven't decided the exact token standard, good to start somewhere.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be good to link to examples of how each of these look like.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dvdplm - what exactly do you have in mind for examples? My idea here was essentially to say "make sure to add the relevant controllers for these endpoints".
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah maybe it's dumb but my thinking was to link to example implementations of the existing Polkadot/Kusama endpoints; a dev adding sidecar for their chain might want to peek at how you did those endpoints as theirs will likely be fairly similar? |
||
|
|
||
| To support those actions the following endpoints are necessary: | ||
| To support these features the following endpoints are necessary: | ||
|
|
||
| | Path | Controller | Description | | ||
| |:----------------------------------------:|:-----------------------------:|:--------------------------------------------------------------------------:| | ||
|
|
@@ -58,9 +59,9 @@ const specToControllerMap = { | |
|
|
||
| #### 3) Test | ||
|
|
||
| Run it against an archive version of your chain's node: | ||
| Run it against a node running your chain in archive mode: | ||
|
|
||
| - Ensure all the correct paths work, including the root path | ||
| - Ensure all the expected paths work, including the root path, preferably with tests | ||
| - Exercise each query param of every path | ||
| - Make sure transaction submission works | ||
| - Try out historic queries across runtimes where types might change | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.