Browse Source

Merge branch 'antioch' into antioch-params-update

Mokhtar Naamani 3 years ago
parent
commit
8099239132
42 changed files with 811 additions and 424 deletions
  1. 1 21
      .env
  2. 45 45
      Cargo.lock
  3. 1 1
      README.md
  4. 1 1
      devops/git-hooks/pre-push
  5. 5 9
      docker-compose.yml
  6. 5 5
      joystream-node.Dockerfile
  7. 2 2
      node/README.md
  8. 2 2
      package.json
  9. 8 8
      query-node/build.sh
  10. 4 2
      query-node/db-migrate.sh
  11. 45 0
      query-node/manifest.yml
  12. 1 1
      query-node/mappings/content-directory/decode.ts
  13. 1 1
      query-node/mappings/content-directory/default-schemas.ts
  14. 1 1
      query-node/mappings/content-directory/entity/addSchema.ts
  15. 1 1
      query-node/mappings/content-directory/entity/create.ts
  16. 2 1
      query-node/mappings/content-directory/entity/index.ts
  17. 2 1
      query-node/mappings/content-directory/entity/remove.ts
  18. 2 1
      query-node/mappings/content-directory/entity/update.ts
  19. 1 1
      query-node/mappings/content-directory/get-or-create.ts
  20. 8 0
      query-node/mappings/content-directory/mapping.ts
  21. 3 2
      query-node/mappings/content-directory/transaction.ts
  22. 264 0
      query-node/mappings/generated-t/types/content-directory.ts
  23. 12 0
      query-node/mappings/generated-t/types/index.ts
  24. 21 0
      query-node/mappings/package.json
  25. 7 7
      query-node/mappings/tsconfig.json
  26. 1 1
      query-node/mappings/types.ts
  27. 7 6
      query-node/package.json
  28. 2 8
      query-node/processor-start.sh
  29. 0 3
      query-node/run-tests.sh
  30. 2 2
      query-node/scripts/initializeDefaultSchemas.ts
  31. 11 1
      runtime-modules/content-directory/src/operations.rs
  32. 5 9
      runtime-modules/content-directory/src/schema/input.rs
  33. 3 7
      runtime-modules/content-directory/src/schema/output.rs
  34. 6 13
      runtime-modules/hiring/src/lib.rs
  35. 4 6
      runtime-modules/working-group/src/lib.rs
  36. 1 1
      scripts/cargo-build.sh
  37. 7 0
      scripts/cargo-tests-with-networking.sh
  38. 1 1
      scripts/raspberry-cross-build.sh
  39. 1 1
      scripts/run-dev-chain.sh
  40. 3 4
      setup.sh
  41. 1 1
      storage-node/packages/cli/src/commands/dev.ts
  42. 311 247
      yarn.lock

+ 1 - 21
.env

@@ -3,7 +3,7 @@ PROJECT_NAME=query_node
 
 # We will use a single postgres service with multiple databases
 INDEXER_DB_NAME=query_node_indexer
-PROCESSOR_DB_NAME=query_node_processor
+DB_NAME=query_node_processor
 DB_USER=postgres
 DB_PASS=postgres
 DB_HOST=localhost
@@ -16,30 +16,10 @@ TYPEORM_LOGGING=error
 #    Indexer options      #
 ###########################
 
-# Substrate endpoint to source events from
-WS_PROVIDER_ENDPOINT_URI=ws://localhost:9944/
-
 # Block height to start indexing from.
 # Note, that if there are already some indexed events, this setting is ignored
 BLOCK_HEIGHT=0
 
-# Redis cache server
-REDIS_URI=redis://localhost:6379/0
-
-###########################
-#    Processor options    #
-###########################
-
-# Where the mapping scripts are located, relative to ./generated/indexer
-TYPES_JSON=../../../types/augment/all/defs.json
-
-# Indexer GraphQL API endpoint to fetch indexed events
-INDEXER_ENDPOINT_URL=http://localhost:4000/graphql
-
-# Block height from which the processor starts. Note that if
-# there are already processed events in the database, this setting is ignored
-BLOCK_HEIGHT=0
-
 ###############################
 #    Processor GraphQL API    #
 ###############################

+ 45 - 45
Cargo.lock

@@ -950,7 +950,7 @@ dependencies = [
  "cfg-if 1.0.0",
  "crossbeam-utils 0.8.3",
  "lazy_static",
- "memoffset 0.6.2",
+ "memoffset 0.6.3",
  "scopeguard 1.1.0",
 ]
 
@@ -1668,7 +1668,7 @@ dependencies = [
  "lazy_static",
  "log",
  "parking_lot 0.9.0",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "serde",
  "serde_json",
 ]
@@ -1788,7 +1788,7 @@ dependencies = [
  "bytes 0.5.6",
  "futures 0.3.13",
  "memchr",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
 ]
 
 [[package]]
