Skip to content

Commit

Permalink
Merge pull request #7 from interlay/sync-upstream
Browse files Browse the repository at this point in the history
Sync with upstream
  • Loading branch information
sander2 authored Jul 5, 2023
2 parents 71f6abf + 65c6e98 commit 6ff9369
Show file tree
Hide file tree
Showing 71 changed files with 3,711 additions and 3,426 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
env:
RUN_ALL_TESTS: ${{ github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,33 @@ jobs:
- run: yarn check
- run: yarn build-wasm
- run: yarn build

# Make sure chopsticks and executor version are the same
- run: node -e "assert(require('./packages/chopsticks/package.json').version === require('./executor/pkg/package.json').version, 'Chopsticks and executor version not the same. Please update Cargo.toml version')"

# Writes token to .yarnrc.yml. If written directly in .yarnrc.yml, it will cause an error
- run: |
echo npmAuthToken: "\${NPM_AUTH_TOKEN}" >> ./.yarnrc.yml
echo npmAuthToken: "\${NPM_AUTH_TOKEN}" >> ./.yarnrc.yml
- name: Publish @acala-network/chopsticks
run: yarn workspace @acala-network/chopsticks npm publish --tolerate-republish --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

# - name: Publish @acala-network/chopsticks-core
# run: yarn workspace @acala-network/chopsticks-core npm publish --tolerate-republish --access public
# env:
# NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Publish @acala-network/chopsticks-executor
run: yarn workspace @acala-network/chopsticks-executor npm publish --tolerate-republish --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Publish @acala-network/chopsticks-testing
run: yarn workspace @acala-network/chopsticks-testing npm publish --tolerate-republish --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- run: |
git checkout ./.yarnrc.yml
git checkout ./.yarnrc.yml
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"name": "Server",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/index.ts", "dev", "--endpoint=wss://acala-rpc-2.aca-api.network/ws"],
"args": ["${workspaceRoot}/packages/chopsticks/src/cli.ts", "--config=${workspaceRoot}/configs/polkadot.yml"],
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
Expand Down
4 changes: 2 additions & 2 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

801 changes: 0 additions & 801 deletions .yarn/releases/yarn-3.2.4.cjs

This file was deleted.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.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 @@ -16,4 +16,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.2.4.cjs
yarnPath: .yarn/releases/yarn-3.5.0.cjs
59 changes: 45 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,42 @@ Create parallel reality of your Substrate network.

## Quick Start

Fork Acala mainnet: `yarn dlx @acala-network/chopsticks dev --endpoint=wss://acala-rpc-2.aca-api.network/ws`
Fork Acala mainnet: `npx @acala-network/chopsticks@latest --endpoint=wss://acala-rpc-2.aca-api.network/ws`

It is recommended to use config file. You can check [configs](configs/) for examples.

You can run a test node with config with `yarn dlx @acala-network/chopsticks dev --config=<config_file_path>`
Run node using config file

```bash
# npx @acala-network/chopsticks@latest --config= url | path | config_file_name
# i.e: using configs/acala.yml

npx @acala-network/chopsticks@latest -c acala
```

### Example configs can be found here

- [acala](configs/acala.yml)
- [astar](configs/astar.yml)
- [basilisk](configs/basilisk.yml)
- [composable-polkadot](configs/composable-polkadot.yml)
- [hydradx](configs/hydradx.yml)
- [karura](configs/karura.yml)
- [kusama](configs/kusama.yml)
- [mandala-genesis](configs/mandala-genesis.yml)
- [mandala](configs/mandala.yml)
- [mangata](configs/mangata.yml)
- [moonbase-alpha](configs/moonbase-alpha.yml)
- [moonbeam](configs/moonbeam.yml)
- [moonriver](configs/moonriver.yml)
- [nodle-eden](configs/nodle-eden.yml)
- [picasso-kusama](configs/picasso-kusama.yml)
- [picasso-rococo](configs/picasso-rococo.yml)
- [polkadot](configs/polkadot.yml)
- [rococo](configs/rococo.yml)
- [shiden](configs/shiden.yml)
- [statemine](configs/statemine.yml)
- [statemint](configs/statemint.yml)

## Install

Expand All @@ -24,50 +55,50 @@ Make sure you have setup Rust environment (>= 1.64).
## Run

- Replay latest block
- `yarn start run-block --endpoint=wss://acala-rpc-2.aca-api.network/ws`
- `npx @acala-network/chopsticks@latest run-block --endpoint=wss://acala-rpc-2.aca-api.network/ws`
- This will replay the last block and print out the changed storages
- Use option `--block` to replay certain block hash
- Use option `-b|--block` to replay certain block hash
- Use option `--output-path=<file_path>` to print out JSON file
- Use option `--html` to generate storage diff preview (add `--open` to automatically open file)

## Dry-run

- Dry run hep:
```
yarn start dry-run --help
npx @acala-network/chopsticks@latest dry-run --help
```

- Dry run extrinsic, same as `run-block`, example:
```
yarn start dry-run --config=configs/mandala.yml --html --open --extrinsic=0x39028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01183abac17ff331f8b65dbeddd27f014dedd892020cfdc6c40b574f6930f8cf391bde95997ae2edc5b1192a4036ea97804956c4b5497175c8d68b630301685889450200000a00008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a480284d717
npx @acala-network/chopsticks@latest dry-run --config=configs/mandala.yml --html --open --extrinsic=0x39028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01183abac17ff331f8b65dbeddd27f014dedd892020cfdc6c40b574f6930f8cf391bde95997ae2edc5b1192a4036ea97804956c4b5497175c8d68b630301685889450200000a00008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a480284d717
```

- Dry run call, make sure `mock-signature-host: true` to fake caller's signature:
```
yarn start dry-run --config=configs/mandala.yml --html --open --extrinsic=0xff00000080969800 --address=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --at=<block_hash_optional>
npx @acala-network/chopsticks@latest dry-run --config=configs/mandala.yml --html --open --extrinsic=0xff00000080969800 --address=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --at=<block_hash_optional>
```

- Dry run a preimage:
```
yarn start dry-run --endpoint=wss://rpc.polkadot.io --preimage=<preimage> --open
npx @acala-network/chopsticks@latest dry-run --endpoint=wss://rpc.polkadot.io --preimage=<preimage> --open
```

- Dry run a preimage and execute an extrinsic after that:
```
yarn start dry-run --endpoint=wss://rpc.polkadot.io --preimage=<preimage> --extrinsic=<extrinsic> --open
npx @acala-network/chopsticks@latest dry-run --endpoint=wss://rpc.polkadot.io --preimage=<preimage> --extrinsic=<extrinsic> --open
```

- Dry run a preimage and execute a call after that, make sure `mock-signature-host: true` to fake caller's signature:
```
yarn start dry-run --config=configs/mandala.yml --preimage=<preimage> --extrinsic=<call> --address=<who> --open
npx @acala-network/chopsticks@latest dry-run --config=configs/mandala.yml --preimage=<preimage> --extrinsic=<call> --address=<who> --open
```

- Run a test node
- `yarn start dev --endpoint=wss://acala-rpc-2.aca-api.network/ws`
- `npx @acala-network/chopsticks@latest --endpoint=wss://acala-rpc-2.aca-api.network/ws`
- You have a test node running at `ws://localhost:8000`
- You can use [Polkadot.js Apps](https://polkadot.js.org/apps/) to connect to this node
- Submit any transaction to produce a new block in the in parallel reality
- (Optional) Pre-define/override storage using option `--import-storage=storage.[json/yaml]`. See example storage below.
- (Optional) Pre-define/override storage using option `-s|--import-storage=storage.[json/yaml]`. See example storage below.

```json5
{
Expand All @@ -92,13 +123,13 @@ yarn start dry-run --config=configs/mandala.yml --preimage=<preimage> --extrinsi

- Run Kusama fork
- Edit configs/kusama.yml if needed. (e.g. update the block number)
- `yarn start dev --config=configs/kusama.yml`
- `npx @acala-network/chopsticks@latest --config=configs/kusama.yml`

- Setup XCM multichain
**_NOTE:_** You can also connect multiple parachains without a relaychain

```bash
yarn start xcm --relaychain=configs/kusama.yml --parachain=configs/karura.yml --parachain=configs/statemine.yml
npx @acala-network/chopsticks@latest xcm -r kusama -p karura -p statemine
```

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion configs/acala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ endpoint: wss://acala-rpc.dwellir.com
mock-signature-host: true
block: ${env.ACALA_BLOCK_NUMBER}
db: ./db.sqlite
# wasm-override: acala-2101.wasm
# wasm-override: acala-2150.wasm

import-storage:
Sudo:
Expand Down
17 changes: 17 additions & 0 deletions configs/composable-polkadot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
endpoint: wss://rpc.composable.finance
mock-signature-host: true
block: ${env.COMPOSABLE_BLOCK_NUMBER}
db: ./composable.polkadot.db.sqlite
# wasm-override: ../../ComposableFi/composable/result/lib/runtime.optimized.wasm

import-storage:
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: "100000000000000000000000"
15 changes: 15 additions & 0 deletions configs/imbu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
endpoint: wss://imbue-kusama.imbue.network
mock-signature-host: true
block: ${env.IMBUE_BLOCK_NUMBER}
db: ./db.sqlite

import-storage:
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- data:
free: 1000000000000000
90 changes: 0 additions & 90 deletions configs/kusama.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,93 +14,3 @@ import-storage:
- providers: 1
data:
free: '10000000000000000000'
ParasDisputes:
$removePrefix:
- Disputes
FellowshipCollective:
$removePrefix:
- IdToIndex
- IndexToId
- MemberCount
- Members
IdToIndex:
- [[0, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[1, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[2, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[3, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[4, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[5, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[6, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
- [[7, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], 0]
IndexToId:
- [[0, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[1, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[2, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[3, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[4, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[5, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[6, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
- [[7, 0], 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
MemberCount:
- [[0], 1]
- [[1], 1]
- [[2], 1]
- [[3], 1]
- [[4], 1]
- [[5], 1]
- [[6], 1]
- [[7], 1]
Members:
- [[5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], rank: 7]
Voting: []
# Configuration:
# ActiveConfig: {
# "maxCodeSize": 10485760,
# "maxHeadDataSize": 20480,
# "maxUpwardQueueCount": 10,
# "maxUpwardQueueSize": 51200,
# "maxUpwardMessageSize": 51200,
# "maxUpwardMessageNumPerCandidate": 10,
# "hrmpMaxMessageNumPerCandidate": 10,
# "validationUpgradeCooldown": 3600,
# "validationUpgradeDelay": 600,
# "maxPovSize": 5242880,
# "maxDownwardMessageSize": 51200,
# "umpServiceTotalWeight": {
# "refTime": 100000000000,
# "proofSize": 5242880
# },
# "hrmpMaxParachainOutboundChannels": 30,
# "hrmpMaxParathreadOutboundChannels": 0,
# "hrmpSenderDeposit": 5000000000000,
# "hrmpRecipientDeposit": 5000000000000,
# "hrmpChannelMaxCapacity": 1000,
# "hrmpChannelMaxTotalSize": 102400,
# "hrmpMaxParachainInboundChannels": 30,
# "hrmpMaxParathreadInboundChannels": 0,
# "hrmpChannelMaxMessageSize": 102400,
# "codeRetentionPeriod": 28800,
# "parathreadCores": 0,
# "parathreadRetries": 0,
# "groupRotationFrequency": 10,
# "chainAvailabilityPeriod": 10,
# "threadAvailabilityPeriod": 10,
# "schedulingLookahead": 1,
# "maxValidatorsPerCore": 5,
# "maxValidators": 200,
# "disputePeriod": 6,
# "disputePostConclusionAcceptancePeriod": 600,
# "disputeConclusionByTimeOutPeriod": 600,
# "noShowSlots": 2,
# "nDelayTranches": 89,
# "zerothDelayTrancheWidth": 0,
# "neededApprovals": 30,
# "relayVrfModuloSamples": 40,
# "umpMaxIndividualWeight": {
# "refTime": 50000000000,
# "proofSize": 5242880
# },
# "pvfCheckingEnabled": true,
# "pvfVotingTtl": 2,
# "minimumValidationUpgradeDelay": 20
# }
2 changes: 1 addition & 1 deletion configs/mandala.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
endpoint: wss://mandala-rpc.aca-staging.network/ws
endpoint: wss://mandala-tc9-rpc.aca-staging.network
mock-signature-host: true
block: ${env.MANDALA_BLOCK_NUMBER}
db: ./db.sqlite
Expand Down
Loading

0 comments on commit 6ff9369

Please sign in to comment.