https://github.com/joystream/status-endpoint-joystream
Status endpoint for the Joystream network
https://github.com/joystream/status-endpoint-joystream
Last synced: about 1 year ago
JSON representation
Status endpoint for the Joystream network
- Host: GitHub
- URL: https://github.com/joystream/status-endpoint-joystream
- Owner: Joystream
- License: gpl-3.0
- Created: 2019-06-23T18:23:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-10T11:40:38.000Z (about 1 year ago)
- Last Synced: 2025-04-10T12:54:51.230Z (about 1 year ago)
- Language: TypeScript
- Size: 1.31 MB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# status-endpoint-joystream
Status endpoint for the Joystream network
## How to Install
Clone the repo, then run:
```
$ yarn
```
Add your config variables to `.env`, create `exchanges.json` (see: `exchanges.example.json) file and then run:
```
$ yarn start
```
to build and start the server.
## Logs
```
# All logs
$ yarn pm2 logs status-server
# Errors only
$ yarn pm2 logs status-server --err
```
## Shutdown
```
yarn pm2 delete status-server
```
## Updating the server after runtime upgrade
```
# 1. Kill the process
yarn pm2 delete status-server
# 2. Make sure lastProcessedBlock is >= RUNTIME_UPGRADE_BLOCK_NUMBER
jq .lastBlockProcessed exchanges.json
# 3. Make sure there were no exchanges at or after RUNTIME_UPGRADE_BLOCK_NUMBER as they may have been processed incorrectly.
# In case there were any - see "Handling exchanges at or after RUNTIME_UPGRADE_BLOCK_NUMBER" below
jq .exchanges[-1].blockHeight exchanges.json
# 4. Set `lastBlockProcessed` to RUNTIME_UPGRADE_BLOCK_NUMBER-1 (use the actual number!)
jq '.lastBlockProcessed=RUNTIME_UPGRADE_BLOCK_NUMBER-1' exchanges.json > exchanges-tmp.json && mv exchanges-tmp.json exchanges.json
# 5. Start the new status server
cp exchanges.json exchanges-backup.json
git checkout new_status_server_branch
cp exchanges-backup.json exchanges.json
yarn && yarn start
```
### Handling exchanges at or after `RUNTIME_UPGRADE_BLOCK_NUMBER`
In case some exchanges happend at or after the runtime upgrade, but before the new version of the server was started (at step 3.), they need to be manually removed from `exchanges.json` (this is the limitation of the current implementation). In order to remove those exchanges:
1. Let sum of the USD amount of those exchanges be `s`
2. Increase `sizeDollarPool` by `s`
3. Decrease `totalUSDPaid` by `s`
4. Remove those exchanges from `exchanges` array
5. Remove any entries in `poolChangeHistory` related to those exchanges