Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ae1de13
feat: chainSpec based controller config; Types from apps-config
emostov Nov 24, 2020
5d254dd
Update mock api to include derive getBlock - specs work
emostov Nov 24, 2020
7072fdc
Update to reflect TS 4.1
emostov Nov 24, 2020
c682665
Clean up comments
emostov Nov 24, 2020
4ab1b2d
Save
emostov Dec 2, 2020
cc9a962
Merge origin master
emostov Dec 2, 2020
ede1787
feat: Token query param for non-native token balance-info
emostov Dec 2, 2020
39e1a1a
Revert package.json
emostov Dec 2, 2020
be66056
Initial reply david review
emostov Dec 2, 2020
e465092
Update src/main.ts
emostov Dec 2, 2020
19a66e7
Remove kulupu controller
emostov Dec 2, 2020
0ac5573
Merge branch 'types-package' of https://github.com/paritytech/substra…
emostov Dec 2, 2020
c5e9284
Add chain builder integration guide
emostov Dec 3, 2020
0c57ecd
Patch CHAIN_INTEGRATION.md
emostov Dec 3, 2020
6692e50
Apply suggestions from code review
emostov Dec 4, 2020
4b4d9a2
Update CHAIN_INTEGRATION.md
emostov Dec 4, 2020
b81c0d1
Bump deps
emostov Dec 8, 2020
46f067d
Merge remote-tracking branch 'origin' into types-package
emostov Dec 8, 2020
92a8856
Use whole options object for controller creation
emostov Dec 8, 2020
8451309
Apply suggestions from code review
emostov Dec 9, 2020
87572a9
Respond to maciej feedback
emostov Dec 9, 2020
c38c105
Merge branch 'types-package' of https://github.com/paritytech/substra…
emostov Dec 9, 2020
a1a988a
Update chain integration guide
emostov Dec 9, 2020
79f9eb8
Remove excessive nullish colescing operators
emostov Dec 9, 2020
cf84d63
Merge origin master
emostov Dec 9, 2020
b34cca2
Fix merge issue
emostov Dec 9, 2020
a16235a
Update CHAIN_INTEGRATION.md
emostov Dec 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: David <[email protected]>
  • Loading branch information
emostov and dvdplm authored Dec 9, 2020
commit 84513097fdaf8162ba13db2d1204233e27027239
13 changes: 7 additions & 6 deletions CHAIN_INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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".

Copy link
Contributor

Choose a reason for hiding this comment

The 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 |
|:----------------------------------------:|:-----------------------------:|:--------------------------------------------------------------------------:|
Expand All @@ -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
Expand Down