@@ -2463,9 +2463,9 @@ dependencies = [
 
 [[package]]
 name = "js-sys"
-version = "0.3.49"
+version = "0.3.50"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821"
+checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c"
 dependencies = [
  "wasm-bindgen",
 ]
@@ -2687,9 +2687,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
 
 [[package]]
 name = "libc"
-version = "0.2.91"
+version = "0.2.92"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7"
+checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714"
 
 [[package]]
 name = "libloading"
@@ -2741,7 +2741,7 @@ dependencies = [
  "multihash",
  "parity-multiaddr",
  "parking_lot 0.10.2",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "smallvec 1.6.1",
  "wasm-timer",
 ]
@@ -2766,7 +2766,7 @@ dependencies = [
  "multistream-select",
  "parity-multiaddr",
  "parking_lot 0.10.2",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "prost",
  "prost-build",
  "rand 0.7.3",
@@ -2999,7 +2999,7 @@ checksum = "96b3c2d5d26a9500e959a0e19743897239a6c4be78dadf99b70414301a70c006"
 dependencies = [
  "futures 0.3.13",
  "log",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "rand 0.7.3",
  "salsa20",
  "sha3",
@@ -3201,9 +3201,9 @@ dependencies = [
 
 [[package]]
 name = "lock_api"
-version = "0.4.2"
+version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
+checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176"
 dependencies = [
  "scopeguard 1.1.0",
 ]
@@ -3299,9 +3299,9 @@ dependencies = [
 
 [[package]]
 name = "memoffset"
-version = "0.6.2"
+version = "0.6.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38"
+checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d"
 dependencies = [
  "autocfg 1.0.1",
 ]
@@ -4615,7 +4615,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
 dependencies = [
  "instant",
- "lock_api 0.4.2",
+ "lock_api 0.4.3",
  "parking_lot_core 0.8.3",
 ]
 
@@ -4741,11 +4741,11 @@ dependencies = [
 
 [[package]]
 name = "pin-project"
-version = "0.4.27"
+version = "0.4.28"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15"
+checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f"
 dependencies = [
- "pin-project-internal 0.4.27",
+ "pin-project-internal 0.4.28",
 ]
 
 [[package]]
@@ -4759,9 +4759,9 @@ dependencies = [
 
 [[package]]
 name = "pin-project-internal"
-version = "0.4.27"
+version = "0.4.28"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895"
+checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -4937,9 +4937,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.24"
+version = "1.0.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
+checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
 dependencies = [
  "unicode-xid",
 ]
@@ -5509,7 +5509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"
 dependencies = [
  "futures 0.3.13",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "static_assertions",
 ]
 
@@ -5950,7 +5950,7 @@ dependencies = [
  "log",
  "parity-scale-codec",
  "parking_lot 0.10.2",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "rand 0.7.3",
  "sc-block-builder",
  "sc-client-api",
@@ -6079,7 +6079,7 @@ dependencies = [
  "nohash-hasher",
  "parity-scale-codec",
  "parking_lot 0.10.2",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "prost",
  "prost-build",
  "rand 0.7.3",
@@ -6262,7 +6262,7 @@ dependencies = [
  "parity-scale-codec",
  "parity-util-mem",
  "parking_lot 0.10.2",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "rand 0.7.3",
  "sc-block-builder",
  "sc-chain-spec",
@@ -6366,7 +6366,7 @@ dependencies = [
  "libp2p",
  "log",
  "parking_lot 0.10.2",
- "pin-project 0.4.27",
+ "pin-project 0.4.28",
  "rand 0.7.3",
  "serde",
  "slog",
@@ -6673,9 +6673,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
 
 [[package]]
 name = "signal-hook"
-version = "0.3.7"
+version = "0.3.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6aa894ef3fade0ee7243422f4fbbd6c2b48e6de767e621d37ef65f2310f53cea"
+checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac"
 dependencies = [
  "libc",
  "signal-hook-registry",
@@ -7737,9 +7737,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2"
 
 [[package]]
 name = "syn"
-version = "1.0.65"
+version = "1.0.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663"
+checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -8520,9 +8520,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
 
 [[package]]
 name = "wasm-bindgen"
-version = "0.2.72"
+version = "0.2.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe"
+checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9"
 dependencies = [
  "cfg-if 1.0.0",
  "wasm-bindgen-macro",
@@ -8530,9 +8530,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-backend"
-version = "0.2.72"
+version = "0.2.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3"
+checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae"
 dependencies = [
  "bumpalo",
  "lazy_static",
@@ -8545,9 +8545,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-futures"
-version = "0.4.22"
+version = "0.4.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468"
+checksum = "81b8b767af23de6ac18bf2168b690bed2902743ddf0fb39252e36f9e2bfc63ea"
 dependencies = [
  "cfg-if 1.0.0",
  "js-sys",
@@ -8557,9 +8557,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-macro"
-version = "0.2.72"
+version = "0.2.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
+checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f"
 dependencies = [
  "quote",
  "wasm-bindgen-macro-support",
@@ -8567,9 +8567,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-macro-support"
-version = "0.2.72"
+version = "0.2.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
+checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -8580,9 +8580,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-shared"
-version = "0.2.72"
+version = "0.2.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa"
+checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489"
 
 [[package]]
 name = "wasm-timer"
@@ -8624,9 +8624,9 @@ dependencies = [
 
 [[package]]
 name = "web-sys"
-version = "0.3.49"
+version = "0.3.50"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310"
+checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be"
 dependencies = [
  "js-sys",
  "wasm-bindgen",

+ 1 - 1
README.md

@@ -89,7 +89,7 @@ You can also run your our own joystream-node:
 
 ```sh
 git checkout master
-WASM_BUILD_TOOLCHAIN=nightly-2021-02-20 cargo build --release
+WASM_BUILD_TOOLCHAIN=nightly-2021-03-24 cargo build --release
 ./target/release/joystream-node -- --pruning archive --chain testnets/joy-testnet-4.json
 ```
 

+ 1 - 1
devops/git-hooks/pre-push

@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 
-export WASM_BUILD_TOOLCHAIN=nightly-2021-02-20
+export WASM_BUILD_TOOLCHAIN=nightly-2021-03-24
 
 echo 'running clippy (rust linter)'
 # When custom build.rs triggers wasm-build-runner-impl to build we get error:

+ 5 - 9
docker-compose.yml

@@ -74,7 +74,7 @@ services:
       - .env
     environment:
       - DB_HOST=db
-      - DB_NAME=${PROCESSOR_DB_NAME}
+      - DB_NAME=${DB_NAME}
     ports:
       - "127.0.0.1:8081:${GRAPHQL_SERVER_PORT}"
     depends_on: 
@@ -91,11 +91,10 @@ services:
       # relative to working directory where docker-compose was run from
       - .env
     environment:
-      - INDEXER_ENDPOINT_URL=http://indexer-api-gateway:${WARTHOG_APP_PORT}/graphql
-      - TYPEORM_HOST=db
-      - TYPEORM_DATABASE=${PROCESSOR_DB_NAME}
-      - DEBUG=index-builder:*
-      - WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944
+      - POLL_INTERVAL_MS=300
+      - DEBUG=hydra-processor:*
+      - DB_HOST=db
+      - INDEXER_ENDPOINT_URL=http://indexer-api-gateway:4002/graphql
     depends_on:
       - indexer-api-gateway
     command: ["workspace", "query-node-root", "processor:start"]
@@ -107,10 +106,7 @@ services:
       # relative to working directory where docker-compose was run from
       - .env
     environment:
-      - TYPEORM_HOST=db
-      - TYPEORM_DATABASE=${INDEXER_DB_NAME}
       - INDEXER_WORKERS=5
-      - PROCESSOR_POLL_INTERVAL=1000 # refresh every second
       - REDIS_URI=redis://redis:6379/0
       - DEBUG=index-builder:*
       - WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944

+ 5 - 5
joystream-node.Dockerfile

@@ -1,7 +1,7 @@
-FROM liuchong/rustup:1.51.0 AS rustup
-RUN rustup component add rustfmt clippy
-RUN rustup install nightly-2021-02-20 --force
-RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2021-02-20
+FROM liuchong/rustup:nightly AS rustup
+RUN rustup install nightly-2021-03-24
+RUN rustup default nightly-2021-03-24
+RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2021-03-24
 RUN apt-get update && \
   apt-get install -y curl git gcc xz-utils sudo pkg-config unzip clang llvm libc6-dev
 
@@ -12,7 +12,7 @@ COPY . /joystream
 
 # Build all cargo crates
 # Ensure our tests and linter pass before actual build
-ENV WASM_BUILD_TOOLCHAIN=nightly-2021-02-20
+ENV WASM_BUILD_TOOLCHAIN=nightly-2021-03-24
 RUN BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings && \
     cargo test --release --all && \
     cargo build --release

+ 2 - 2
node/README.md

@@ -26,7 +26,7 @@ cd joystream/
 Compile the node and runtime:
 
 ```bash
-WASM_BUILD_TOOLCHAIN=nightly-2021-02-20 cargo build --release
+WASM_BUILD_TOOLCHAIN=nightly-2021-03-24 cargo build --release
 ```
 
 This produces the binary in `./target/release/joystream-node`
@@ -79,7 +79,7 @@ If you are building a tagged release from `master` branch and want to install th
 This will install the executable `joystream-node` to your `~/.cargo/bin` folder, which you would normally have in your `$PATH` environment.
 
 ```bash
-WASM_BUILD_TOOLCHAIN=nightly-2021-02-20 cargo install joystream-node --path node/ --locked
+WASM_BUILD_TOOLCHAIN=nightly-2021-03-24 cargo install joystream-node --path node/ --locked
 ```
 
 Now you can run and connect to the testnet:

+ 2 - 2
package.json

@@ -38,8 +38,8 @@
     "babel-core": "^7.0.0-bridge.0",
     "typescript": "^3.9.7",
     "bn.js": "^5.1.2",
-    "@dzlzv/hydra-indexer-lib": "0.0.22-legacy.1.26.1",
-    "rxjs": "^6.6.2"
+    "rxjs": "^6.6.2",
+    "typeorm": "^0.2.31"
   },
   "devDependencies": {
     "eslint": "^7.6.0",

+ 8 - 8
query-node/build.sh

@@ -11,19 +11,19 @@ set +a
 
 yarn clean
 
-# We generate the code for each service separately to be able to specify
-# separate database names.
+# Build graphql-server customizing DB name
+yarn codegen
+# yarn typegen
 
-# Build indexer customizing DB name
-DB_NAME=${INDEXER_DB_NAME} yarn codegen:indexer
+echo "Building mappings..."
+(cd mappings && yarn build)
+echo "Done."
 
-# Build graphql-server customizing DB name
-DB_NAME=${PROCESSOR_DB_NAME} yarn codegen:server
+# Copy joy types
+cp ../types/augment/all/defs.json ./mappings/lib/mappings/generated-t/types/typedefs.json
 
 # We run yarn again to ensure processor and indexer dependencies are installed
 # and are inline with root workspace resolutions
 yarn
 
 ln -s ../../../../../node_modules/typeorm/cli.js generated/graphql-server/node_modules/.bin/typeorm || :
-
-yarn tsc --build tsconfig.json

+ 4 - 2
query-node/db-migrate.sh

@@ -8,6 +8,8 @@ set -a
 . ../.env
 set +a
 
-yarn workspace query-node-root db:indexer:migrate
 yarn workspace query-node-root db:schema:migrate
-TYPEORM_DATABASE=${PROCESSOR_DB_NAME} yarn workspace query-node-root db:indexer:migrate
+
+yarn hydra-processor migrate --env=../.env
+
+yarn workspace query-node-root db:init

+ 45 - 0
query-node/manifest.yml

@@ -0,0 +1,45 @@
+version: '0.1'
+description: Joystream query-node manifest file for antioch
+repository: https://github.com/Joystream/joystream
+hydraVersion: '2'
+dataSource:
+  indexerVersion: '3.9'
+  kind: substrate
+  chain: joystream
+entities:
+  - mappings/lib/generated/**/*.model.js
+typegen:
+  metadata:
+    source: ws://localhost:9944
+  events:
+    - contentDirectory.EntityCreated
+    - contentDirectory.EntityRemoved
+    - contentDirectory.EntitySchemaSupportAdded
+    - contentDirectory.EntityPropertyValuesUpdated
+    - contentDirectory.TransactionCompleted
+    - contentDirectory.TransactionFailed
+  outDir: ./mappings/generated-t/types
+  customTypes:
+    lib: '@joystream/types/augment/all/types'
+    typedefsLoc: '../types/augment/all/defs.json'
+mappings:
+  hydraCommonVersion: '2.0.1-beta.0'
+  # js module that exports the handler functions
+  mappingsModule: mappings/lib/mappings
+  # additinal libraries the processor loads
+  # typically it is a module with event and extrinsic types generated by hydra-typegen
+  imports:
+    - mappings/lib/mappings/generated-t/types
+  eventHandlers:
+    - event: contentDirectory.EntityCreated
+      handler: contentDirectory_EntityCreated(DatabaseManager, SubstrateEvent)
+    - event: contentDirectory.EntityRemoved
+      handler: contentDirectory_EntityRemoved(DatabaseManager, SubstrateEvent)
+    - event: contentDirectory.EntitySchemaSupportAdded
+      handler: contentDirectory_EntitySchemaSupportAdded(DatabaseManager, SubstrateEvent)
+    - event: contentDirectory.EntityPropertyValuesUpdated
+      handler: contentDirectory_EntityPropertyValuesUpdated(DatabaseManager, SubstrateEvent)
+    - event: contentDirectory.TransactionCompleted
+      handler: contentDirectory_TransactionCompleted(DatabaseManager, SubstrateEvent)
+    - event: contentDirectory.TransactionFailed
+      handler: contentDirectory_TransactionFailed(DatabaseManager, SubstrateEvent)

+ 1 - 1
query-node/mappings/content-directory/decode.ts

@@ -1,4 +1,4 @@
-import { SubstrateEvent } from '../../generated/indexer'
+import { SubstrateEvent } from '@dzlzv/hydra-common'
 import {
   IClassEntity,
   IProperty,

+ 1 - 1
query-node/mappings/content-directory/default-schemas.ts

@@ -1,7 +1,7 @@
 import Debug from 'debug'
 import { nanoid } from 'nanoid'
 
-import { DB } from '../../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 import { Channel } from '../../generated/graphql-server/src/modules/channel/channel.model'
 import { Language } from '../../generated/graphql-server/src/modules/language/language.model'
 import { ClassEntity } from '../../generated/graphql-server/src/modules/class-entity/class-entity.model'

+ 1 - 1
query-node/mappings/content-directory/entity/addSchema.ts

@@ -1,4 +1,4 @@
-import { DB } from '../../../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 import { Channel } from '../../../generated/graphql-server/src/modules/channel/channel.model'
 import { Category } from '../../../generated/graphql-server/src/modules/category/category.model'
 import { KnownLicenseEntity } from '../../../generated/graphql-server/src/modules/known-license-entity/known-license-entity.model'

+ 1 - 1
query-node/mappings/content-directory/entity/create.ts

@@ -1,4 +1,4 @@
-import { DB } from '../../../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 import { Channel } from '../../../generated/graphql-server/src/modules/channel/channel.model'
 import { Category } from '../../../generated/graphql-server/src/modules/category/category.model'
 import { KnownLicenseEntity } from '../../../generated/graphql-server/src/modules/known-license-entity/known-license-entity.model'

+ 2 - 1
query-node/mappings/content-directory/entity/index.ts

@@ -1,5 +1,6 @@
 import Debug from 'debug'
-import { DB, SubstrateEvent } from '../../../generated/indexer'
+import { SubstrateEvent } from '@dzlzv/hydra-common'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 import { ClassEntity } from '../../../generated/graphql-server/src/modules/class-entity/class-entity.model'
 
 import { decode } from '../decode'

+ 2 - 1
query-node/mappings/content-directory/entity/remove.ts

@@ -1,7 +1,8 @@
 import assert from 'assert'
 import Debug from 'debug'
 
-import { DB } from '../../../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
+
 import { Channel } from '../../../generated/graphql-server/src/modules/channel/channel.model'
 import { Category } from '../../../generated/graphql-server/src/modules/category/category.model'
 import { KnownLicenseEntity } from '../../../generated/graphql-server/src/modules/known-license-entity/known-license-entity.model'

+ 2 - 1
query-node/mappings/content-directory/entity/update.ts

@@ -1,4 +1,5 @@
-import { DB } from '../../../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
+
 import { Channel } from '../../../generated/graphql-server/src/modules/channel/channel.model'
 import { Category } from '../../../generated/graphql-server/src/modules/category/category.model'
 import { KnownLicenseEntity } from '../../../generated/graphql-server/src/modules/known-license-entity/known-license-entity.model'

+ 1 - 1
query-node/mappings/content-directory/get-or-create.ts

@@ -64,7 +64,7 @@ import {
   createVideo,
 } from './entity/create'
 
-import { DB } from '../../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 
 // Keep track of the next entity id
 async function nextEntityId(db: DB): Promise<NextEntityId> {

+ 8 - 0
query-node/mappings/content-directory/mapping.ts

@@ -1,3 +1,6 @@
+import { DatabaseManager } from '@dzlzv/hydra-db-utils'
+import { SubstrateEvent } from '@dzlzv/hydra-common'
+
 export {
   contentDirectory_EntitySchemaSupportAdded,
   contentDirectory_EntityRemoved,
@@ -8,3 +11,8 @@ export { contentDirectory_TransactionCompleted, contentDirectory_TransactionFail
 
 // Only one time to seed the database
 // export { system_ExtrinsicSuccess } from './initializeDefaultSchemas'
+
+// eslint-disable-next-line @typescript-eslint/naming-convention
+export function system_ExtrinsicSuccess(db: DatabaseManager, event: SubstrateEvent): void {
+  return
+}

+ 3 - 2
query-node/mappings/content-directory/transaction.ts

@@ -1,6 +1,7 @@
 import Debug from 'debug'
 
-import { DB, SubstrateEvent } from '../../generated/indexer'
+import { SubstrateEvent } from '@dzlzv/hydra-common'
+import { DatabaseManager, DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 import { NextEntityId } from '../../generated/graphql-server/src/modules/next-entity-id/next-entity-id.model'
 import { ClassEntity } from '../../generated/graphql-server/src/modules/class-entity/class-entity.model'
 
@@ -73,7 +74,7 @@ async function getNextEntityId(db: DB): Promise<number> {
 }
 
 // eslint-disable-next-line @typescript-eslint/naming-convention
-export async function contentDirectory_TransactionFailed(db: DB, event: SubstrateEvent): Promise<void> {
+export async function contentDirectory_TransactionFailed(db: DatabaseManager, event: SubstrateEvent): Promise<void> {
   debug(`TransactionFailed event: ${JSON.stringify(event)}`)
 
   const failedOperationIndex = event.params[1].value as number

+ 264 - 0
query-node/mappings/generated-t/types/content-directory.ts

@@ -0,0 +1,264 @@
+import { createTypeUnsafe } from "@polkadot/types/create";
+import { SubstrateEvent, SubstrateExtrinsic } from "@dzlzv/hydra-common";
+import { Codec } from "@polkadot/types/types";
+import { typeRegistry } from ".";
+
+import {
+  Actor,
+  EntityId,
+  FailedAt,
+  SchemaId,
+  SideEffects
+} from "@joystream/types/augment/all/types";
+
+export namespace ContentDirectory {
+  export class EntityCreatedEvent {
+    public readonly expectedParamTypes = ["Actor", "EntityId"];
+
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get data(): EntityCreated_Params {
+      return new EntityCreated_Params(this.ctx);
+    }
+
+    validateParams(): boolean {
+      if (this.expectedParamTypes.length !== this.ctx.params.length) {
+        return false;
+      }
+      let valid = true;
+      this.expectedParamTypes.forEach((type, i) => {
+        if (type !== this.ctx.params[i].type) {
+          valid = false;
+        }
+      });
+      return valid;
+    }
+  }
+
+  class EntityCreated_Params {
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get actor(): Actor {
+      return createTypeUnsafe<Actor & Codec>(typeRegistry, "Actor", [
+        this.ctx.params[0].value
+      ]);
+    }
+
+    get entityId(): EntityId {
+      return createTypeUnsafe<EntityId & Codec>(typeRegistry, "EntityId", [
+        this.ctx.params[1].value
+      ]);
+    }
+  }
+  export class EntityRemovedEvent {
+    public readonly expectedParamTypes = ["Actor", "EntityId"];
+
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get data(): EntityRemoved_Params {
+      return new EntityRemoved_Params(this.ctx);
+    }
+
+    validateParams(): boolean {
+      if (this.expectedParamTypes.length !== this.ctx.params.length) {
+        return false;
+      }
+      let valid = true;
+      this.expectedParamTypes.forEach((type, i) => {
+        if (type !== this.ctx.params[i].type) {
+          valid = false;
+        }
+      });
+      return valid;
+    }
+  }
+
+  class EntityRemoved_Params {
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get actor(): Actor {
+      return createTypeUnsafe<Actor & Codec>(typeRegistry, "Actor", [
+        this.ctx.params[0].value
+      ]);
+    }
+
+    get entityId(): EntityId {
+      return createTypeUnsafe<EntityId & Codec>(typeRegistry, "EntityId", [
+        this.ctx.params[1].value
+      ]);
+    }
+  }
+  export class EntitySchemaSupportAddedEvent {
+    public readonly expectedParamTypes = [
+      "Actor",
+      "EntityId",
+      "SchemaId",
+      "SideEffects"
+    ];
+
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get data(): EntitySchemaSupportAdded_Params {
+      return new EntitySchemaSupportAdded_Params(this.ctx);
+    }
+
+    validateParams(): boolean {
+      if (this.expectedParamTypes.length !== this.ctx.params.length) {
+        return false;
+      }
+      let valid = true;
+      this.expectedParamTypes.forEach((type, i) => {
+        if (type !== this.ctx.params[i].type) {
+          valid = false;
+        }
+      });
+      return valid;
+    }
+  }
+
+  class EntitySchemaSupportAdded_Params {
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get actor(): Actor {
+      return createTypeUnsafe<Actor & Codec>(typeRegistry, "Actor", [
+        this.ctx.params[0].value
+      ]);
+    }
+
+    get entityId(): EntityId {
+      return createTypeUnsafe<EntityId & Codec>(typeRegistry, "EntityId", [
+        this.ctx.params[1].value
+      ]);
+    }
+
+    get schemaId(): SchemaId {
+      return createTypeUnsafe<SchemaId & Codec>(typeRegistry, "SchemaId", [
+        this.ctx.params[2].value
+      ]);
+    }
+
+    get sideEffects(): SideEffects {
+      return createTypeUnsafe<SideEffects & Codec>(
+        typeRegistry,
+        "SideEffects",
+        [this.ctx.params[3].value]
+      );
+    }
+  }
+  export class EntityPropertyValuesUpdatedEvent {
+    public readonly expectedParamTypes = ["Actor", "EntityId", "SideEffects"];
+
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get data(): EntityPropertyValuesUpdated_Params {
+      return new EntityPropertyValuesUpdated_Params(this.ctx);
+    }
+
+    validateParams(): boolean {
+      if (this.expectedParamTypes.length !== this.ctx.params.length) {
+        return false;
+      }
+      let valid = true;
+      this.expectedParamTypes.forEach((type, i) => {
+        if (type !== this.ctx.params[i].type) {
+          valid = false;
+        }
+      });
+      return valid;
+    }
+  }
+
+  class EntityPropertyValuesUpdated_Params {
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get actor(): Actor {
+      return createTypeUnsafe<Actor & Codec>(typeRegistry, "Actor", [
+        this.ctx.params[0].value
+      ]);
+    }
+
+    get entityId(): EntityId {
+      return createTypeUnsafe<EntityId & Codec>(typeRegistry, "EntityId", [
+        this.ctx.params[1].value
+      ]);
+    }
+
+    get sideEffects(): SideEffects {
+      return createTypeUnsafe<SideEffects & Codec>(
+        typeRegistry,
+        "SideEffects",
+        [this.ctx.params[2].value]
+      );
+    }
+  }
+  export class TransactionCompletedEvent {
+    public readonly expectedParamTypes = ["Actor"];
+
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get data(): TransactionCompleted_Params {
+      return new TransactionCompleted_Params(this.ctx);
+    }
+
+    validateParams(): boolean {
+      if (this.expectedParamTypes.length !== this.ctx.params.length) {
+        return false;
+      }
+      let valid = true;
+      this.expectedParamTypes.forEach((type, i) => {
+        if (type !== this.ctx.params[i].type) {
+          valid = false;
+        }
+      });
+      return valid;
+    }
+  }
+
+  class TransactionCompleted_Params {
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get actor(): Actor {
+      return createTypeUnsafe<Actor & Codec>(typeRegistry, "Actor", [
+        this.ctx.params[0].value
+      ]);
+    }
+  }
+  export class TransactionFailedEvent {
+    public readonly expectedParamTypes = ["Actor", "FailedAt"];
+
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get data(): TransactionFailed_Params {
+      return new TransactionFailed_Params(this.ctx);
+    }
+
+    validateParams(): boolean {
+      if (this.expectedParamTypes.length !== this.ctx.params.length) {
+        return false;
+      }
+      let valid = true;
+      this.expectedParamTypes.forEach((type, i) => {
+        if (type !== this.ctx.params[i].type) {
+          valid = false;
+        }
+      });
+      return valid;
+    }
+  }
+
+  class TransactionFailed_Params {
+    constructor(public readonly ctx: SubstrateEvent) {}
+
+    get actor(): Actor {
+      return createTypeUnsafe<Actor & Codec>(typeRegistry, "Actor", [
+        this.ctx.params[0].value
+      ]);
+    }
+
+    get failedAt(): FailedAt {
+      return createTypeUnsafe<FailedAt & Codec>(typeRegistry, "FailedAt", [
+        this.ctx.params[1].value
+      ]);
+    }
+  }
+}

+ 12 - 0
query-node/mappings/generated-t/types/index.ts

@@ -0,0 +1,12 @@
+import { TypeRegistry } from "@polkadot/types";
+import path from "path";
+import fs from "fs";
+const typeRegistry = new TypeRegistry();
+
+typeRegistry.register(
+  JSON.parse(fs.readFileSync(path.join(__dirname, "typedefs.json"), "utf-8"))
+);
+
+export { typeRegistry };
+
+export * from "./content-directory";

+ 21 - 0
query-node/mappings/package.json

@@ -0,0 +1,21 @@
+{
+  "name": "query-node-mappings",
+  "version": "0.0.1",
+  "description": "Mappings for hydra-processor",
+  "main": "lib/mappings/index.js",
+  "license": "MIT",
+  "scripts": {
+    "build": "rm -rf lib && tsc --build tsconfig.json",
+    "lint": "echo \"Skippinng\"",
+    "clean": "rm -rf lib"
+  },
+  "dependencies": {
+    "@dzlzv/hydra-common": "2.0.1-beta.9",
+    "@polkadot/types": "4.2.1",
+    "warthog": "https://github.com/metmirr/warthog/releases/download/v2.23.0/warthog-v2.23.0.tgz"
+  },
+  "devDependencies": {
+    "ts-node": "^9.0.0",
+    "typescript": "^3.8"
+  }
+}

+ 7 - 7
query-node/indexer-tsconfig.json → query-node/mappings/tsconfig.json

@@ -3,19 +3,19 @@
     "declaration": true,
     "importHelpers": true,
     "module": "commonjs",
+    "outDir": "lib",
+    "rootDirs": ["./"],
     "strict": true,
     "target": "es2017",
+    "noImplicitAny": false,
+    "esModuleInterop": true,
     "experimentalDecorators": true,
     "emitDecoratorMetadata": true,
     "skipLibCheck": true,
-    "sourceMap": true,
-    "inlineSources": false,
-    "strictPropertyInitialization": false,
     "baseUrl": ".",
     "paths": {
-      "@polkadot/types/augment": ["../../../types/augment-codec/augment-types.ts"]
-    },
-    "esModuleInterop": true
+      "@polkadot/types/augment": ["../../types/augment-codec/augment-types.ts"]
+    }
   },
-  "exclude": ["node_modules"]
+  "include": ["./**/*"]
 }

+ 1 - 1
query-node/mappings/types.ts

@@ -1,6 +1,6 @@
 import BN from 'bn.js'
 import { EntityId, SchemaId, ParametrizedClassPropertyValue, ClassId } from '@joystream/types/content-directory'
-import { DB } from '../generated/indexer'
+import { DatabaseManager as DB } from '@dzlzv/hydra-db-utils'
 
 export interface BaseJoystreamMember {
   memberId: BN

+ 7 - 6
query-node/package.json

@@ -15,20 +15,21 @@
     "db:drop": "(cd ./generated/graphql-server && yarn db:drop)",
     "db:migrate": "./db-migrate.sh",
     "db:schema:migrate": "(cd ./generated/graphql-server && yarn db:create && yarn db:sync && yarn db:migrate)",
-    "db:indexer:migrate": "(cd ./generated/indexer && yarn db:migrate)",
-    "codegen:indexer": "yarn hydra-cli codegen --no-install --no-graphql && cp indexer-tsconfig.json generated/indexer/tsconfig.json",
-    "codegen:server": "yarn hydra-cli codegen --no-install --no-indexer",
-    "cd-classes": "ts-node scripts/get-class-id-and-name.ts",
+    "codegen": "hydra-cli codegen",
+    "codegen:noinstall": "hydra-cli codegen --no-install",
     "integration-tests": "./run-tests.sh",
+    "typegen": "rm -rf ./mappings/generated-t/ && hydra-typegen typegen manifest.yml --debug",
     "db:init": "(cd ./generated/graphql-server && TYPEORM_LOGGING=true ts-node ../../scripts/initializeDefaultSchemas.ts)"
   },
   "author": "",
   "license": "ISC",
   "devDependencies": {
-    "@dzlzv/hydra-cli": "^0.0.24"
+    "@dzlzv/hydra-cli": "0.1.8-1",
+    "@dzlzv/hydra-processor": "2.1.0-beta.4",
+    "@dzlzv/hydra-typegen": "2.1.0-beta.4"
   },
   "dependencies": {
-    "@dzlzv/hydra-indexer-lib": "^0.0.22-legacy.1.26.1",
+    "@dzlzv/hydra-db-utils": "^2.0.1-beta.0",
     "@joystream/types": "^0.15.0",
     "@types/bn.js": "^4.11.6",
     "@types/debug": "^4.1.5",

+ 2 - 8
query-node/processor-start.sh

@@ -4,12 +4,6 @@ set -e
 SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
 cd $SCRIPT_PATH
 
-# set +a
-# . ../.env
-# export TYPEORM_DATABASE=${PROCESSOR_DB_NAME}
-
-export TYPEORM_DATABASE=${PROCESSOR_DB_NAME:=query_node_processor}
-
-cd ./generated/indexer
 yarn
-DEBUG=${DEBUG} yarn start:processor --env ../../../.env
+
+yarn hydra-processor run --env=../.env

+ 0 - 3
query-node/run-tests.sh

@@ -35,9 +35,6 @@ docker-compose up -d db
 # Migrate the databases
 yarn workspace query-node-root db:migrate
 
-# Seed initial schemas
-yarn workspace query-node-root db:init
-
 docker-compose up -d graphql-server
 
 # Start the joystream-node before the indexer

+ 2 - 2
query-node/scripts/initializeDefaultSchemas.ts

@@ -6,7 +6,7 @@ loadConfig()
 
 import BN from 'bn.js'
 import { nanoid } from 'nanoid'
-import { SnakeNamingStrategy } from '@dzlzv/hydra-indexer-lib/lib'
+import { SnakeNamingStrategy } from '@dzlzv/hydra-db-utils'
 import { createConnection, ConnectionOptions, getConnection, EntityManager } from 'typeorm'
 
 import { Video } from '../generated/graphql-server/src/modules/video/video.model'
@@ -105,7 +105,7 @@ export async function main(): Promise<void> {
     // ///////// Channel /////////////////
 
     // ///////// Category /////////////////
-    const category = new Category({ ...commonProperties, name: `Category(0) ${nanoid()}` })
+    const category = new Category({ ...commonProperties, name: `Other` })
     await db.save<Category>(category)
     // ///////// Category /////////////////
 

+ 11 - 1
runtime-modules/content-directory/src/operations.rs

@@ -70,7 +70,17 @@ pub enum OperationType<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for OperationType<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        write!(formatter, "OperationType {:?}", self)
+        match self {
+            OperationType::CreateEntity(_) => {
+                write!(formatter, "OperationType::CreateEntity")
+            }
+            OperationType::AddSchemaSupportToEntity(_) => {
+                write!(formatter, "OperationType::AddSchemaSupportToEntity")
+            }
+            OperationType::UpdatePropertyValues(_) => {
+                write!(formatter, "OperationType::UpdatePropertyValues")
+            }
+        }
     }
 }
 

+ 5 - 9
runtime-modules/content-directory/src/schema/input.rs

@@ -10,7 +10,7 @@ pub enum InputPropertyValue<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for InputPropertyValue<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        write!(formatter, "InputPropertyValue {:?}", self)
+        write!(formatter, "InputPropertyValue")
     }
 }
 
@@ -42,13 +42,9 @@ impl<T: Trait> InputPropertyValue<T> {
     /// Retrieve all involved `entity_id`'s, if current `InputPropertyValue` is reference
     pub fn get_involved_entities(&self) -> Option<Vec<T::EntityId>> {
         match self {
-            InputPropertyValue::Single(single_property_value) => {
-                if let Some(entity_id) = single_property_value.get_involved_entity() {
-                    Some(vec![entity_id])
-                } else {
-                    None
-                }
-            }
+            InputPropertyValue::Single(single_property_value) => single_property_value
+                .get_involved_entity()
+                .map(|entity_id| vec![entity_id]),
             InputPropertyValue::Vector(vector_property_value) => {
                 vector_property_value.get_involved_entities()
             }
@@ -81,7 +77,7 @@ pub enum InputValue<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for InputValue<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> sp_std::fmt::Result {
-        write!(formatter, "InputValue {:?}", self)
+        write!(formatter, "InputValue")
     }
 }
 

+ 3 - 7
runtime-modules/content-directory/src/schema/output.rs

@@ -64,13 +64,9 @@ impl<
     /// Retrieve all involved `entity_id`'s, if current `StoredPropertyValue` is reference
     pub fn get_involved_entities(&self) -> Option<Vec<EntityId>> {
         match self {
-            StoredPropertyValue::Single(single_property_value) => {
-                if let Some(entity_id) = single_property_value.get_involved_entity() {
-                    Some(vec![entity_id])
-                } else {
-                    None
-                }
-            }
+            StoredPropertyValue::Single(single_property_value) => single_property_value
+                .get_involved_entity()
+                .map(|entity_id| vec![entity_id]),
             StoredPropertyValue::Vector(vector_property_value) => vector_property_value
                 .get_vec_value_ref()
                 .get_involved_entities(),

+ 6 - 13
runtime-modules/hiring/src/lib.rs

@@ -1257,14 +1257,9 @@ impl<T: Trait> Module<T> {
         opt_imbalance: Option<NegativeImbalance<T>>,
         application_id: &T::ApplicationId,
     ) -> Option<T::StakeId> {
-        if let Some(imbalance) = opt_imbalance {
-            Some(Self::infallible_stake_initiation_on_application(
-                imbalance,
-                application_id,
-            ))
-        } else {
-            None
-        }
+        opt_imbalance.map(|imbalance| {
+            Self::infallible_stake_initiation_on_application(imbalance, application_id)
+        })
     }
 
     fn infallible_stake_initiation_on_application(
@@ -1399,11 +1394,9 @@ impl<T: Trait> Module<T> {
     pub(crate) fn create_stake_balance(
         opt_stake_imbalance: &Option<NegativeImbalance<T>>,
     ) -> Option<BalanceOf<T>> {
-        if let Some(ref imbalance) = opt_stake_imbalance {
-            Some(imbalance.peek())
-        } else {
-            None
-        }
+        opt_stake_imbalance
+            .as_ref()
+            .map(|imbalance| imbalance.peek())
     }
 
     /// Performs all necessary check before adding an opening

+ 4 - 6
runtime-modules/working-group/src/lib.rs

@@ -1577,17 +1577,15 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
                     hiring::ApplicationById::<T>::get(successful_application.hiring_application_id);
 
                 // Staking profile for worker
-                let stake_profile = if let Some(ref stake_id) = application.active_role_staking_id {
-                    Some(RoleStakeProfile::new(
+                let stake_profile = application.active_role_staking_id.as_ref().map(|stake_id| {
+                    RoleStakeProfile::new(
                         stake_id,
                         &opening
                             .policy_commitment
                             .terminate_role_stake_unstaking_period,
                         &opening.policy_commitment.exit_role_stake_unstaking_period,
-                    ))
-                } else {
-                    None
-                };
+                    )
+                });
 
                 // Get worker id
                 let new_worker_id = <NextWorkerId<T, I>>::get();

+ 1 - 1
scripts/cargo-build.sh

@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
 
-export WASM_BUILD_TOOLCHAIN=nightly-2021-02-20
+export WASM_BUILD_TOOLCHAIN=nightly-2021-03-24
 
 cargo build --release

+ 7 - 0
scripts/cargo-tests-with-networking.sh

@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+
+export WASM_BUILD_TOOLCHAIN=nightly-2021-03-24
+
+echo 'running all cargo tests'
+cargo test --release --all -- --ignored

+ 1 - 1
scripts/raspberry-cross-build.sh

@@ -9,7 +9,7 @@
 export WORKSPACE_ROOT=`cargo metadata --offline --no-deps --format-version 1 | jq .workspace_root -r`
 
 docker run \
-    -e WASM_BUILD_TOOLCHAIN=nightly-2021-02-20 \
+    -e WASM_BUILD_TOOLCHAIN=nightly-2021-03-24 \
     --volume ${WORKSPACE_ROOT}/:/home/cross/project \
     --volume ${HOME}/.cargo/registry:/home/cross/.cargo/registry \
     joystream/rust-raspberry \

+ 1 - 1
scripts/run-dev-chain.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-export WASM_BUILD_TOOLCHAIN=nightly-2021-02-20
+export WASM_BUILD_TOOLCHAIN=nightly-2021-03-24
 
 # Build release binary
 cargo build --release

+ 3 - 4
setup.sh

@@ -25,11 +25,10 @@ curl https://getsubstrate.io -sSf | bash -s -- --fast
 
 source ~/.cargo/env
 
-rustup install nightly-2021-02-20
-rustup target add wasm32-unknown-unknown --toolchain nightly-2021-02-20
+rustup install nightly-2021-03-24
+rustup target add wasm32-unknown-unknown --toolchain nightly-2021-03-24
 
-rustup install 1.51.0
-rustup default 1.51.0
+rustup default nightly-2021-03-24
 
 rustup component add rustfmt clippy
 

+ 1 - 1
storage-node/packages/cli/src/commands/dev.ts

@@ -147,7 +147,7 @@ const init = async (api: RuntimeApi): Promise<any> => {
 // Using sudo to create initial storage lead and worker with given keys taken from env variables.
 // Used to quickly setup a storage provider on a new chain before a council is ready.
 const makeMemberInitialLeadAndStorageProvider = async (api: RuntimeApi): Promise<any> => {
-  if (api.workers.getLeadRoleAccount()) {
+  if (await api.workers.getLeadRoleAccount()) {
     throw new Error('The Storage Lead is already set!')
   }
 

File diff suppressed because it is too large
+ 311 - 247
yarn.lock


Some files were not shown because too many files changed in this diff