Skip to content

Commit

Permalink
Merge pull request #54 from paritytech/master
Browse files Browse the repository at this point in the history
Merge upstream
  • Loading branch information
khaq authored Jul 24, 2023
2 parents c7f5d02 + 83d201a commit db520cf
Show file tree
Hide file tree
Showing 80 changed files with 2,194 additions and 1,881 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/calc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
toolchain: stable

- name: Rust Cache
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1

- name: Cargo test
uses: actions-rs/[email protected]
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -34,7 +34,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install JS dependencies
run: yarn install

Expand All @@ -55,7 +55,7 @@ jobs:

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -98,7 +98,7 @@ jobs:
- name: Install JS dependencies
run: yarn install

- name: Build
run: yarn build

Expand All @@ -117,7 +117,7 @@ jobs:

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -129,7 +129,7 @@ jobs:
- name: Install JS dependencies
run: yarn install

- name: Build Docs
run: yarn build:docs

Expand Down
823 changes: 0 additions & 823 deletions .yarn/releases/yarn-3.3.1.cjs

This file was deleted.

874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.3.1.cjs
yarnPath: .yarn/releases/yarn-3.6.1.cjs
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,72 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [17.1.1](https://github.com/paritytech/substrate-api-sidecar/compare/v17.1.0..v17.1.1) (2023-07-05)

### Bug Fixes

- fix: rename wsurl endpoints to asset hub ([#1301](https://github.com/paritytech/substrate-api-sidecar/pull/1301)) ([7a7e7de](https://github.com/paritytech/substrate-api-sidecar/commit/7a7e7de03e17b3ebdb156f6a7580737858e47810))
- fix: /accounts/{accountId}/convert encoding for ecdsa ([#1280](https://github.com/paritytech/substrate-api-sidecar/pull/1280)) ([86edf0b](https://github.com/paritytech/substrate-api-sidecar/commit/86edf0b058c3effad80ab9d314dff914e2e7aab8))
- fix: rename statemint/statemine/westmint to asset-hub-polkadot/kusama/westend ([#1296](https://github.com/paritytech/substrate-api-sidecar/pull/1296)) ([362e912](https://github.com/paritytech/substrate-api-sidecar/commit/362e91224f0bb8562dd0c28da740621bbdad72c0))

### Chores

- chore: bump Swatinem/rust-cache from 2.5.0 to 2.5.1 ([#1300](https://github.com/paritytech/substrate-api-sidecar/pull/1300)) ([45d8ecf](https://github.com/paritytech/substrate-api-sidecar/commit/45d8ecf84841ee28aad7f29cf099d9a829b1ee6c))
- chore: bump semver from 7.3.5 to 7.5.3 in /docs ([#1298](https://github.com/paritytech/substrate-api-sidecar/pull/1298)) ([45eee30](https://github.com/paritytech/substrate-api-sidecar/commit/45eee30f1b3814721d949868e70ee3212f164b4d))
- chore: bump Swatinem/rust-cache from 2.4.0 to 2.5.0 ([#1297](https://github.com/paritytech/substrate-api-sidecar/pull/1297)) ([2579500](https://github.com/paritytech/substrate-api-sidecar/commit/2579500952acd7a25bdc1cf20424aed445778a21))

## Compatibility

Tested against:
- Polkadot v9420
- Kusama v9420
- Westend v9420

## [17.1.0](https://github.com/paritytech/substrate-api-sidecar/compare/v17.0.0..v17.1.0) (2023-06-13)

### Features

- feat: add prometheus metrics in dedicated port ([#1232](https://github.com/paritytech/substrate-api-sidecar/pull/1232)) ([a256790](https://github.com/paritytech/substrate-api-sidecar/commit/a256790e75b2a717896ab019bc03d6f96542ddf3))

### Bug Fixes

- fix: Add BlockTraces to Westend config ([#1292](https://github.com/paritytech/substrate-api-sidecar/pull/1292)) ([d3de591](https://github.com/paritytech/substrate-api-sidecar/commit/d3de591f3b95f9ca30f0bbf667918eb05b9a7497))
- fix(deps): update pjs api ([#1294](https://github.com/paritytech/substrate-api-sidecar/pull/1294)) ([fe8ef2e](https://github.com/paritytech/substrate-api-sidecar/commit/fe8ef2e741f5013fbe2f11923ba67d333d9eb8ca))

### CI

- CI: fix gha set-output command ([#1291](https://github.com/paritytech/substrate-api-sidecar/pull/1291)) ([609b332](https://github.com/paritytech/substrate-api-sidecar/commit/609b332ccf4582f1987615036e7b53eb26a5bbad))

### Docs

- docs: update release guide ([#1288](https://github.com/paritytech/substrate-api-sidecar/pull/1288)) ([f1516ad](https://github.com/paritytech/substrate-api-sidecar/commit/f1516ad00be419d5ee9e9e0eb0919122a22bb678))

## Compatibility

Tested against:
- Polkadot v9420
- Kusama v9420
- Westend v9420

## [17.0.0](https://github.com/paritytech/substrate-api-sidecar/compare/v16.0.0..v17.0.0) (2023-05-29)

### Breaking Changes

- fix(deps)!: update polkadot-js, and adjust for breaking changes (isFrozen compatibility fix) & kusama test removed ([#1285](https://github.com/paritytech/substrate-api-sidecar/pull/1285)) ([110b01a](https://github.com/paritytech/substrate-api-sidecar/commit/110b01ad9ce80568dbe05201ea2ae07d687ae0d4))
NOTE: In the endpoint `/accounts/{accountId}/asset-balances`, the field `isFrozen` will now give new outputs when it is no longer supported.

### Chores

- chore: bump Swatinem/rust-cache from 2.3.0 to 2.4.0 ([#1284](https://github.com/paritytech/substrate-api-sidecar/pull/1284)) ([e5e5987](https://github.com/paritytech/substrate-api-sidecar/commit/e5e5987e2219c4729c33aec8055caada7f655a09))
- chore: bump Swatinem/rust-cache from 2.2.1 to 2.3.0 ([#1283](https://github.com/paritytech/substrate-api-sidecar/pull/1283)) ([fa9d52f](https://github.com/paritytech/substrate-api-sidecar/commit/fa9d52f760d17f6cd09c0b6990ba617b06055d93))

## Compatibility

Tested against:
- Polkadot v9420
- Kusama v9420
- Westend v9420

## [16.0.0](https://github.com/paritytech/substrate-api-sidecar/compare/v15.0.0..v16.0.0) (2023-05-08)

### Breaking Changes
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,26 @@ file you can `symlink` it with `.env.test`. For example you could run
`ln -s .env.myEnv .env.test && yarn start:log-rpc` to use `.env.myEnv` to set ENV variables. (see linux
commands `ln` and `unlink` for more info.)

### Prometheus server
Prometheus metrics can be enabled by running sidecar with the following flag :

```bash
yarn start --prometheus
```

You can also define a custom port by running :

```bash
yarn start --prometheus --prometheus-port=<YOUR_CUSTOM_PORT>
```

The metrics endpoint can then be accessed :
- on the default port : `http://127.0.0.1:9100/metrics` or
- on your custom port if you defined one : `http://127.0.0.1:<YOUR_CUSTOM_PORT>/metrics`

That way you will have access to the default prometheus metrics and one extra custom metric called `sas_http_errors` (of type counter). This counter is increased by 1 every time an http error has occured in sidecar.


## Debugging fee and staking payout calculations

It is possible to get more information about the fee and staking payout calculation process logged to
Expand All @@ -258,7 +278,7 @@ CALC_DEBUG=1 sh calc/build.sh

## Chain integration guide

[Click here for chain integration guide.](./guides/CHAIN_INTEGRATION.md))
[Click here for chain integration guide.](./guides/CHAIN_INTEGRATION.md)

## Docker

Expand Down
17 changes: 11 additions & 6 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@

1. Make sure the polkadot-js dependencies are up to date. Refer to the "Updating polkadot-js dependencies" section in the [README](./README.md).

1. Make sure to be in the `master` branch, and `git pull origin master`.

1. Make sure that you've run `yarn` in this folder, and run `cargo install wasm-pack` so that that binary is available on your `$PATH`.

1. Checkout a branch with the format `name-v5-0-1`. When deciding what version will be released it is important to look over 1) PRs since the last release and 2) release notes for any updated polkadot-js dependencies as they may affect type definitions.
1. Checkout a branch with the format `name-v5-0-1` (with `name` being the name of the person doing the release, e.g. `tarik-v5-0-1`). When deciding what version will be released it is important to look over 1) PRs since the last release and 2) release notes for any updated polkadot-js dependencies as they may affect type definitions.

1. The next step is to run the e2e tests. There are two types of e2e tests: `yarn test:historical-e2e-tests`, and `yarn test:latest-e2e-tests`. If you would like to run either tests against a single chain you may use the flag `--chain` to specify the chain. If you would also like to test against a local node you may use the `--local` flag in conjunction with `--chain`. Before moving forward ensure all tests pass, and if it warns of any missing types feel free to make an issue [here](https://github.com/paritytech/substrate-api-sidecar/issues).

Note: that the e2e tests will connect to running nodes in order to test sidecar against real data, and they may fail owing to those connections taking too long to establish. If you run into any failures, try running tests the tests again.
Note: that the e2e tests will connect to running nodes in order to test sidecar against real data, and they may fail owing to those connections taking too long to establish. If you run into any failures, try running the tests again.

1. Update the version in the package.json (this is very important for releasing on NPM).

1. Update the substrate-api-sidecar version in the docs by going into `docs/src/openapi-v1.yaml`, and changing the `version` field under `info` to the releases respected version. Then run `yarn build:docs`.

1. Update `CHANGELOG.md` by looking at merged PRs since the last release. Follow the format of previous releases. Only record dep updates if they reflect type definition updates as those affect the users API. It will also help to sort previous PR's by "recently updated" in order to see all PR's merged since the last release.
Note: you can double check that the version is updated by opening the page `index.html` (from folder `docs/dist`) on your browser. The version badge is located on the top of the page next to the title.

Make sure to note if it is a high upgrade priority (e.g. it has type definitions for an upcoming runtime upgrade to a Parity maintained network).
1. Update `CHANGELOG.md` by looking at merged PRs since the last release. Follow the format of previous releases. Only record dep updates if they reflect type definition updates as those affect the users API. It will also help to sort previous PR's by "recently updated" in order to see all PR's merged since the last release.

1. Commit with ex: `chore(release): 5.0.1`, then `git push` your release branch up, make a PR, get review approval, then merge.
- Make sure to note if it is a high upgrade priority (e.g. it has type definitions for an upcoming runtime upgrade to a Parity maintained network).
- If it is a breaking change, it can be helpful to add a `NOTE:` underneath to give a brief explanation as to what the breaking change is. Example in the PR of [chore(release): 16.0.0](https://github.com/paritytech/substrate-api-sidecar/commit/ea74d007f9320aba954ca163d3d57d9b64d47d63).

**NOTE**: Before pushing up as a sanity check run the following 4 commands and ensure they all run with zero errors. There is one exception with `yarn test` where you will see errors logged, that is expected as long as all the test suites pass.
1. Before pushing up as a sanity check run the following 4 commands and ensure they all run with zero errors. There is one exception with `yarn test` where you will see errors logged, that is expected as long as all the test suites pass.

```bash
yarn dedupe
Expand All @@ -31,6 +34,8 @@
yarn test
```

1. Commit with ex: `chore(release): 5.0.1`, then `git push` your release branch up, make a PR, get review approval, then merge.

1. If one of the commits for this release includes the `calc` directory and package, make sure to follow the instructions below for releasing it on npm (if a new version hasn't yet been released seperately).
#### Publish on GitHub
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/app.bundle.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions docs/src/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ info:
license:
name: GPL-3.0-or-later
url: https://github.com/paritytech/substrate-api-sidecar/blob/master/LICENSE
version: 16.0.0
version: 17.1.1
tags:
- name: accounts
- name: blocks
Expand Down Expand Up @@ -2224,7 +2224,8 @@ components:
format: unsignedInteger
isFrozen:
type: boolean
description: Whether the asset is frozen for non-admin transfers.
description: Whether the asset is frozen for non-admin transfers. Note, that some runtimes may not have
support for isFrozen and if so the following will be returned `isFrozen does not exist for this runtime`
isSufficient:
type: boolean
description: Whether a non-zero balance of this asset is a deposit of sufficient
Expand Down Expand Up @@ -2281,7 +2282,8 @@ components:
format: unsignedInteger
isFrozen:
type: boolean
description: Whether the asset is frozen for non-admin transfers.
description: Whether the asset is frozen for non-admin transfers. Note, that some runtimes may not have
support for isFrozen and if so the following will be returned `isFrozen does not exist for this runtime`
AssetMetadata:
type: object
properties:
Expand All @@ -2304,7 +2306,8 @@ components:
format: unsignedInteger
isFrozen:
type: boolean
description: Whether the asset metadata may be changed by a non Force origin.
description: Whether the asset metadata may be changed by a non Force origin. Note, that some runtimes may not have
support for isFrozen and if so the following will be returned `isFrozen does not exist for this runtime`
BalanceLock:
type: object
properties:
Expand Down
6 changes: 3 additions & 3 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4356,13 +4356,13 @@ __metadata:
linkType: hard

"semver@npm:^7.3.5":
version: 7.3.5
resolution: "semver@npm:7.3.5"
version: 7.5.3
resolution: "semver@npm:7.5.3"
dependencies:
lru-cache: ^6.0.0
bin:
semver: bin/semver.js
checksum: 5eafe6102bea2a7439897c1856362e31cc348ccf96efd455c8b5bc2c61e6f7e7b8250dc26b8828c1d76a56f818a7ee907a36ae9fb37a599d3d24609207001d60
checksum: 9d58db16525e9f749ad0a696a1f27deabaa51f66e91d2fa2b0db3de3e9644e8677de3b7d7a03f4c15bc81521e0c3916d7369e0572dbde250d9bedf5194e2a8a7
languageName: node
linkType: hard

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import accountsApprovals993480 from './993480.json';

export const statemineAccountsApprovalsEndpoints = [
export const assetHubKusamaAccountsApprovalsEndpoints = [
[
'/accounts/CwqsPsimisa33niBsKd513TBne4PnTHvfhyLR6Vh73DBQMY/asset-approvals?assetId=100&delegate=CwqsPsimisa33niBsKd513TBne4PnTHvfhyLR6Vh73DBQMY&at=993480',
JSON.stringify(accountsApprovals993480),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import accountAssetBalance1100000 from './1100000.json';
import accountAssetBalance1300000 from './1300000.json';
import accountAssetBalance1800000 from './1800000.json';

export const statemineAccountAssetBalanceEndpoints = [
export const assetHubKusamaAccountAssetBalanceEndpoints = [
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/asset-balances?at=450000',
JSON.stringify(accountAssetBalance450000),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import accountBalance1100000 from './1100000.json';
import accountBalance1300000 from './1300000.json';
import accountBalance1800000 from './1800000.json';

export const statemineAccountBalanceEndpoints = [
export const assetHubKusamaAccountBalanceEndpoints = [
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=450000',
JSON.stringify(accountBalance450000),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { statemineAccountsApprovalsEndpoints } from './asset-approvals';
import { statemineAccountAssetBalanceEndpoints } from './asset-balances';
import { statemineAccountBalanceEndpoints } from './balance-info';
import { assetHubKusamaAccountsApprovalsEndpoints } from './asset-approvals';
import { assetHubKusamaAccountAssetBalanceEndpoints } from './asset-balances';
import { assetHubKusamaAccountBalanceEndpoints } from './balance-info';

export const statemineAccountAssetEndpoints = [
...statemineAccountBalanceEndpoints,
...statemineAccountAssetBalanceEndpoints,
...statemineAccountsApprovalsEndpoints,
export const assetHubKusamaAccountAssetEndpoints = [
...assetHubKusamaAccountBalanceEndpoints,
...assetHubKusamaAccountAssetBalanceEndpoints,
...assetHubKusamaAccountsApprovalsEndpoints,
];
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import block1100000 from './1100000.json';
import block1300000 from './1300000.json';
import block1800000 from './1800000.json';

export const statemineBlockEndpoints = [
export const assetHubKusamaBlockEndpoints = [
['/blocks/450000', JSON.stringify(block450000)], // v2
['/blocks/650000', JSON.stringify(block650000)], // v3
['/blocks/960000', JSON.stringify(block960000)], // v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { statemineAccountAssetEndpoints } from './accounts';
import { statemineBlockEndpoints } from './blocks';
import { statemineRuntimeEndpoints } from './runtime';
import { assetHubKusamaAccountAssetEndpoints } from './accounts';
import { assetHubKusamaBlockEndpoints } from './blocks';
import { assetHubKusamaRuntimeEndpoints } from './runtime';

export const statemineEndpoints = {
accounts: statemineAccountAssetEndpoints,
blocks: statemineBlockEndpoints,
export const assetHubKusamaEndpoints = {
accounts: assetHubKusamaAccountAssetEndpoints,
blocks: assetHubKusamaBlockEndpoints,
paras: [],
runtime: statemineRuntimeEndpoints,
runtime: assetHubKusamaRuntimeEndpoints,
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

import runtimeSpec993450 from './993450.json';

export const statemineRuntimeEndpoints = [
export const assetHubKusamaRuntimeEndpoints = [
['/runtime/spec?at=993540', JSON.stringify(runtimeSpec993450)],
];
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

/**
* Currently there are no assets established within statemint
* Currently there are no assets established within Asset Hub Polkadot
* so these tests will be empty.
*/
export const statemintAccountsApprovalsEndpoints = [];
export const assetHubPolkadotAccountsApprovalsEndpoints = [];
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

/**
* Currently there are no assets established within statemint
* Currently there are no assets established within Asset Hub Polkadot
* so these tests will be empty.
*/
export const statemintAccountAssetBalanceEndpoints = [];
export const assetHubPolkadotAccountAssetBalanceEndpoints = [];
Loading

0 comments on commit db520cf

Please sign in to comment.